/*mobile_bottom_nav.css*/
/* ============================================================
   CARD BOTTOM NAVIGATION - one bar, every screen size
   Markup: cards/templates/cards/navbar/bottom-navbar.html
     .mobile-bottom-nav > .bottom-nav-btn (home, back, cart)
                        > .bottom-nav-dropdown > .bottom-nav-btn + .dropdown-menu
   ------------------------------------------------------------
   Phones: full width. Tablets/laptops: pinned to the bottom of
   the viewport, only as wide as the card column, centred under
   it - desktop users get exactly the phone experience.

   --vcard-shell-width MUST equal the card column's max-width
   (it is not set in cards/css/themes/base.css - see CHANGES.md).
   ============================================================ */

:root {
    --vcard-shell-width: 500px;
    --bottom-nav-height: 60px;
    --bottom-nav-accent: var(--primary-color, #ff6b93);
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    margin-inline: auto;               /* centres the bar under the card */
    width: 100%;
    max-width: var(--vcard-shell-width);
    min-height: var(--bottom-nav-height);
    display: flex;                      /* visible at ALL widths now */
    align-items: stretch;
    justify-content: space-around;
    gap: 2px;
    padding: 4px 6px env(safe-area-inset-bottom, 0px);   /* iPhone home bar */
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1040;                      /* below Bootstrap modals (1055) */
}

/* Wider than the card: give the bar the card's rounded top so it reads as part of it */
@media (min-width: 520px) {
    .mobile-bottom-nav {
        border-radius: 16px 16px 0 0;
        border-inline: 1px solid rgba(0, 0, 0, 0.08);
    }
}

/* Keep page content (and the "Powered by" line) clear of the bar */
body {
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}

/* --- Buttons --------------------------------------------- */
.bottom-nav-btn,
.bottom-nav-dropdown {
    flex: 1 1 0;
    min-width: 0;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 6px 4px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #6c757d;
    cursor: pointer;
    position: relative;
    transition: color .2s ease, background-color .2s ease;
}

.bottom-nav-dropdown {
    display: flex;
    position: relative;
}

.bottom-nav-btn i {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform .2s ease;
}

.bottom-nav-label {
    font-size: 0.7rem;
    font-weight: 500;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bottom-nav-btn:hover,
.bottom-nav-btn:focus-visible {
    color: var(--bottom-nav-accent);
    background: color-mix(in srgb, var(--bottom-nav-accent) 7%, transparent);
    outline: none;
}

.bottom-nav-btn.active,
.bottom-nav-btn.active i {
    color: var(--bottom-nav-accent);
}

.bottom-nav-btn.active i {
    transform: translateY(-2px);
}

/* "Back" arrow points to the reading start */
html[dir="rtl"] .bottom-nav-btn[data-action="back"] i {
    transform: scaleX(-1);
}

/* Home always visible; Back fades in/out (toggled by floating-nav JS via inline style) */
.bottom-nav-btn[data-action="home"] {
    display: flex !important;
}

.bottom-nav-btn[data-action="back"] {
    transition: opacity .2s ease;
}

.bottom-nav-btn[data-action="back"][style*="display: none"] {
    opacity: 0;
    pointer-events: none;
}

.bottom-nav-btn[data-action="back"][style*="display: flex"] {
    opacity: 1;
    pointer-events: auto;
}

/* --- Cart badge (sits on the icon, mirrors in RTL) -------
   restaurant-menu-3.js toggles inline display flex/none.   */
.cart-nav-badge,
.shop-cart-nav-badge { /* shop cart: own class, restaurant-menu-3.js rewrites every .cart-nav-badge */
    position: absolute;
    top: 4px;
    inset-inline-start: calc(50% + 4px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--bottom-nav-accent);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 0 0 2px #fff;
}

/* --- "More" dropdown (Bootstrap .dropdown-menu, opens upward) --- */
.bottom-nav-dropdown .dropdown-menu {
    position: absolute;
    bottom: 100%;
    top: auto;
    inset-inline-end: 0;
    left: auto;
    margin-bottom: 10px;
    min-width: 220px;
    padding: 8px 0;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.15);
}

html[dir="rtl"] .bottom-nav-dropdown .dropdown-menu {
    right: auto;
}

.bottom-nav-dropdown .dropdown-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    color: #6c757d;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Scoped: the old unscoped .dropdown-item rules restyled every Bootstrap dropdown on the page */
.bottom-nav-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #212529;
    font-size: 0.875rem;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.bottom-nav-dropdown .dropdown-item i {
    width: 20px;
    font-size: 0.95rem;
    color: var(--bottom-nav-accent);
    text-align: center;
}

.bottom-nav-dropdown .dropdown-item:hover {
    background: color-mix(in srgb, var(--bottom-nav-accent) 8%, transparent);
    color: var(--bottom-nav-accent);
}

/* Language items (core/includes/language-switcher.html, dropdown_direction='menu') */
.bottom-nav-dropdown .lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

.bottom-nav-dropdown .lang-item.active {
    background: color-mix(in srgb, var(--bottom-nav-accent) 8%, transparent);
    color: var(--bottom-nav-accent);
    font-weight: 600;
}

.bottom-nav-dropdown .lang-item .lang-check {
    margin-inline-start: auto;
    width: auto;
}

/* the dropdown can now be taller than the space above the bar */
.bottom-nav-dropdown .dropdown-menu {
    max-height: min(70vh, 480px);
    overflow-y: auto;
}

/* --- Compact phones / landscape --------------------------- */
@media (max-width: 360px) {
    .bottom-nav-btn i {
        font-size: 1.05rem;
    }

    .bottom-nav-label {
        font-size: 0.62rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    :root {
        --bottom-nav-height: 48px;
    }

    .bottom-nav-btn {
        flex-direction: row;
        gap: 6px;
    }
}

/* Legacy desktop top-nav switch is gone: the bottom bar is the only nav at every width. */
.desktop-nav {
    display: none !important;
}
