:root { --nav-height: 80px; }

.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

        @keyframes gradient-shift {
            0% {
                background-position: 0% 50%;
            }

            50% {
                background-position: 100% 50%;
            }

            100% {
                background-position: 0% 50%;
            }
        }

        @keyframes glow-pulse {
            0%, 100% {
                opacity: 0.4;
                transform: scale(1);
            }

            50% {
                opacity: 0.7;
                transform: scale(1.08);
            }
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        @keyframes shimmer {
            0% {
                transform: translateX(-100%) rotate(45deg);
            }

            100% {
                transform: translateX(200%) rotate(45deg);
            }
        }

        @keyframes bounce {
            0%, 100% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.05);
            }
        }

        @keyframes rotate {
            from {
                transform: rotate(0deg);
            }

            to {
                transform: rotate(360deg);
            }
        }

        @keyframes pulse-ring {
            0% {
                transform: scale(0.95);
                box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.7);
            }

            70% {
                transform: scale(1);
                box-shadow: 0 0 0 10px rgba(var(--primary-rgb), 0);
            }

            100% {
                transform: scale(0.95);
                box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0);
            }
        }

        /* =======================================================================
               PREMIUM NAVBAR - FIXED LAYOUT VERSION
               ======================================================================= */
        .navbar {
            height: var(--nav-height);
            background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
            background-size: 300% 300%;
            animation: gradient-shift 15s ease infinite;
            border: none;
            box-shadow: 0 10px 40px rgba(var(--primary-rgb), 0.3), 0 0 100px rgba(var(--primary-rgb), 0.1) inset;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            overflow: visible !important;
            backdrop-filter: blur(20px);
            z-index: 1030;
        }

            .navbar::before {
                content: '';
                position: absolute;
                top: -50%;
                left: -50%;
                right: -50%;
                bottom: -50%;
                background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.3) 0%, transparent 60%), radial-gradient(circle at 70% 50%, rgba(255,255,255,0.2) 0%, transparent 60%);
                animation: glow-pulse 6s ease-in-out infinite;
                pointer-events: none;
                z-index: 0;
            }

            .navbar::after {
                content: '';
                position: absolute;
                bottom: 0;
                left: 0;
                right: 0;
                height: 2px;
                background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
                animation: shimmer 3s ease-in-out infinite;
                z-index: 0;
            }

            /* FIX: Make navbar container wider */
            .navbar .container-xl {
                max-width: 100%;
                padding-left: 1.5rem;
                padding-right: 1.5rem;
                position: relative;
                z-index: 2;
            }

        @media (min-width: 1400px) {
            .navbar .container-xl {
                max-width: 1600px;
            }
        }

        /* Brand - FIX: Remove max-width constraint */
        .navbar-brand {
            font-size: 1.25rem;
            font-weight: 800;
            color: white !important;
            text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
            padding: 0.5rem 1rem;
            background: rgba(255, 255, 255, 0.15);
            border-radius: 0.75rem;
            border: 2px solid rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
            z-index: 10;
            white-space: nowrap;
            flex-shrink: 0;
        }

            .navbar-brand::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
                transition: left 0.5s ease;
            }

            .navbar-brand:hover {
                transform: translateY(-2px);
                box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
                background: rgba(255, 255, 255, 0.25);
            }

                .navbar-brand:hover::before {
                    left: 100%;
                }

        /* Nav Links - FIX: Reduce spacing */
        .navbar-nav {
            position: static !important;
            z-index: 10;
            flex-wrap: nowrap !important;
        }

            .navbar-nav .nav-link {
                color: rgba(255, 255, 255, 0.9) !important;
                font-weight: 600;
                padding: 0.75rem 0.85rem !important;
                border-radius: 0.6rem;
                transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                position: relative;
                overflow: hidden;
                margin: 0 0.15rem;
                font-size: 0.9rem;
                letter-spacing: 0.3px;
                white-space: nowrap;
            }

                .navbar-nav .nav-link::before {
                    content: '';
                    position: absolute;
                    bottom: 0;
                    left: 50%;
                    width: 0;
                    height: 3px;
                    background: white;
                    transform: translateX(-50%);
                    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                    border-radius: 3px 3px 0 0;
                }

                .navbar-nav .nav-link::after {
                    content: '';
                    position: absolute;
                    top: 0;
                    left: 0;
                    right: 0;
                    bottom: 0;
                    background: rgba(255, 255, 255, 0.1);
                    opacity: 0;
                    transition: opacity 0.3s ease;
                    border-radius: 0.6rem;
                }

                .navbar-nav .nav-link:hover {
                    color: white !important;
                    transform: translateY(-2px);
                    background: rgba(255, 255, 255, 0.15);
                    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
                }

                    .navbar-nav .nav-link:hover::before {
                        width: 80%;
                    }

                    .navbar-nav .nav-link:hover::after {
                        opacity: 1;
                    }

                /* Icon spacing in nav links */
                .navbar-nav .nav-link i {
                    font-size: 0.95rem;
                }

        /* Dropdown - CRITICAL FIXES */
        .nav-item.dropdown {
            position: relative !important;
            z-index: 1040;
        }

            .nav-item.dropdown .dropdown-toggle::after {
                margin-left: 0.5rem;
                transition: transform 0.3s ease;
            }

            .nav-item.dropdown.show .dropdown-toggle::after {
                transform: rotate(180deg);
            }

        .dropdown-menu {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 0.75rem;
            box-shadow: 0 20px 60px rgba(var(--primary-rgb), 0.25), 0 8px 24px rgba(0, 0, 0, 0.2);
            padding: 0.75rem;
            margin-top: 0.75rem !important;
            animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: visible !important;
            backdrop-filter: blur(20px);
            z-index: 1050 !important;
            position: absolute !important;
            top: 100% !important;
            left: 0 !important;
            right: auto !important;
            min-width: 220px;
        }

        .dropdown-menu.show {
            display: block !important;
        }

        /* Right-aligned dropdowns */
        .dropdown-menu-end {
            left: auto !important;
            right: 0 !important;
        }

        [data-bs-theme="dark"] .dropdown-menu {
            background: rgba(30, 41, 59, 0.98);
            box-shadow: 0 20px 60px rgba(var(--primary-rgb), 0.35), 0 8px 24px rgba(0, 0, 0, 0.5);
            border-color: rgba(var(--primary-rgb), 0.3);
        }

            [data-bs-theme="dark"] .dropdown-menu::before {
                content: '';
                position: absolute;
                inset: -1px;
                background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.2), rgba(var(--accent-rgb), 0.2));
                border-radius: 0.75rem;
                z-index: -1;
                opacity: 0;
                transition: opacity 0.3s ease;
            }

            [data-bs-theme="dark"] .dropdown-menu:hover::before {
                opacity: 1;
            }

        .dropdown-item {
            color: var(--body-color);
            padding: 0.75rem 1rem;
            border-radius: 0.5rem;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            font-weight: 500;
            position: relative;
            overflow: hidden;
            display: flex;
            align-items: center;
        }

            .dropdown-item i {
                transition: transform 0.2s ease;
            }

            .dropdown-item::before {
                content: '';
                position: absolute;
                left: 0;
                top: 0;
                bottom: 0;
                width: 3px;
                background: linear-gradient(135deg, var(--primary), var(--accent));
                transform: scaleY(0);
                transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            }

            .dropdown-item:hover {
                background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12), rgba(var(--accent-rgb), 0.12));
                color: var(--primary);
                transform: translateX(4px);
                padding-left: 1.25rem;
            }

                .dropdown-item:hover::before {
                    transform: scaleY(1);
                }

                .dropdown-item:hover i {
                    transform: translateX(3px);
                }

        /* COLLAPSIBLE DROPDOWN HEADERS */
        .dropdown-header {
            padding: 0.5rem 1rem;
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--primary);
            border-bottom: 2px solid rgba(var(--primary-rgb), 0.2);
            margin-bottom: 0.5rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
            cursor: pointer;
            transition: all 0.3s ease;
            user-select: none;
            border-radius: 0.5rem;
        }

            .dropdown-header:hover {
                background: rgba(var(--primary-rgb), 0.08);
            }

            .dropdown-header .header-text {
                display: flex;
                align-items: center;
                gap: 0.5rem;
            }

            .dropdown-header .chevron-icon {
                font-size: 1rem;
                transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
                color: var(--primary);
            }

            .dropdown-header.collapsed .chevron-icon {
                transform: rotate(-180deg);
            }

        .dropdown-section {
            max-height: 2000px;
            overflow: hidden;
            transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-bottom 0.3s ease;
            opacity: 1;
            margin-bottom: 0.5rem;
        }

            .dropdown-section:not(.collapsed) {
                overflow: visible;
            }

            .dropdown-section.collapsed {
                max-height: 0 !important;
                opacity: 0;
                margin-bottom: 0 !important;
            }

        .dropdown-divider {
            border-color: rgba(var(--primary-rgb), 0.15);
            margin: 0.75rem 0;
        }

        /* Products (and similar) item with flyout submenu to the left */
        .dropdown-item-with-flyout {
            position: relative;
        }

        .dropdown-item-with-flyout .dropdown-item-main {
            display: flex;
            align-items: center;
        }

        .dropdown-item-with-flyout .flyout-indicator {
            font-size: 0.875rem;
            opacity: 0.7;
            pointer-events: none;
        }

        .dropdown-item-with-flyout:hover .flyout-indicator {
            opacity: 1;
        }

        .dropdown-flyout {
            position: absolute;
            right: 100%;
            top: 0;
            margin-right: 2px;
            min-width: 200px;
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-radius: 0.75rem;
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
            padding: 0.5rem;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s ease, visibility 0.2s ease;
            z-index: 1051;
        }

        .dropdown-item-with-flyout:hover .dropdown-flyout {
            opacity: 1;
            visibility: visible;
        }

        [data-bs-theme="dark"] .dropdown-flyout {
            background: rgba(30, 41, 59, 0.98);
            border-color: rgba(var(--primary-rgb), 0.3);
            box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
        }

        .dropdown-flyout-header {
            padding: 0.5rem 0.75rem;
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--primary);
            border-bottom: 1px solid rgba(var(--primary-rgb), 0.2);
            margin-bottom: 0.35rem;
        }

        .dropdown-flyout .dropdown-item {
            padding: 0.5rem 0.75rem;
        }

        /* Cart Badge */
        .cart-link-wrapper {
            position: relative;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.65rem;
            background: rgba(255, 255, 255, 0.15);
            border-radius: 0.6rem;
            border: 2px solid rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            cursor: pointer;
            margin: 0 0.3rem;
            z-index: 10;
        }

            .cart-link-wrapper:hover {
                background: rgba(255, 255, 255, 0.25);
                transform: translateY(-2px);
                box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
            }

            .cart-link-wrapper svg,
            .vril-nav-icon-svg {
                color: white;
                filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
                width: 22px !important;
                height: 22px !important;
            }

        #cartCount {
            background: linear-gradient(135deg, #ef4444, #dc2626) !important;
            animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
            font-weight: 700;
            box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
        }

            #cartCount.has-items {
                animation: bounce 2s ease-in-out infinite, pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
            }

        /* Theme Toggle - reuse cart wrapper styling */
        .theme-toggle-wrapper {
            cursor: pointer;
        }

            .theme-toggle-wrapper svg {
                transition: transform 0.3s ease;
            }

            .theme-toggle-wrapper:hover svg {
                transform: scale(1.1);
            }

        #icon-sun {
            animation: rotate 10s linear infinite;
        }

        /* User Avatar */
        .avatar {
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.7));
            color: var(--primary) !important;
            border: 3px solid rgba(255, 255, 255, 0.3);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
            font-weight: 700;
            font-size: 0.95rem;
            transition: all 0.3s ease;
        }

            .avatar:hover {
                transform: scale(1.1) rotate(5deg);
                box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
            }

        /* Auth Buttons */
        .navbar .btn-primary {
            background: rgba(255, 255, 255, 0.9);
            color: var(--primary) !important;
            font-weight: 700;
            padding: 0.6rem 1.25rem;
            border-radius: 0.6rem;
            border: none;
            box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
            font-size: 0.9rem;
            white-space: nowrap;
        }

            .navbar .btn-primary::before {
                content: '';
                position: absolute;
                top: 0;
                left: -100%;
                width: 100%;
                height: 100%;
                background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
                transition: left 0.5s ease;
            }

            .navbar .btn-primary:hover {
                transform: translateY(-2px);
                box-shadow: 0 6px 20px rgba(255, 255, 255, 0.4);
                background: white;
            }

                .navbar .btn-primary:hover::before {
                    left: 100%;
                }

        .navbar .btn-outline-primary {
            border: 2px solid rgba(255, 255, 255, 0.7);
            color: white !important;
            font-weight: 600;
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            padding: 0.6rem 1.25rem;
            font-size: 0.9rem;
            white-space: nowrap;
        }

            .navbar .btn-outline-primary:hover {
                background: rgba(255, 255, 255, 0.2);
                border-color: white;
                transform: translateY(-2px);
                box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
            }

        /* Right side navbar items */
        .navbar-nav.order-md-last {
            flex-shrink: 0;
        }

        /* =======================================================================
               MOBILE RESPONSIVE
               ======================================================================= */
        @media (max-width: 991px) {
            .navbar {
                height: auto;
                min-height: var(--nav-height);
                padding: 1rem 0;
            }

                .navbar .container-xl {
                    max-width: 100%;
                }

            .navbar-brand {
                font-size: 1.1rem;
                padding: 0.4rem 0.8rem;
            }

            .navbar-collapse {
                background: rgba(var(--primary-rgb), 0.15);
                backdrop-filter: blur(20px);
                border-radius: 0.75rem;
                padding: 1rem;
                margin-top: 1rem;
                box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
            }

            .navbar-nav {
                flex-direction: column;
                flex-wrap: wrap !important;
            }

                .navbar-nav .nav-link {
                    margin: 0.25rem 0;
                    padding: 0.75rem 1rem !important;
                }

            .dropdown-menu {
                position: relative !important;
                box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.2);
                margin-top: 0.5rem !important;
            }

            .cart-link-wrapper {
                margin: 0 0.25rem;
            }

            .navbar-nav.order-md-last {
                margin-top: 1rem;
                padding-top: 1rem;
                border-top: 1px solid rgba(255, 255, 255, 0.2);
            }
        }

        @media (max-width: 576px) {
            .navbar-brand {
                font-size: 1rem;
                padding: 0.4rem 0.7rem;
            }

            .navbar .btn-primary,
            .navbar .btn-outline-primary {
                font-size: 0.85rem;
                padding: 0.5rem 1rem;
            }
        }

        /* Hide icons on smaller screens to save space */
        @media (max-width: 1200px) {
            .navbar-nav .nav-link i {
                display: none;
            }
        }

        /* =======================================================================
               FOOTER
               ======================================================================= */
        /* ----------  CSS variables (light / dark)  ---------- */
        :root {
            --bg-footer: #ffffff;
            --footer-border: #e9ecef;
            --footer-text: #6c757d;
            --footer-link: #495057;
            --footer-link-hover: #667eea;
            --footer-accent: #764ba2;
        }

        [data-bs-theme="dark"] {
            --bg-footer: #1e1e1e;
            --footer-border: #404040;
            --footer-text: #adb5bd;
            --footer-link: #dee2e6;
            --footer-link-hover: #7c93fb;
            --footer-accent: #8a66aa;
        }

        /* ----------  footer scaffold  ---------- */
        .premium-footer {
            background: var(--bg-footer);
            border-top: 1px solid var(--footer-border);
            padding: 3rem 0 2.5rem;
            margin-top: auto;
            position: relative;
            overflow: hidden;
        }

            .premium-footer::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 4px;
                background: linear-gradient(90deg, var(--footer-link-hover) 0%, var(--footer-accent) 100%);
            }

        /* ----------  links  ---------- */
        .footer-links {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            align-items: center;
            gap: .75rem;
        }

        .footer-link {
            color: var(--footer-link);
            font-weight: 500;
            text-decoration: none;
            transition: all .3s ease;
            display: inline-flex;
            align-items: center;
            gap: .35rem;
        }

            .footer-link:hover {
                color: var(--footer-link-hover);
                transform: translateY(-2px);
            }

        .footer-sep {
            color: var(--footer-text);
            user-select: none;
        }

        /* ----------  copyright  ---------- */
        .footer-copyright {
            font-size: .875rem;
            color: var(--footer-text);
        }

        /* ---- responsive ---- */
        @media(max-width:768px) {
            .footer-links {
                flex-direction: column;
                gap: .5rem;
            }

            .footer-sep {
                display: none;
            }
        }

        /* =======================================================================
               PAGE WRAPPER - FIXED FOR STICKY NAV
               ======================================================================= */
        .page-wrapper {
            flex: 1 0 auto;
            display: flex;
            flex-direction: column;
            min-height: calc(100vh - var(--nav-height));
            padding-top: var(--nav-height);
        }

        .page-body {
            flex: 1 0 auto;
            padding: 3rem 0;
        }

        /* =======================================================================
               SMOOTH SCROLLING
               ======================================================================= */
        html {
            scroll-behavior: smooth;
        }
