/**
 * XPEL Korea Header & Mega Menu
 * Version 5.0 - Improved padding & About mega menu with stock ticker
 */

/* ==========================================================================
   Site Header
   ========================================================================== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background-color: #FFFFFF;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Homepage: Transparent header until scrolled */
.home .site-header {
    background-color: transparent;
    box-shadow: none;
}

.home .site-header .nav__link {
    color: #FFFFFF;
}

.home .site-header .header__cta {
    background-color: transparent;
    border-color: #FFFFFF;
    color: #FFFFFF;
}

/* Scrolled state - applies to all pages */
.site-header.is-scrolled {
    background-color: #FFFFFF;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.site-header.is-scrolled .nav__link {
    color: #171717;
}

.site-header.is-scrolled .header__cta {
    background-color: #FDB521;
    border-color: #FDB521;
    color: #000000;
}

/* Non-homepage: Always show dark CTA */
body:not(.home) .site-header .header__cta {
    background-color: #FDB521;
    border-color: #FDB521;
    color: #000000;
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Logo */
.header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.header__logo img {
    height: 80px;
    width: auto;
}

/* Default: Dark logo for non-homepage pages */
.header__logo-dark {
    display: block;
}

.header__logo-light {
    display: none;
}

/* Homepage: Light logo until scrolled */
.home .header__logo-dark {
    display: none;
}

.home .header__logo-light {
    display: block;
}

/* When scrolled (any page): Dark logo */
.site-header.is-scrolled .header__logo-light {
    display: none !important;
}

.site-header.is-scrolled .header__logo-dark {
    display: block !important;
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.nav {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav__list {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.nav__item {
    position: relative;
    height: 100%;
}

.nav__link {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 1.25rem;
    height: 100%;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #171717;
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav__link:hover {
    color: #FDB521;
}

.nav__link .icon {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.nav__item:hover .nav__link .icon {
    transform: rotate(180deg);
}

/* ==========================================================================
   Mega Menu Base
   ========================================================================== */
.mega-menu {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #FFFFFF;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 12px 12px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    min-width: 700px;
}

/* Bridge to prevent hover gap */
.mega-menu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
}

.nav__item:hover .mega-menu {
    opacity: 1;
    visibility: visible;
}

.mega-menu__inner {
    padding: 2rem 2.5rem;
}

/* ==========================================================================
   Coverage Mega Menu
   ========================================================================== */
.mega-menu--coverage {
    min-width: 1000px;
}

.mega-menu--coverage .mega-menu__inner {
    padding: 2.5rem 3rem;
}

.mega-menu__coverage-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.5rem;
}

.coverage-card {
    display: block;
    text-decoration: none;
    text-align: center;
}

.coverage-card__image {
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    background-color: #F0F0F0;
}

.coverage-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.coverage-card:hover .coverage-card__image img {
    transform: scale(1.05);
}

.coverage-card__title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #000000;
}

.coverage-card__title .icon {
    width: 16px;
    height: 16px;
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.coverage-card:hover .coverage-card__title .icon {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   Products Mega Menu
   ========================================================================== */
.mega-menu--products {
    min-width: 750px;
}

.mega-menu--products .mega-menu__inner {
    padding: 2rem 2.5rem 2.5rem;
}

.mega-menu__all-products {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #E5E5E5;
}

.mega-menu__all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #000000;
    text-decoration: none;
    transition: color 0.2s ease;
}

.mega-menu__all-link:hover {
    color: #FDB521;
}

.mega-menu__all-link .icon {
    width: 20px;
    height: 20px;
}

.mega-menu__products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2.5rem;
}

.mega-menu__column {
    min-width: 0;
}

.mega-menu__title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 1rem;
    padding-bottom: 0.625rem;
    border-bottom: 2px solid #FDB521;
}

.mega-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu__list li {
    margin-bottom: 0.625rem;
}

.mega-menu__list li:last-child {
    margin-bottom: 0;
}

.mega-menu__link {
    font-size: 0.9375rem;
    color: #525252;
    text-decoration: none;
    transition: color 0.2s ease;
    line-height: 1.4;
}

.mega-menu__link:hover {
    color: #FDB521;
}

/* ==========================================================================
   About Mega Menu (회사소개) - NEW
   ========================================================================== */
.mega-menu--about {
    /* Uses default min-width: 700px from base */
}

.mega-menu--about .mega-menu__inner {
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 200px;
}

.mega-menu__about-links {
    padding: 2rem 2rem;
}

.mega-menu__about-links a {
    display: block;
    padding: 0.75rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: #333333;
    text-decoration: none;
    border-bottom: 1px solid #F0F0F0;
    transition: color 0.2s ease;
}

.mega-menu__about-links a:last-child {
    border-bottom: none;
}

.mega-menu__about-links a:hover {
    color: #FDB521;
}

/* Stock Ticker Section */
.mega-menu__stock {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: 0 0 12px 0;
}

.mega-menu__stock-exchange {
    font-size: 1.25rem;
    font-weight: 700;
    color: #FFFFFF;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

.mega-menu__stock-symbol {
    font-size: 1rem;
    font-weight: 800;
    color: #FDB521;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.mega-menu__stock-price {
    font-size: 2rem;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.mega-menu__stock-change {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
}

.mega-menu__stock-change.is-positive {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22C55E;
}

.mega-menu__stock-change.is-negative {
    background-color: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.mega-menu__stock-updated {
    font-size: 0.6875rem;
    color: #888;
    margin-top: 0.75rem;
}
.mega-menu__stock-disclaimer {
    display: block;
    font-size: 0.5625rem;
    color: #666;
    margin-top: 0.5rem;
    line-height: 1.3;
}
/* ==========================================================================
   Simple Dropdown (Legacy - keep for fallback)
   ========================================================================== */
.dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dropdown::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    height: 20px;
}

.nav__item:hover .dropdown {
    opacity: 1;
    visibility: visible;
}

.dropdown__link {
    display: block;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #404040;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.dropdown__link:hover {
    background-color: #F5F5F5;
    color: #000000;
}

/* ==========================================================================
   Header Actions
   ========================================================================== */
.header__actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header__cta {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #000000;
    background-color: #FFFFFF;
    border: 2px solid #FFFFFF;
    border-radius: 9999px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.header__cta:hover {
    background-color: #FDB521;
    border-color: #FDB521;
}

.header__cta .icon {
    width: 16px;
    height: 16px;
}

@media (min-width: 1024px) {
    .header__cta {
        display: inline-flex;
    }
}

/* ==========================================================================
   Tesla Promo Button Styles
   ========================================================================== */
.header__cta--tesla {
    background-color: transparent;
    border-color: #FFFFFF;
    color: #FFFFFF;
}

.header__cta--tesla:hover {
    background-color: #FDB521;
    border-color: #FDB521;
    color: #000000;
}

/* Non-homepage: Outline style */
body:not(.home) .site-header .header__cta--tesla {
    background-color: transparent;
    border-color: #FDB521;
    color: #FDB521;
}

body:not(.home) .site-header .header__cta--tesla:hover {
    background-color: #FDB521;
    color: #000000;
}

/* Scrolled state: Yellow outline only */
.site-header.is-scrolled .header__cta--tesla {
    background-color: transparent;
    border-color: #FDB521;
    color: #FDB521;
}

.site-header.is-scrolled .header__cta--tesla:hover {
    background-color: #FDB521;
    color: #000000;
}

/* Mobile Tesla Button */
.btn--tesla {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    background-color: transparent;
    border: 2px solid #FDB521;
    color: #FDB521;
    border-radius: 9999px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn--tesla:hover {
    background-color: #FDB521;
    color: #000000;
}

.btn--tesla .icon {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Mobile Toggle
   ========================================================================== */
.mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #FFFFFF;
}

.site-header.is-scrolled .mobile-toggle {
    color: #171717;
}

.mobile-toggle .icon {
    width: 24px;
    height: 24px;
}

@media (min-width: 1024px) {
    .mobile-toggle {
        display: none;
    }
}

/* ==========================================================================
   Mobile Navigation
   ========================================================================== */
.mobile-nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 360px;
    background: #FFFFFF;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.mobile-nav.is-open {
    transform: translateX(0);
}

.mobile-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #E5E5E5;
}

.mobile-nav__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #525252;
}

.mobile-nav__close .icon {
    width: 24px;
    height: 24px;
}

.mobile-nav__content {
    padding: 1.5rem;
}

.mobile-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-nav__item {
    border-bottom: 1px solid #F5F5F5;
}

.mobile-nav__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: #171717;
    text-decoration: none;
}

.mobile-nav__link .icon {
    width: 20px;
    height: 20px;
    color: #A3A3A3;
    transition: transform 0.2s ease;
}

.mobile-nav__item.is-expanded .mobile-nav__link .icon {
    transform: rotate(180deg);
}

.mobile-submenu {
    display: none;
    padding-bottom: 1rem;
}

.mobile-nav__item.is-expanded .mobile-submenu {
    display: block;
}

.mobile-submenu__title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #737373;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.mobile-submenu__link {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: #525252;
    text-decoration: none;
}

.mobile-submenu__link:hover {
    color: #FDB521;
}

.mobile-nav__cta {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #E5E5E5;
}

.mobile-nav__cta .btn {
    width: 100%;
    justify-content: center;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Hide Desktop Nav on Mobile
   ========================================================================== */
@media (max-width: 1023px) {
    .nav {
        display: none;
    }
}

/* ==========================================================================
   Responsive Mega Menu
   ========================================================================== */
@media (max-width: 1200px) {
    .mega-menu {
        min-width: 600px;
    }
    
    .mega-menu--coverage {
        min-width: 700px;
    }
    
    .mega-menu__coverage-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mega-menu--products {
        min-width: 550px;
    }
    
    .mega-menu__products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

/* ==========================================================================
   Back to Top
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    background: #000000;
    color: #FFFFFF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: #FDB521;
    color: #000000;
}

.back-to-top .icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* ==========================================================================
   Admin Bar
   ========================================================================== */
body.admin-bar .site-header {
    top: 32px;
}

body.admin-bar .mega-menu {
    top: 112px; /* 80px header + 32px admin bar */
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
    
    body.admin-bar .mega-menu {
        top: 126px; /* 80px header + 46px admin bar */
    }
}

.nav__link--promo { color: #FDB521 !important; font-weight: 600; }
.mobile-nav__link--promo { color: #FDB521 !important; font-weight: 600; }
