/* ===================================
   KoreaWave Academy - Header Styles
   =================================== */

/* Header Wrapper */
.header-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: box-shadow 0.3s ease;
}

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

/* Header Spacer */
.header-spacer {
    height: 140px;
}

@media (max-width: 768px) {
    .header-spacer {
        height: 70px;
    }
}

/* Top Bar */
.top-bar {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.header-wrapper.scrolled .top-bar {
    height: 0;
    overflow: hidden;
    border-bottom: none;
}

.top-bar-container {
    max-width: 1270px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.top-bar-item {
    display: inline-block;
    font-size: 14px;
    line-height: 42px;
    color: #64748b;
    text-decoration: none;
    padding: 0 18px;
    border-right: 1px solid #e2e8f0;
    letter-spacing: -0.5pt;
    transition: color 0.2s ease;
}

.top-bar-item:hover {
    color: #1e40af;
}

.top-bar-item:last-child {
    border-right: none;
}

/* Language Selector */
.lang-selector {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    line-height: 42px;
    color: #64748b;
    cursor: pointer;
    padding: 0 18px;
    letter-spacing: -0.5pt;
    transition: color 0.2s ease;
}

.lang-selector:hover {
    color: #1e40af;
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 140px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    list-style: none;
    padding: 8px 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    z-index: 200;
}

.lang-selector:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #475569;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.lang-dropdown li a:hover {
    background: #f1f5f9;
    color: #1e40af;
}

.lang-dropdown li a.active {
    color: #1e40af;
    font-weight: 600;
    background: #eff6ff;
}

.lang-flag {
    font-size: 1.1rem;
}

/* Main Header */
.main-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.header-wrapper.scrolled .main-header {
    border-bottom-color: transparent;
}

.header-container {
    max-width: 1270px;
    margin: 0 auto;
    padding: 18px 20px;
    position: relative;
    display: flex;
    align-items: center;
}

.header-logo {
    display: inline-block;
    z-index: 1000;
}

.header-logo a {
    display: flex;
    align-items: center;
    height: 50px;
}

.header-logo img {
    max-height: 42px;
    width: auto;
    transition: all 0.3s ease;
}

.header-wrapper.scrolled .header-logo img {
    max-height: 38px;
}

/* Main Navigation */
.main-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-48%);
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 4px;
}

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

.main-nav > li > a {
    display: block;
    padding: 10px 14px;
    color: #334155;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: -0.5pt;
    transition: all 0.2s ease;
    border-radius: 8px;
    white-space: nowrap;
}

.main-nav > li > a:hover {
    color: #1e40af;
    background: #f1f5f9;
}

.main-nav > li > a.active {
    color: #1e40af;
    font-weight: 600;
}

/* My Page Button */
.btn-mypage {
    position: absolute;
    right: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: #fff;
    padding: 0 28px;
    min-width: 140px;
    height: 44px;
    line-height: 44px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.5pt;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.25);
}

.btn-mypage:hover {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.35);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1001;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: #334155;
    margin: 6px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Menu Panel */
.mobile-menu-panel {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 999;
    overflow-y: auto;
    flex-direction: column;
}

.mobile-menu-panel.active {
    display: flex !important;
}

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

.mobile-nav li {
    border-bottom: 1px solid #f1f5f9;
}

.mobile-nav a {
    display: block;
    padding: 16px 20px;
    color: #334155;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    color: #1e40af;
    background: #f8fafc;
}

/* Mobile Menu Footer */
.mobile-menu-footer {
    padding: 5px 20px 20px 20px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-top: none;
    margin-top: 0;
}

.mobile-menu-footer .btn-mypage-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.mobile-auth-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mobile-auth-buttons a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-auth-buttons .btn-login {
    background: #fff;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.mobile-auth-buttons .btn-signup {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* Mobile Auth - Logged In State */
.mobile-auth-user {
    flex-direction: column;
    gap: 12px;
}

.mobile-user-greeting {
    display: block;
    text-align: center;
    padding: 14px 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: 1px solid #bfdbfe;
}

.mobile-auth-buttons .btn-logout {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #fff;
    color: #64748b;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-auth-buttons .btn-logout:hover {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

/* Mobile Language Section */
.mobile-lang-section {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
}

.mobile-lang-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 10px;
    font-weight: 500;
}

.mobile-lang-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-lang-list li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 6px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.7rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.mobile-lang-list li a .flag {
    font-size: 1.2rem;
    line-height: 1;
}

.mobile-lang-list li a:hover,
.mobile-lang-list li a.active {
    color: #1e40af;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.mobile-lang-list li a.active {
    font-weight: 600;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-menu-overlay.active {
    display: block !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-nav {
        gap: 2px;
    }

    .main-nav > li > a {
        font-size: 0.9rem;
        padding: 8px 10px;
    }

    .btn-mypage {
        padding: 0 16px;
        min-width: 100px;
        height: 38px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .top-bar {
        display: none;
    }

    .main-nav {
        display: none;
    }

    .btn-mypage {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .header-container {
        padding: 14px 20px;
    }

    .header-logo img {
        max-height: 36px;
    }
}
