/* Navigation / Header styles */
.header {
    position: fixed;
    width: 100%;
    max-width: 100vw;
    top: 0;
    left: 0;
    right: 0;
    height: 95px;
    background-color: #FFFFFFE5;
    z-index: 99999;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden !important;
}

/* Prevent horizontal scrolling on header */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0;
    position: relative;
    max-width: 100%;
    overflow: hidden !important;
}

/* Responsive container using Bootstrap-like approach */
.header-container {
    padding-left: clamp(20px, 5vw, 180px);
    padding-right: clamp(20px, 5vw, 180px);
}

.header .logo {
    padding: 36px 0;
    margin-left: 0;
}

.header .logo h1 {
    margin: 0;
}

.header .logo a {
    font-family: "Pretendard Variable", Pretendard, sans-serif;
    font-weight: 600;
    font-style: normal;
    font-size: 24px;
    color: #333;
    text-decoration: none;
}

.navbar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    max-width: calc(100% - 200px);
    overflow: hidden;
}

/* Ensure navbar doesn't cause horizontal scroll on wider screens */
@media (min-width: 901px) {
    .header {
        overflow: hidden !important;
    }
    
    .header-container {
        overflow: hidden !important;
    }
    
    .navbar {
        max-width: calc(100% - 400px);
        overflow: visible;
    }
    
    /* Ensure language dropdown doesn't cause overflow */
    .language-dropdown-wrapper {
        position: relative;
        overflow: visible;
    }
    
    /* Language dropdown hidden by default on wider screens */
    .language-dropdown:not(.active) {
        display: none;
        opacity: 0;
        visibility: hidden;
        right: 0;
    }
    
    /* Show dropdown when active on wider screens - ensure it's visible */
    .language-dropdown.active {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 100004 !important;
        position: fixed !important;
    }
    
    /* Ensure language button icon is visible */
    .language-btn .language-icon {
        display: block !important;
        width: 20px;
        height: 20px;
        opacity: 1;
    }
    
    /* Hide mobile language wrapper in navbar menu on desktop - languages should be in button dropdown only */
    .navbar .menu .mobile-language-wrapper,
    .navbar .menu li.mobile-language-wrapper {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

@media (max-width: 992px) {
    .navbar {
        max-width: calc(100% - 120px);
    }
}

.navbar .menu {
    display: flex;
    align-items: center;
    gap: clamp(40px, 8vw, 145px);
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar .menu li {
    position: relative;
}

/* Hide mobile language wrapper on desktop/wider screens - it's only for mobile menu */
/* This hides languages from navbar menu - they should only be in the language button dropdown */
.navbar .menu .mobile-language-wrapper,
.navbar .menu li.mobile-language-wrapper,
.mobile-language-wrapper {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.navbar .menu li:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.1);
}

@media (max-width: 1200px) {
    .navbar .menu li:not(:last-child)::after {
        right: -15px;
    }
}

@media (max-width: 992px) {
    .navbar .menu li:not(:last-child)::after {
        display: none;
    }
}

.navbar .menu li a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    text-decoration: none;
    font-size: 16px;
    padding: 10px 0;
    transition: color 0.3s ease;
}

.navbar .menu li a .menu-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.navbar .menu li.active a {
    color: #333;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-right: 0;
    flex-shrink: 0;
    overflow: visible;
    pointer-events: auto !important;
    position: relative;
    z-index: 100000;
}

/* Prevent header actions from causing overflow */
@media (min-width: 901px) {
    .header-actions {
        max-width: 200px;
        flex-shrink: 0;
    }
}

.support-btn {
    padding: 8px 20px;
    border: 1px solid #1A1A1A;
    border-radius: 6px;
    background: transparent;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.support-btn:hover {
    background: #f5f5f5;
    border-color: #1A1A1A;
    text-decoration: none;
    color: #333;
}

.language-dropdown-wrapper {
    position: relative;
    z-index: 100001;
    pointer-events: auto !important;
    overflow: visible !important;
}

.language-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #000;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto !important;
    position: relative;
    z-index: 100002;
}

.language-btn:hover {
    background: #333;
}

.language-btn .language-icon {
    width: 20px !important;
    height: 20px !important;
    display: block !important;
    opacity: 1 !important;
    filter: brightness(0) invert(1); /* Ensure white icon is visible on black button */
    object-fit: contain;
}

.language-dropdown {
    position: fixed;
    background: #2A2A2A;
    border-radius: 8px 8px 0 0;
    min-width: 150px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100004;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: auto !important;
}

/* Show dropdown when active */
.language-dropdown.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 100003 !important;
    pointer-events: auto !important;
}

.language-option {
    padding: 12px 20px;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-family: "Pretendard Variable", Pretendard, sans-serif;
    font-weight: 400;
    font-style: normal;
    font-size: 15px;
    text-align: left;
}

.language-option:hover,
.language-option.selected {
    background-color: #3A3A3A;
}

.hamburger {
    display: none;
    cursor: pointer;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 9999;
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    padding: 0;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    margin: 5px 0;
    background-color: #333;
    transition: 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.menu {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Desktop menu behavior */
@media (min-width: 901px) {
    .menu.active {
        display: flex;
        transform: translateX(0);
    }
}

/* Tablet and small desktop adjustments */
@media (max-width: 1200px) {
    .header-container {
        padding-left: clamp(20px, 3vw, 100px);
        padding-right: clamp(20px, 3vw, 100px);
    }
    
    .navbar .menu {
        gap: clamp(30px, 5vw, 80px);
    }
}

@media (max-width: 992px) {
    .header-container {
        padding-left: clamp(20px, 4vw, 60px);
        padding-right: clamp(20px, 4vw, 60px);
    }
    
    .navbar .menu {
        gap: clamp(20px, 4vw, 50px);
    }
    
    .navbar .menu li a {
        font-size: 14px;
    }
    
    .navbar .menu li a span {
        display: none;
    }
    
    .navbar .menu li a .menu-icon {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 900px) {
    .navbar {
        /* Don't use display:none - use visibility to keep menu accessible */
        visibility: hidden;
        opacity: 0;
        position: absolute;
        pointer-events: none;
    }
    
    /* But keep menu accessible for overlay */
    .navbar .menu {
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: all !important;
    }
    
    .hamburger {
        display: block !important;
        z-index: 10000;
        position: relative;
    }
}

@media (max-width: 837px) {
    /* Mobile 2-row navbar layout */
    
    /* Header: Auto height for 2 rows */
    .header {
        padding: 10px 0;
        height: auto;
        min-height: fit-content;
    }
    
    /* Header container: Use grid for 2-row layout */
    .header-container {
        display: grid !important;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        padding-left: 20px;
        padding-right: 20px;
        align-items: center;
    }

    /* Row 1: Top Bar - Logo on left, Actions on right */
    .header-container > .logo {
        grid-row: 1;
        grid-column: 1;
        justify-self: start;
        padding: 10px 0;
        margin: 0;
        width: auto;
        margin-left: 20px !important;
    }
    
    .header .logo a {
        font-size: 20px;
    }

    .header-actions {
        display: flex !important;
        grid-row: 1;
        grid-column: 1;
        justify-self: end;
        align-items: center;
        gap: 10px;
        margin: 0;
    }

    .language-dropdown-wrapper {
        display: block !important;
        position: relative !important;
        z-index: 10001 !important;
    }

    /* Language button clickable on mobile */
    .language-btn {
        pointer-events: all !important;
        position: relative;
        z-index: 10002 !important;
        margin-right: 20px !important;
    }

    /* Language dropdown mobile positioning - use fixed positioning */
    .language-dropdown {
        position: fixed !important;
        z-index: 100004 !important;
        min-width: 150px !important;
        pointer-events: all !important;
    }

    /* Ensure dropdown is visible when active on mobile */
    .language-dropdown.active {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        position: fixed !important;
    }

    /* Prevent header overflow - dropdown uses fixed positioning */
    .header {
        overflow: hidden !important;
    }
    
    /* Prevent header-container overflow - dropdown uses fixed positioning */
    .header-container {
        overflow: hidden !important;
    }

    /* Ensure dropdown wrapper doesn't clip */
    .language-dropdown-wrapper {
        overflow: visible !important;
    }

    /* Header actions overflow visible for dropdown */
    .header-actions {
        overflow: visible !important;
    }

    /* Row 2: Navigation (Bottom Bar) - Centered */
    /* Override all styles from 900px query */
    .navbar {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: static !important;
        left: auto !important;
        transform: none !important;
        pointer-events: all !important;
        grid-row: 2;
        grid-column: 1;
        width: 100%;
        max-width: 100%;
        margin-top: 0;
        padding-top: 0;
        overflow: visible;
        text-align: center;
        white-space: normal !important;
    }

    .navbar .menu {
        display: flex !important;
        justify-content: space-between !important;  /* ← CHANGE: from center to space-between */
        align-items: center;
        gap: 0 !important;  /* ← CHANGE: remove fixed gap, use space-between instead */
        flex-wrap: nowrap;
        list-style: none;
        margin: 0;
        padding: 0 20px !important;  /* ← ADD: match container padding */
        position: static;
        width: 100%;
        height: auto;
    }

    .navbar .menu li {
        position: relative;
        width: auto;
    }

    /* First, hide ALL dividers for mobile to override desktop rules */
    .navbar .menu li::after {
        display: none !important;
        content: none !important;
    }
    
    /* Vertical dividers between menu items - only between About Quazar, Product, Contact */
    /* Divider after About Quazar - perfectly centered in 150px gap (75px from each edge) */
    .navbar .menu li[data-page="home"]::after {
        content: '' !important;
        position: absolute;
        left: calc(100% + 25px - 0.5px);
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
        height: 20px;
        background-color: rgba(0, 0, 0, 0.4);
        display: block !important;
        margin: 0;
        padding: 0;
    }
    
    /* Divider after Product - perfectly centered in 150px gap (75px from each edge) */
    .navbar .menu li[data-page="product"]::after {
        content: '' !important;
        position: absolute;
        left: calc(100% + 25px - 0.5px);
        top: 50%;
        transform: translateY(-50%);
        width: 1px;
        height: 20px;
        background-color: rgba(0, 0, 0, 0.4);
        display: block !important;
        margin: 0;
        padding: 0;
    }
    
    /* No divider after Contact - ensure it's completely hidden */
    .navbar .menu li[data-page="contact"]::after {
        display: none !important;
        content: none !important;
        visibility: hidden !important;
    }

    .navbar .menu li a {
        display: flex;
        align-items: center;
        gap: 8px;
        color: #666;
        font-size: 14px;
        padding: 8px 0;
        text-decoration: none;
    }

    .navbar .menu li a .menu-icon {
        width: 20px;
        height: 20px;
        opacity: 0.7;
        filter: none;
    }

    .navbar .menu li a span {
        display: inline !important;
    }

    /* Hide hamburger menu - we don't need it with visible navbar */
    .hamburger {
        display: none !important;
        grid-row: 1;
        grid-column: 1;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    /* Hide mobile language wrapper in menu - using header-actions language button instead */
    .menu .mobile-language-wrapper {
        display: none !important;
    }
}

/* Additional responsive fixes for very small screens */
@media (max-width: 576px) {
    .header .logo a {
        font-size: 18px;
    }
    
    .header-container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    /* Ensure hamburger stays hidden (navbar is visible on mobile) */
    .hamburger {
        display: none !important;
    }
    
    /* Adjust menu spacing for smaller screens */
    .navbar .menu {
        gap: 55px;
        flex-wrap: wrap;
    }
    
    .navbar .menu li a {
        font-size: 12px;
    }

    .navbar .menu li a .menu-icon {
        width: 18px;
        height: 18px;
    }
}

/* ==================== Desktop Navbar Spacing (Align with 180px container gutters) ==================== */
@media (min-width: 992px) {
    /* Make header-container use the same 180px gutters as main containers */
    .header-container {
        max-width: calc(100% - 360px);
        margin-left: 180px;
        margin-right: 180px;
        padding-left: 0;
        padding-right: 0;
    }

    /* Logo and actions sit at container edges (no extra side margins) */
    .header .logo {
        margin-left: 0;
        padding: 0; /* Remove vertical padding to allow flexbox align-items: center to center logo */
    }

    .header-actions {
        margin-right: 0;
        padding-right: 0; /* Ensure flush alignment with container right edge (180px margin) */
    }

    /* Desktop menu gap and divider position stay as before */
    .navbar .menu {
        gap: 145px;
    }

    .navbar .menu li:not(:last-child)::after {
        right: -72.5px;
    }

    /* Desktop only: ensure no divider after Contact menu item */
    .navbar .menu li[data-page="contact"]::after {
        content: none;
        display: none;
    }
}


