/**
 * ============================================
 * HORIZONTAL NAVIGATION - LIGHT YELLOW THEME
 * Supports: Horizontal Dropdowns + Multi-level
 * Colors: Warm Yellow & Orange Theme
 * Works: Desktop + Tablet + Mobile (All Devices)
 * ============================================
 */

:root {
    --primary-yellow: #f59e0b;
    --primary-orange: #ea580c;
    --primary-dark: #c2410c;
    --text-dark: #1a1a1a;
    --text-medium: #333;
    --text-light: #666;
    --bg-yellow-light: #fef3c7;
    --bg-yellow-lighter: #fef9e7;
    --bg-orange-soft: rgba(251, 191, 36, 0.08);
    --border-yellow-light: rgba(251, 191, 36, 0.15);
    --border-gray: #e5e7eb;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.15);
    --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================
   HEADER - Universal
   ============================================ */

.main-header {
    background: white;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 9999;
    transition: all 0.3s ease;
}

.main-header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.main-header .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

/* Logo */
.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.logo:hover {
    opacity: 0.8;
}

.logo i {
    font-size: 28px;
    color: var(--primary-yellow);
}

/* Mobile Toggle - Hidden by default */
.mobile-menu-toggle {
    display: none;
}

.mobile-close-btn {
    display: none;
}

/* ============================================
   DESKTOP NAVIGATION (1025px+)
   ============================================ */

@media (min-width: 1025px) {
    .main-nav {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
        gap: 5px;
        align-items: center;
    }

    .main-nav > li {
        position: relative;
    }

    .main-nav > li > a {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 25px 18px;
        color: var(--text-medium);
        text-decoration: none;
        font-size: 15px;
        font-weight: 500;
        border-radius: 8px;
        transition: all 0.2s ease;
    }

    .main-nav > li > a:hover {
        color: var(--primary-orange);
        background: var(--bg-orange-soft);
    }

    .main-nav > li > a.active {
        color: var(--primary-orange);
        background: var(--bg-orange-soft);
    }

    /* Chevron icon */
    .main-nav > li > a i.fa-chevron-down {
        font-size: 11px;
        transition: transform 0.3s ease;
        opacity: 0.7;
    }

    .main-nav > li:hover > a i.fa-chevron-down {
        transform: rotate(180deg);
    }

    /* ============================================
       HORIZONTAL DROPDOWN - Desktop
       ============================================ */

    .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 0;
        background: white;
        box-shadow: var(--shadow-lg);
        border-radius: 12px;
        padding: 20px;
        min-width: 250px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: all 0.3s ease;
        border-top: 3px solid var(--primary-yellow);
        white-space: nowrap;
        z-index: 1001;
        list-style: none;
        margin: 0;
        display: none;
    }

    /* Arrow pointer */
    .dropdown-menu::before {
        content: '';
        position: absolute;
        top: -8px;
        left: 20px;
        width: 16px;
        height: 16px;
        background: white;
        transform: rotate(45deg);
        border-top: 1px solid var(--border-gray);
        border-left: 1px solid var(--border-gray);
    }

    .main-nav > li:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        display: block;
    }

    .dropdown-menu ul {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
    }

    .dropdown-menu li {
        margin-bottom: 8px;
        list-style: none;
    }

    .dropdown-menu li:last-child {
        margin-bottom: 0;
    }

    .dropdown-menu li a {
        display: block;
        padding: 12px 15px;
        color: var(--text-light);
        text-decoration: none;
        font-size: 14px;
        border-radius: 6px;
        transition: all 0.2s;
    }

    .dropdown-menu li a:hover {
        background: var(--bg-yellow-light);
        color: var(--primary-orange);
        padding-left: 20px;
    }

    /* Multi-level dropdown (sub-submenu) */
    .dropdown-menu .dropdown-menu {
        position: absolute;
        top: 0;
        left: 100%;
        margin-left: 10px;
        display: none;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    .dropdown-menu li:hover > .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

/* ============================================
   MOBILE & TABLET (0-1024px)
   ============================================ */

@media (max-width: 1024px) {
    /* Mobile Toggle Button */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        font-size: 24px;
        color: var(--text-medium);
        cursor: pointer;
        padding: 10px;
        z-index: 10001;
    }

    /* Mobile Close Button */
    .mobile-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: sticky;
        top: 0;
        left: 0;
        width: 100%;
        height: 60px;
        background: linear-gradient(135deg, var(--primary-yellow) 0%, var(--primary-orange) 100%);
        color: white;
        border: none;
        font-size: 24px;
        cursor: pointer;
        z-index: 1001;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        transition: all 0.3s ease;
    }

    .mobile-close-btn:active {
        transform: scale(0.95);
    }

    .mobile-close-btn i {
        font-size: 28px;
        transition: transform 0.3s ease;
    }

    .mobile-close-btn:hover i {
        transform: rotate(90deg);
    }

    /* Mobile Navigation Container */
    .main-nav {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: white;
        flex-direction: column;
        padding: 0;
        overflow-y: auto;
        transition: left 0.4s var(--transition-smooth);
        gap: 0;
        list-style: none;
        margin: 0;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        z-index: 10000;
    }

    .main-nav.active {
        left: 0;
    }

    /* Mobile Menu Items */
    .main-nav > li {
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        list-style: none;
    }

    .main-nav > li > a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 20px;
        width: 100%;
        color: var(--text-medium);
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        transition: all 0.3s ease;
    }

    .main-nav > li > a:active {
        background: linear-gradient(90deg, var(--bg-yellow-light) 0%, var(--bg-yellow-lighter) 100%);
        color: var(--primary-orange);
    }

    /* Arrow indicator for items with submenus */
    .main-nav > li > a::after {
        content: '\f078';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        font-size: 12px;
        transition: transform 0.3s ease;
        color: #999;
    }

    .main-nav > li.open > a::after {
        transform: rotate(180deg);
        color: var(--primary-orange);
    }

    /* ============================================
       MOBILE DROPDOWN MENU
       ============================================ */

    .dropdown-menu {
        position: static !important;
        left: auto !important;
        top: auto !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        border-top: none !important;
        white-space: normal !important;
        
        /* Background gradient - Warm yellow */
        background: linear-gradient(180deg, var(--bg-yellow-light) 0%, var(--bg-yellow-lighter) 100%) !important;
        
        /* Animation */
        max-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.4s var(--transition-smooth) !important;
        
        /* Layout */
        padding: 0 !important;
        margin: 0 !important;
        min-width: 100% !important;
        width: 100% !important;
        display: block !important;
        border-left: 4px solid transparent !important;
    }

    .dropdown-menu::before {
        display: none !important;
    }

    .main-nav > li.open .dropdown-menu {
        max-height: 500px !important;
        padding: 15px 20px !important;
        border-left-color: var(--primary-yellow) !important;
        border-top: 1px solid var(--border-yellow-light) !important;
        border-bottom: 1px solid var(--border-yellow-light) !important;
    }

    .dropdown-menu ul {
        list-style: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .dropdown-menu li {
        display: block !important;
        width: 100% !important;
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border-bottom: 1px solid var(--border-yellow-light) !important;
        background: transparent !important;
    }

    .dropdown-menu li:last-child {
        border-bottom: none !important;
    }

    .dropdown-menu li a {
        display: block !important;
        width: 100% !important;
        padding: 15px 20px !important;
        color: var(--primary-dark) !important;
        text-decoration: none !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        background: transparent !important;
        border-left: 4px solid transparent !important;
        transition: all 0.3s ease !important;
        box-sizing: border-box !important;
        border-radius: 0 !important;
    }

    .dropdown-menu li a:hover {
        background: rgba(251, 191, 36, 0.15) !important;
        color: var(--primary-orange) !important;
        padding-left: 25px !important;
    }

    .dropdown-menu li a:active {
        background: linear-gradient(90deg, #fde68a 0%, #fcd34d 100%) !important;
        color: var(--primary-dark) !important;
        padding-left: 28px !important;
        border-left-color: var(--primary-orange) !important;
        box-shadow: inset 0 0 0 1px var(--border-yellow-light) !important;
    }

    /* ============================================
       NESTED DROPDOWNS (Multi-level in Mobile)
       ============================================ */

    .dropdown-menu .dropdown-menu {
        position: static !important;
        margin-left: 20px !important;
        border-left: 3px solid var(--border-yellow-light) !important;
        box-shadow: none !important;
        max-height: 0 !important;
        overflow: hidden !important;
        transition: max-height 0.3s ease !important;
        background: rgba(254, 243, 199, 0.5) !important;
    }

    .dropdown-menu li.open > .dropdown-menu {
        max-height: 500px !important;
        display: block !important;
        padding: 10px 0 !important;
    }

    /* Prevent body scroll when menu open */
    body.menu-open {
        overflow: hidden !important;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 1025px) {
    .main-nav > li:hover .dropdown-menu {
        animation: fadeInDown 0.3s ease forwards;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.main-nav > li > a:focus,
.dropdown-menu li a:focus {
    outline: 2px solid var(--primary-yellow);
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Scrollbar styling */
.main-nav::-webkit-scrollbar {
    width: 6px;
}

.main-nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
}

.main-nav::-webkit-scrollbar-thumb {
    background: rgba(245, 158, 11, 0.3);
    border-radius: 3px;
}

.main-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.5);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* iOS Safari fix */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 1024px) {
        .main-nav.active {
            height: -webkit-fill-available;
            max-height: -webkit-fill-available;
        }
    }
}