/**
 * Modulo Commerce — Bottom Nav (Menu bas)
 *
 * Toutes les valeurs visuelles transitent par des propriétés personnalisées CSS
 * injectées dans :root depuis inject_bottom_nav_css() en PHP.
 * Les sélecteurs ID (#mt-bnav) garantissent une spécificité suffisante
 * pour résister aux styles des thèmes, sans recourir à !important.
 *
 * Note : la media query de masquage au-dessus du seuil ne peut pas
 * utiliser de propriété personnalisée CSS (limitation de la spec CSS). Elle est
 * donc émise par inject_bottom_nav_css() avec la valeur réelle en px.
 *
 * @package ModuloCommerce
 * @since   1.0.0
 */

/* ── Layout principal ────────────────────────────────────────────────────── */

#mt-bnav {
    position:       fixed;
    bottom:         0;
    left:           0;
    right:          0;
    width:          100%;
    height:         var(--mt-bnav-height);
    background:     var(--mt-bnav-bg);
    border-top:     var(--mt-bnav-border-top);
    border-radius:  var(--mt-bnav-radius) var(--mt-bnav-radius) 0 0;
    z-index:        var(--mt-bnav-z-index);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display:        flex;
    align-items:    stretch;
    box-sizing:     border-box;
    margin:         0;
    writing-mode:   horizontal-tb;
    overflow:       visible;
    transition:     transform .25s ease;
}

/* Réinitialisation writing-mode pour tous les enfants */
#mt-bnav * {
    writing-mode:     horizontal-tb;
    text-orientation: mixed;
    white-space:      nowrap;
    box-sizing:       border-box;
}

/* ── Liens ───────────────────────────────────────────────────────────────── */

#mt-bnav a {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    flex:            1;
    height:          100%;
    text-decoration: none;
    color:           var(--mt-bnav-color-text);
    font-size:       var(--mt-bnav-font-size);
    line-height:     1.2;
    gap:             3px;
    padding:         0 4px;
    transition:      color .2s ease;
    min-width:       0;
}

#mt-bnav a:hover,
#mt-bnav a.is-active {
    color: var(--mt-bnav-color-active);
}

/* ── Icônes SVG ──────────────────────────────────────────────────────────── */

#mt-bnav a svg {
    display:     block;
    width:       var(--mt-bnav-icon-size);
    height:      var(--mt-bnav-icon-size);
    flex-shrink: 0;
    overflow:    visible;
}

#mt-bnav a.is-active svg *[fill]:not([fill='none']) {
    fill: var(--mt-bnav-color-active);
}

#mt-bnav a.is-active svg *[stroke]:not([stroke='none']) {
    stroke: var(--mt-bnav-color-active);
}

/* ── Badge panier ────────────────────────────────────────────────────────── */

#mt-bnav .mt-bnav-badge {
    position:        absolute;
    top:             -4px;
    right:           -6px;
    background:      var(--mt-bnav-badge-bg, #e53e3e);
    color:           var(--mt-bnav-badge-color, #fff);
    font-size:       10px;
    font-weight:     700;
    min-width:       16px;
    height:          16px;
    border-radius:   8px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         0 3px;
    line-height:     1;
}

/* ── Wrapper icône ───────────────────────────────────────────────────────── */

#mt-bnav .mt-bnav-icon-wrap {
    position:        relative;
    display:         inline-flex;
    align-items:     center;
    justify-content: center;
}

/* ── Body padding (classe ajoutée via add_filter body_class) ─────────────── */

body.mt-has-bnav {
    padding-bottom: calc(var(--mt-bnav-height) + env(safe-area-inset-bottom, 0px));
}
