/* Shared navbar style: single source of truth across all pages. */

.navbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem !important;
    padding: 0.7rem 1.1rem !important;
    border-bottom: 1px solid rgba(29, 29, 31, 0.08) !important;
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: saturate(160%) blur(16px) !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05) !important;
}

.navbar,
.navbar * {
    font-family: "Montserrat", sans-serif !important;
}

.navbar-brand {
    flex: 0 0 auto !important;
}

.navbar-brand a {
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
    letter-spacing: -0.01em !important;
    color: #111827 !important;
}

.navbar-logo {
    width: 26px !important;
    height: 26px !important;
    border-radius: 7px !important;
    flex-shrink: 0 !important;
    display: block !important;
}

.navbar-toggle {
    display: none !important;
    flex-direction: column !important;
    /* 44px is the minimum comfortable tap target on touch devices; the previous padding
       produced a box around 34px, which is easy to miss with a thumb. */
    min-width: 44px !important;
    min-height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid rgba(17, 24, 39, 0.12) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    border-radius: 10px !important;
    padding: 8px 9px !important;
    cursor: pointer !important;
}

.navbar-toggle:focus-visible {
    outline: 2px solid #0071e3 !important;
    outline-offset: 2px !important;
}

/* Morph the bars into a cross while the menu is open, so the control shows its state. */
.navbar-toggle .bar {
    transition: transform 220ms ease, opacity 160ms ease !important;
}

.navbar-toggle[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg) !important;
}

.navbar-toggle[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0 !important;
}

.navbar-toggle[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg) !important;
}

@media (prefers-reduced-motion: reduce) {
    .navbar-toggle .bar {
        transition: none !important;
    }
}

.navbar-toggle .bar {
    display: block !important;
    width: 18px !important;
    height: 2px !important;
    background: #1f2937 !important;
    margin: 2px 0 !important;
    border-radius: 999px !important;
}

.navbar-links {
    list-style: none !important;
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.2rem !important;
    margin: 0 !important;
    padding: 0.2rem !important;
}

.navbar-links li {
    margin: 0 !important;
    position: relative !important;
    z-index: 1 !important;
}

.navbar-links a {
    display: block !important;
    text-decoration: none !important;
    color: #1f2937 !important;
    font-weight: 600 !important;
    font-size: 0.92rem !important;
    padding: 0.5rem 0.78rem !important;
    border-radius: 999px !important;
    transition: color 180ms ease, transform 180ms ease, background 180ms ease, text-shadow 180ms ease !important;
}

.navbar-links a:hover {
    color: #1f2937 !important;
    background: rgba(255, 255, 255, 0.58) !important;
    text-shadow: 0 1px 8px rgba(255, 255, 255, 0.65);
    transform: translateY(-1px) !important;
}

.navbar-links a.nav-current {
    color: #1f2937 !important;
    text-shadow: 0 1px 7px rgba(255, 255, 255, 0.55);
}

.account-menu-toggle.nav-current {
    color: #1f2937 !important;
    text-shadow: 0 1px 7px rgba(255, 255, 255, 0.55);
}

.account-menu-toggle {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    border: none !important;
    background: transparent !important;
    color: #1f2937 !important;
    font-weight: 600 !important;
    font-size: 0.92rem !important;
    padding: 0.5rem 0.78rem !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    transition: background 180ms ease, transform 180ms ease !important;
}

.account-avatar-wrap {
    width: 17px;
    height: 17px;
    border-radius: 999px;
    overflow: hidden;
    background: #f2f3f6;
    border: 1px solid rgba(31, 41, 55, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.account-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0.9;
}

/* 44px is the smallest reliable touch target; the cart icon sat just under it. */
.nav-cart-link {
    min-width: 44px !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 1.1rem !important;
}

.account-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.58) !important;
    transform: translateY(-1px) !important;
}

.account-dropdown {
    position: absolute !important;
    right: 0 !important;
    top: calc(100% + 8px) !important;
    min-width: 190px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(17, 24, 39, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.12) !important;
    padding: 6px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(8px) !important;
    transition: opacity 170ms ease, transform 170ms ease, visibility 170ms ease !important;
    pointer-events: none !important;
    z-index: 30 !important;
}

.nav-account-item.open .account-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

.nav-account-item:hover .account-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

.account-dropdown a {
    border-radius: 8px !important;
    padding: 0.55rem 0.72rem !important;
    font-size: 0.88rem !important;
}

.nav-active-pill {
    position: absolute !important;
    top: 50% !important;
    left: 0 !important;
    height: 34px !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(250, 251, 255, 0.88)) !important;
    border: 1px solid rgba(255, 255, 255, 0.85) !important;
    box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.05) !important;
    transform: translate3d(0, -50%, 0) !important;
    transition: width 240ms ease, transform 260ms ease, opacity 160ms ease !important;
    pointer-events: none !important;
    opacity: 0 !important;
    z-index: 0 !important;
}

body.page-entering {
    animation: navPageEnter 220ms ease-out;
}

body.page-leaving {
    opacity: 0.62;
    transform: translateY(8px);
    transition: opacity 180ms ease, transform 180ms ease;
}

@keyframes navPageEnter {
    from {
        opacity: 0.6;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .navbar-toggle {
        display: flex !important;
    }

    .navbar-links {
        position: absolute !important;
        top: calc(100% + 6px) !important;
        left: 10px !important;
        right: 10px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0 !important;
        background: rgba(255, 255, 255, 0.96) !important;
        border: 1px solid rgba(17, 24, 39, 0.1) !important;
        border-radius: 14px !important;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.09) !important;
        max-height: 0 !important;
        overflow: hidden !important;
        padding: 0 !important;
        transition: max-height 240ms ease, padding 220ms ease !important;
    }

    /* Generous ceiling: the menu grows when signed in (account, cart, orders, wishlist,
       admin), and the old 420px clipped the last items with no way to scroll to them.
       overflow-y lets it scroll on short screens rather than run off the bottom. */
    .navbar-links.show {
        max-height: min(78vh, 620px) !important;
        overflow-y: auto !important;
        padding: 0.4rem !important;
    }

    .navbar-links li {
        width: 100% !important;
    }

    .navbar-links a {
        width: 100% !important;
        border-radius: 10px !important;
        padding: 0.72rem 0.8rem !important;
    }

    .account-menu-toggle {
        width: 100% !important;
        text-align: left !important;
        border-radius: 10px !important;
        padding: 0.72rem 0.8rem !important;
    }

    .account-dropdown {
        position: static !important;
        min-width: 100% !important;
        margin-top: 4px !important;
        box-shadow: none !important;
        border-radius: 10px !important;
        border: 1px solid rgba(17, 24, 39, 0.08) !important;
    }

    .nav-active-pill {
        display: none !important;
    }
}

.site-footer {
    background: #f7f7f9;
    color: #6e6e73;
    text-align: center;
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0 0;
    padding: 0;
}

.footer-links li {
    margin: 0;
}

.footer-links a {
    color: #5f5f67;
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Shared auth-modal animation so open/close feel like tab switching. */
#auth-modal.modal-overlay {
    opacity: 0;
    transition: opacity 180ms ease !important;
}

#auth-modal.modal-overlay.show {
    opacity: 1;
}

#auth-modal .modal {
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    transition: transform 220ms ease, opacity 220ms ease !important;
}

#auth-modal.modal-overlay.show .modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

#auth-modal.modal-overlay.closing {
    opacity: 0;
}

#auth-modal.modal-overlay.closing .modal {
    transform: translateY(10px) scale(0.985);
    opacity: 0;
}
