/* ──────────────────────────────────────────
   1. BODY SAFE-AREA PADDING
   ────────────────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    body {
        padding-top: calc(clamp(70px, 13vh, 110px) + env(safe-area-inset-top, 0px));
    }
}

/* ──────────────────────────────────────────
   2. HEADER — iOS SAFE AREA TOP
   ────────────────────────────────────────── */
.header {
    padding-top: env(safe-area-inset-top, 0px);
}

/* ──────────────────────────────────────────
   3. YOUTUBE-STYLE BOTTOM NAVIGATION
   ────────────────────────────────────────── */

/* Hidden on desktop, shown on mobile */
.yt-bottom-nav {
    display: none;
}

.yt-account-menu {
    display: none;
}

@media (max-width: 970px) {

    /* Body gets extra bottom clearance for the dock */
    body {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 16px));
    }

    /* Dock Container */
    .yt-bottom-nav {
        display: flex;
        align-items: center;
        justify-content: space-around;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 900;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        padding-inline: 4px;
        background: rgba(235, 238, 243, 0.94);
        backdrop-filter: blur(24px) saturate(1.8);
        -webkit-backdrop-filter: blur(24px) saturate(1.8);
        border-top: 1px solid rgba(7, 18, 45, 0.10);
        box-shadow: 0 -4px 30px rgba(7, 18, 45, 0.08);
        animation: ytNavSlideUp 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
    }

    @keyframes ytNavSlideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    /* Sliding active indicator pill */
    .yt-nav-indicator {
        position: absolute;
        top: 6px;
        height: 3px;
        border-radius: 999px;
        background: var(--main-color, #04f9b4);
        box-shadow: 0 0 12px rgba(4, 249, 180, 0.55);
        transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1),
            width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.2s ease;
        pointer-events: none;
        opacity: 0;
        will-change: left, width;
    }

    /* Nav Buttons */
    .yt-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        flex: 1;
        min-width: 0;
        height: 100%;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 4px 2px 0;
        -webkit-tap-highlight-color: transparent;
        position: relative;
        transition: transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        outline: none;
    }

    .yt-nav-btn:active {
        transform: scale(0.88);
    }

    /* Icon Wrapper */
    .yt-nav-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        border-radius: 8px;
        transition: background 0.22s ease, transform 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .yt-nav-btn i {
        font-size: 1.15rem;
        color: rgba(7, 18, 45, 0.52);
        transition: color 0.2s ease, transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        line-height: 1;
    }

    /* Label */
    .yt-nav-label {
        font-family: var(--main-font, 'Assistant', sans-serif);
        font-size: 0.65rem;
        font-weight: 700;
        letter-spacing: 0.01em;
        color: rgba(7, 18, 45, 0.52);
        transition: color 0.2s ease;
        white-space: nowrap;
        line-height: 1;
    }

    /* Active State */
    .yt-nav-btn.yt-is-active .yt-nav-icon {
        background: rgba(4, 249, 180, 0.14);
        transform: scale(1.08);
    }

    .yt-nav-btn.yt-is-active i {
        color: var(--text-color, #07122d);
        transform: scale(1.1);
    }

    .yt-nav-btn.yt-is-active .yt-nav-label {
        color: var(--text-color, #07122d);
    }

    /* Tap Ripple */
    .yt-nav-btn::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 12px;
        background: radial-gradient(circle, rgba(4, 249, 180, 0.25) 0%, transparent 70%);
        opacity: 0;
        transform: scale(0.5);
        transition: opacity 0.35s ease, transform 0.35s ease;
        pointer-events: none;
    }

    .yt-nav-btn:active::after {
        opacity: 1;
        transform: scale(1);
        transition: none;
    }

    /* Center CTA "+" Create Button */
    .yt-nav-create {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        position: relative;
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: linear-gradient(135deg, #04f9b4, #00d997);
        color: #07122d;
        text-decoration: none;
        font-size: 1.35rem;
        margin-top: -18px;
        box-shadow: 0 8px 28px rgba(4, 249, 180, 0.5), 0 2px 8px rgba(0, 0, 0, 0.12);
        transition: transform 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275),
            box-shadow 0.28s ease;
        -webkit-tap-highlight-color: transparent;
        z-index: 2;
    }

    .yt-nav-create:hover,
    .yt-nav-create:focus-visible {
        transform: scale(1.12) translateY(-3px);
        box-shadow: 0 14px 36px rgba(4, 249, 180, 0.6), 0 4px 12px rgba(0, 0, 0, 0.14);
    }

    .yt-nav-create:active {
        transform: scale(0.92);
        box-shadow: 0 4px 16px rgba(4, 249, 180, 0.35);
        transition-duration: 0.12s;
    }

    /* Pulsing ring around center button */
    .yt-nav-create-ring {
        position: absolute;
        inset: -4px;
        border-radius: 50%;
        border: 2px solid rgba(4, 249, 180, 0.45);
        animation: ytCreatePulse 2.4s ease-in-out infinite;
        pointer-events: none;
    }

    @keyframes ytCreatePulse {

        0%,
        100% {
            transform: scale(1);
            opacity: 0.6;
        }

        50% {
            transform: scale(1.18);
            opacity: 0;
        }
    }

    /* Account Icon avatar support */
    .yt-nav-icon--account {
        overflow: hidden;
    }

    .yt-nav-icon--account img {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        object-fit: cover;
        border: 1.5px solid rgba(4, 249, 180, 0.6);
    }

    /* Account menu opened from the bottom navigation */
    .yt-account-menu {
        display: none;
        position: fixed;
        right: 10px;
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        left: 10px;
        z-index: 1000;
        direction: rtl;
        padding: 1rem;
        color: var(--text-color, #07122d);
        background: var(--header-color, #ebeef3);
        border: 1px solid rgba(7, 18, 45, 0.1);
        border-radius: 18px;
        box-shadow: 0 -12px 42px rgba(7, 18, 45, 0.2);
        font-family: var(--hebo-font, sans-serif);
    }

    .yt-account-menu__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .yt-account-menu__welcome {
        font-size: 1rem;
        font-weight: 700;
    }

    .yt-account-menu__welcome strong {
        color: var(--main-color, #01f9b6);
    }

    .yt-account-menu__avatar {
        width: 42px;
        height: 42px;
        border: 1px solid rgba(7, 18, 45, 0.18);
        border-radius: 50%;
        object-fit: cover;
    }

    .yt-account-menu__role {
        display: block;
        margin-top: 0.6rem;
        padding: 0.25rem 0.5rem;
        color: var(--text-color, #07122d);
        background: rgba(4, 249, 180, 0.25);
        border: 1px solid rgba(4, 249, 180, 0.65);
        border-radius: 8px;
        text-align: center;
        font-weight: 700;
    }

    .yt-account-menu hr {
        margin: 0.7rem 0;
        border: 0;
        border-top: 1px solid rgba(7, 18, 45, 0.1);
    }

    .yt-account-menu__links {
        display: grid;
        gap: 0.25rem;
        padding: 0;
        margin: 0;
        list-style: none;
    }

    .yt-account-menu__link,
    .yt-account-menu__logout {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        width: 100%;
        padding: 0.7rem 0.75rem;
        color: var(--text-color, #07122d);
        background: transparent;
        border: 0;
        border-radius: 10px;
        font: inherit;
        font-weight: 700;
        text-decoration: none;
        cursor: pointer;
        text-align: right;
    }

    .yt-account-menu__link i,
    .yt-account-menu__logout i {
        width: 18px;
        color: var(--main-color, #01f9b6);
        text-align: center;
    }

    .yt-account-menu__link:hover,
    .yt-account-menu__link:focus-visible {
        background: rgba(4, 249, 180, 0.16);
    }

    .yt-account-menu__logout {
        justify-content: center;
        color: #c0392b;
        background: rgba(255, 107, 107, 0.1);
    }
}


/* ──────────────────────────────────────────
   4. MOBILE BACKDROP OVERLAY
   ────────────────────────────────────────── */
.mobile-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(7, 18, 45, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.mobile-nav-backdrop.is-visible {
    display: block;
    opacity: 1;
}


/* ──────────────────────────────────────────
   5. RESPONSIVE HEADER — MOBILE IMPROVEMENTS
   ────────────────────────────────────────── */
@media (max-width: 970px) {

    /* Hamburger button upgrade */
    .header-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        border-radius: 12px;
        background: rgba(7, 18, 45, 0.07);
        border: 1px solid rgba(7, 18, 45, 0.08);
        font-size: 1.2rem;
        color: var(--text-color, #07122d);
        cursor: pointer;
        transition: background 0.2s ease, transform 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        flex-shrink: 0;
    }

    .header-toggle:active {
        transform: scale(0.92);
        background: rgba(4, 249, 180, 0.15);
    }

    .header-toggle[aria-expanded="true"] {
        background: rgba(4, 249, 180, 0.15);
    }

    /* Nav List: YouTube-inspired bottom sheet drawer */
    .nav-list {
        display: flex !important;
        position: fixed !important;
        inset: auto 0 0 0 !important;
        width: 100% !important;
        max-height: 85dvh;
        background: var(--header-color, #ebeef3);
        border-radius: 24px 24px 0 0;
        border: none;
        border-top: 1px solid rgba(7, 18, 45, 0.10);
        padding: 0.5rem 1.2rem 1.5rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
        gap: 0.3rem;
        z-index: 999;
        flex-direction: column;
        box-shadow: 0 -16px 60px rgba(7, 18, 45, 0.14);
        transform: translateY(100%);
        opacity: 0;
        pointer-events: none;
        transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.28s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Drawer handle pill */
    .nav-list::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        border-radius: 999px;
        background: rgba(7, 18, 45, 0.18);
        margin: 10px auto 12px;
        flex-shrink: 0;
    }

    /* Open state */
    .nav-list.nav-open,
    .header-toggle[aria-expanded="true"]~.nav-list,
    .header-toggle[aria-expanded="true"]+.nav-list {
        transform: translateY(0) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Nav items in drawer */
    .nav-list li {
        width: 100%;
        margin: 0;
    }

    .nav-list li a.nav-item {
        display: flex;
        align-items: center;
        direction: rtl;
        gap: 1rem;
        width: 100%;
        padding: 0.9rem 1rem;
        border-radius: 14px;
        text-align: right;
        color: var(--text-color, #07122d);
        font-family: var(--hebo-font, 'Heebo', sans-serif);
        font-size: 1rem;
        font-weight: 600;
        text-decoration: none;
        transition: background 0.18s ease, transform 0.18s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-list li a.nav-item:active {
        background: rgba(4, 249, 180, 0.18);
        transform: scale(0.98);
    }

    .nav-list li a.nav-item:hover,
    .nav-list li a.nav-item:focus-visible {
        background: linear-gradient(to right, rgba(4, 249, 180, 0.18) 0%, rgba(4, 249, 180, 0.04) 100%);
        transform: translateX(-2px);
    }

    /* Icon in drawer items */
    .nav-item__icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: rgba(4, 249, 180, 0.12);
        color: var(--text-color, #07122d);
        font-size: 1rem;
        flex-shrink: 0;
        opacity: 1;
        margin: 0;
    }

    /* Active nav item in drawer */
    .nav-item.is-ni-active {
        background: linear-gradient(to right, rgba(4, 249, 180, 0.22) 0%, rgba(4, 249, 180, 0.05) 100%);
    }

    .nav-item.is-ni-active .nav-item__icon {
        background: var(--main-color, #04f9b4);
        color: #07122d;
    }

    .nav-item.is-ni-active::after {
        display: none;
    }

    /* Header CTA button shrinks on mobile */
    .cta-delivery {
        font-size: 0.82rem;
        padding: 0.5rem 0.75rem;
        border-radius: 10px;
    }
}

/* ──────────────────────────────────────────
   6. EXTRA SMALL (iPhone SE, 375px and below)
   ────────────────────────────────────────── */
@media (max-width: 380px) {

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

    .yt-nav-create {
        width: 46px;
        height: 46px;
        font-size: 1.2rem;
        margin-top: -14px;
    }

    .yt-nav-btn i {
        font-size: 1.1rem;
    }

    .header-inner {
        padding: 0.4rem 0.75rem;
        min-height: 56px;
    }

    .brand-title {
        font-size: 12px;
    }
}

/* ──────────────────────────────────────────
   7. LANDSCAPE MOBILE
   ────────────────────────────────────────── */
@media (max-width: 970px) and (orientation: landscape) {
    .yt-bottom-nav {
        height: calc(52px + env(safe-area-inset-bottom, 0px));
    }

    .yt-nav-create {
        width: 44px;
        height: 44px;
        margin-top: -10px;
    }

    .yt-nav-label {
        display: none;
    }
}

/* ──────────────────────────────────────────
   8. DESKTOP — HIDE MOBILE ELEMENTS
   ────────────────────────────────────────── */
@media (min-width: 971px) {

    .yt-bottom-nav,
    .mobile-nav-backdrop {
        display: none !important;
    }

    .header-toggle {
        display: none !important;
    }
}

/* ──────────────────────────────────────────
   9. REDUCED MOTION
   ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

    .yt-bottom-nav,
    .yt-nav-btn,
    .yt-nav-create,
    .yt-nav-create-ring,
    .yt-nav-indicator,
    .nav-list {
        animation: none !important;
        transition: none !important;
    }
}