/* Header Component Styles - Modernized */

.header-container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    font-size: var(--font-size-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--header-padding-x);
    height: var(--header-height);
    z-index: var(--z-header);
    position: fixed;
    /* Fixed header for modern feel */
    top: 0;
    left: 0;
    width: 100%;
    transition: all 0.3s ease;
}

/* Header scrolled state (can be toggled via JS if needed, but default glass is good) */
.header-container.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    /* Removed height change - it was causing bounce-back issues when scrolling near the top.
       The height change triggered layout shifts which caused scroll oscillation. */
}

/* Left Section */
.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    height: 100%;
}

/* Hamburger Menu */
.hamburger-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    height: 20px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    transition: var(--transition-fast);
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--color-text-dark);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

.hamburger-menu:hover .hamburger-line {
    background: var(--color-primary);
}

.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Logo */
.logo-link {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(255, 138, 0, 0.3));
}

.logo {
    width: var(--logo-width);
    height: var(--logo-height);
    object-fit: contain;
}

/* Desktop Navigation */
.nav-menu {
    display: flex;
    height: 100%;
    align-items: center;
    gap: var(--spacing-lg);
    list-style: none;
    margin-bottom: 0;
}

@media (max-width: 2000px) {
    .nav-menu li {
        margin-right: 0.24rem;
    }

    .nav-menu li:last-child {
        margin-right: 0;
    }
}

.nav-menu li {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-menu a {
    color: var(--color-text-dark);
    font-size: 0.15rem;
    font-weight: 500;
    font-family: var(--font-family-primary);
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

/* Animated Underline */
.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-text-primary);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    width: 100%;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--color-primary);
    text-shadow: 0 0 20px rgba(255, 138, 0, 0.2);
}

/* Menu Badge */
.menu-badge {
    display: inline-block;
    font-size: 0.1rem;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 700;
    vertical-align: middle;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.new-badge {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: #ffffff;
}

/* Mega Menu Styles */
.has-megamenu {
    position: static;
    margin-bottom: 0;
}

.megamenu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 0.4rem 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 999;
    pointer-events: none;
}

.megamenu-content {
    display: grid;
    grid-template-columns: repeat(6, 110px);
    gap: 0.25rem;
    max-width: 13.44rem;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    justify-content: center;
}

.provider-card {
    position: relative;
    background: var(--color-white);
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    width: 110px;
    height: 135px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.provider-card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: var(--shadow-lg), 0 0 15px rgba(255, 138, 0, 0.2);
    border-color: var(--color-primary);
}

.provider-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.provider-card:hover img {
    transform: scale(1.1);
}

.provider-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.1rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 6px;
    color: #ffffff;
    text-transform: uppercase;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.provider-badge.hot {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
}

.provider-badge.new {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
}

/* Right Section */
.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    position: relative;
}

/* DateTime Display */
.datetime-display {
    font-size: 0.12rem;
    color: var(--color-text-light);
    position: absolute;
    top: -0.18rem;
    right: 0;
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    height: 0.38rem;
    padding: 0 var(--spacing-md);
    font-size: 0.16rem;
    border-radius: 20px;
    /* Pill shape */
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-family-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-login {
    background: transparent;
    color: var(--color-text-dark);
    border: 1px solid transparent;
}

.btn-login:hover {
    color: var(--color-primary);
    background: rgba(255, 138, 0, 0.05);
    border-color: rgba(255, 138, 0, 0.2);
}

.btn-join {
    background: var(--gradient-hero);
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(255, 138, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-join::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: 0.5s;
}

.btn-join:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 138, 0, 0.4);
    color: #FFFFFF;
    background: var(--gradient-hero);
}

.btn-join:hover::before {
    left: 100%;
}

/* Language Selector */
.language-selector {
    position: relative;
    display: inline-block;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    height: 32px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.language-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.1);
}

.language-btn.active {
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 138, 0, 0.3);
}

.chevron-icon {
    width: 10px;
    height: 10px;
    transition: transform 0.3s ease;
    color: #666;
}

.language-btn[aria-expanded="true"] .chevron-icon {
    transform: rotate(180deg);
}

.flag-icon {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Language Dropdown Menu */
.language-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 100;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.language-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.language-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-size: var(--font-size-sm);
    color: var(--color-text-dark);
    border-radius: 8px;
}

.language-option:hover {
    background: rgba(255, 138, 0, 0.08);
    color: var(--color-primary);
}

.language-option.active {
    background: rgba(255, 138, 0, 0.15);
    color: var(--color-primary);
    font-weight: 600;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    z-index: var(--z-mobile-menu);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.2);
}

.mobile-menu-overlay.active {
    left: 0;
}

.mobile-menu-content {
    padding: var(--spacing-lg);
    height: 100%;
    overflow-y: auto;
}

.mobile-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    color: var(--color-text-dark);
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-menu-close:hover {
    background: var(--color-primary);
    color: white;
    transform: rotate(90deg);
}

.mobile-nav-menu {
    list-style: none;
    margin-top: 60px;
}

.mobile-nav-menu li {
    margin-bottom: 8px;
}

.mobile-nav-menu a {
    display: block;
    padding: 12px 16px;
    color: var(--color-text-dark);
    font-size: 16px;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.mobile-nav-menu a:hover {
    background: linear-gradient(90deg, rgba(255, 138, 0, 0.1), transparent);
    color: var(--color-primary);
    transform: translateX(5px);
}

/* RESPONSIVE BREAKPOINTS */

@media (min-width: 1281px) {
    .hamburger-menu {
        display: none;
    }

    .nav-menu {
        display: flex;
    }

    .header-left {
        justify-content: flex-start;
    }
}

@media (max-width: 1280px) and (min-width: 769px) {
    .hamburger-menu {
        display: flex;
    }

    .nav-menu {
        display: none;
    }

    .megamenu {
        display: none !important;
    }

    .header-left {
        justify-content: flex-start;
        gap: var(--spacing-md);
    }

    .btn-login,
    .btn-join,
    .datetime-display,
    .language-selector {
        display: flex;
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 var(--spacing-sm);
        height: 60px;
    }

    .hamburger-menu {
        display: flex;
        position: relative;
        z-index: 10;
    }

    .nav-menu,
    .megamenu {
        display: none !important;
    }

    .header-left {
        flex: 1;
        justify-content: flex-start;
        align-items: center;
        gap: var(--spacing-md);
        position: relative;
    }

    .logo-link {
        margin: 0;
    }

    .logo {
        width: 110px;
        height: 32px;
    }

    .btn-login,
    .btn-join,
    .datetime-display {
        display: none;
    }

    .header-right {
        gap: var(--spacing-sm);
        z-index: 10;
    }

    .language-btn {
        width: auto;
        padding: 6px;
        background: transparent;
    }

    .language-btn span,
    .chevron-icon {
        display: none;
    }

    .flag-icon {
        width: 24px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 var(--spacing-sm);
    }
}