/**
 * ELREDA GROUP — Mobile Bottom Navigation (v3 — Minimal Red Dot)
 * ------------------------------------------------------------
 * Visual refinement only. Keeps the existing PHP, WordPress menu,
 * five-item RTL order, active-page logic and WooCommerce cart count.
 *
 * Approved RTL order:
 * الرئيسية | العروض | الأقسام | المفضلة | السلة
 *
 * Match the mobile header: flat navy, white active state, quiet gray
 * inactive state, a minimal red dot below the active label and cart badge.
 * Replace assets/css/mobile-bottom-nav.css completely with this file.
 */

/* Hide the navigation on tablet and desktop. */
.elreda-mobile-nav {
    display: none;
}

@media (max-width: 767px) {
    /* Keep the end of the page/footer reachable above the fixed bar. */
    body.elreda-has-mobile-nav {
        padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .elreda-mobile-nav,
    .elreda-mobile-nav * {
        box-sizing: border-box;
    }

    .elreda-mobile-nav {
        --elreda-nav-navy: #061a36;
        --elreda-nav-inactive: #b8c5d6;
        --elreda-nav-red: #ed0029;

        position: fixed;
        inset-inline: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 990;
        display: block;
        width: auto;
        max-width: 520px;
        margin-inline: auto;
        padding: 4px 5px;
        border: 1px solid rgba(255, 255, 255, .10);
        border-radius: 18px;
        background: var(--elreda-nav-navy); /* Same color as mobile header. */
        box-shadow: 0 6px 18px rgba(3, 19, 41, .22);
        direction: rtl;
        -webkit-tap-highlight-color: transparent;
    }

    .elreda-mobile-nav__items {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: stretch;
        width: 100%;
        gap: 0;
        margin: 0;
        padding: 0;
    }

    .elreda-mobile-nav__item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-width: 0;
        min-height: 58px;
        margin: 0;
        padding: 7px 1px 10px; /* Reserve space for active dot. */
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: var(--elreda-nav-inactive);
        font-family: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
        text-decoration: none !important;
        transition: color .18s ease, background-color .18s ease;
    }

    .elreda-mobile-nav__item:hover,
    .elreda-mobile-nav__item:focus-visible {
        background: rgba(255, 255, 255, .07);
        color: #fff;
    }

    .elreda-mobile-nav__item.is-active {
        background: transparent;
        color: #fff;
    }

    /* Minimal Red Dot: centered UNDER the active label, not above the bar.
       Physical left/translate is direction-independent for a centered dot. */
    .elreda-mobile-nav__item.is-active::before {
        content: none !important;
        display: none !important;
    }

    .elreda-mobile-nav__item.is-active::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: 2px;
        width: 5px;
        height: 5px;
        border-radius: 50%;
        background: var(--elreda-nav-red);
        transform: translateX(-50%);
        box-shadow: none;
        pointer-events: none;
    }

    .elreda-mobile-nav__icon {
        position: relative;
        display: inline-flex;
        flex: 0 0 24px;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        color: inherit;
        filter: none;
    }

    .elreda-mobile-nav__icon svg {
        display: block;
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    /* Wishlist is not singled out: every active tab uses white + red dot. */
    .elreda-mobile-nav__item[data-role="wishlist"].is-active .elreda-mobile-nav__icon {
        color: #fff;
        filter: none;
    }

    .elreda-mobile-nav__label {
        display: block;
        overflow: hidden;
        width: 100%;
        color: inherit;
        font-size: 11px;
        font-weight: 500;
        line-height: 1.35;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .elreda-mobile-nav__item.is-active .elreda-mobile-nav__label {
        font-weight: 600;
    }

    .elreda-mobile-nav__count {
        position: absolute;
        top: -5px;
        inset-inline-start: -9px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 17px;
        height: 17px;
        padding-inline: 3px;
        border: 2px solid var(--elreda-nav-navy);
        border-radius: 99px;
        background: var(--elreda-nav-red);
        color: #fff;
        font-family: Arial, sans-serif;
        font-size: 10px;
        font-weight: 700;
        line-height: 1;
        white-space: nowrap;
    }

    .elreda-mobile-nav__count[hidden] {
        display: none !important;
    }

    .elreda-mobile-nav__item:focus-visible {
        outline: 2px solid #fff;
        outline-offset: -2px;
    }
}

@media (max-width: 360px) {
    .elreda-mobile-nav {
        inset-inline: 8px;
        border-radius: 16px;
    }

    .elreda-mobile-nav__item {
        min-height: 58px;
    }

    .elreda-mobile-nav__label {
        font-size: 10px;
    }

    .elreda-mobile-nav__icon svg {
        width: 21px;
        height: 21px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .elreda-mobile-nav__item {
        transition: none;
    }
}
