/* 기본 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* 헤더 스타일 */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* 상단 바 스타일 */
.top-bar {
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
}

.logo img {
    height: 40px;
}

.header-utils {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-area {
    display: flex;
    align-items: center;
}

.search-input {
    width: 280px;
    height: 38px;
    padding: 0 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
}

.search-btn {
    height: 38px;
    padding: 0 20px;
    background: #0066cc;
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.search-btn:hover {
    background: #0052a3;
}

.user-menu {
    display: flex;
    gap: 15px;
}

.login-btn, .join-btn {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.login-btn:hover, .join-btn:hover {
    color: #0066cc;
    background: #f0f0f0;
}

/* 메인 네비게이션 */
.main-nav {
    background: #fff;
    position: relative;
    z-index: 100;
}

.nav-list {
    display: flex;
    list-style: none;
    padding: 0 20px;
}

.nav-item {
    position: static;
}

.nav-link {
    display: block;
    padding: 18px 25px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
    border-radius: 8px 8px 0 0;
}

.nav-link:hover {
    color: #ffffff;
    background: linear-gradient(135deg, #0066cc, #004499);
    border-bottom-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,102,204,0.3);
}

/* 메가 메뉴 스타일 */
.mega-menu {
    position: fixed;
    left: 50%;
    width: 60vw;
    transform: translateX(-50%) translateY(-10px);
    background: #fff;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    height: 400px;
    overflow: hidden;
    border-radius: 8px;
}

.nav-item.has-mega:hover .mega-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-item.has-mega:hover .nav-link {
    color: #ffffff;
    background: linear-gradient(135deg, #0066cc, #004499);
    border-bottom-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,102,204,0.3);
}

.mega-container {
    width: 100%;
    margin: 0 auto;
    padding: 40px 30px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    align-items: stretch;
    height: 320px;
    box-sizing: border-box;
}

.mega-column {
    height: 280px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

.mega-column h3 {
    font-size: 18px;
    color: #0066cc;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
}

.mega-column ul {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 200px;
    padding-right: 10px;
}

.mega-column li {
    margin-bottom: 10px;
}

.mega-column a {
    display: block;
    color: #666;
    text-decoration: none;
    padding: 8px 0;
    font-size: 14px;
    transition: all 0.3s ease;
    position: relative;
}

.mega-column a:hover {
    color: #0066cc;
    padding-left: 10px;
}

.mega-column a::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    width: 0;
    height: 2px;
    background: #0066cc;
    transform: translateY(-50%);
    transition: width 0.3s ease;
}

.mega-column a:hover::before {
    width: 3px;
}

/* 메가메뉴 특집 박스 */
.mega-feature {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 280px;
    box-sizing: border-box;
}

.feature-box {
    background: linear-gradient(135deg, #0066cc, #004499);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    color: white;
    box-shadow: 0 8px 20px rgba(0,102,204,0.3);
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.feature-box:hover {
    transform: translateY(-5px);
}

.feature-box h4 {
    font-size: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.feature-box p {
    font-size: 14px;
    margin-bottom: 20px;
    opacity: 0.9;
    line-height: 1.5;
}

.btn-feature {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255,255,255,0.2);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid rgba(255,255,255,0.3);
}

.btn-feature:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

/* 메인 컨텐츠 */
.main-content {
    margin-top: 140px;
    padding: 60px 0;
}

.hero-section {
    text-align: center;
    padding: 80px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.hero-section h1 {
    font-size: 48px;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-section p {
    font-size: 20px;
    opacity: 0.9;
}

/* 모바일 메뉴 토글 버튼 */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 3px;
}

/* 반응형 디자인 */
@media (max-width: 1024px) {
    .mega-menu {
        width: 80vw;
        height: 450px;
    }
    
    .mega-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
        height: 370px;
        padding: 30px 20px;
    }
    
    .mega-column {
        height: 320px;
    }
    
    .mega-feature {
        height: 320px;
    }
    
    .search-input {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .top-bar-content {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .header-utils {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .search-area {
        width: 100%;
        justify-content: center;
    }
    
    .search-input {
        width: 250px;
    }
    
    .main-nav {
        display: none;
    }
    
    .main-nav.active {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    }
    
    .nav-list {
        flex-direction: column;
        padding: 0;
    }
    
    .nav-item {
        border-bottom: 1px solid #e9ecef;
    }
    
    .nav-link {
        padding: 15px 20px;
    }
    
    .mega-menu {
        position: static;
        width: 95vw;
        margin: 0 auto;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f8f9fa;
        display: none;
        border-radius: 8px;
        left: auto;
    }
    
    .nav-item.active .mega-menu {
        display: block;
    }
    
    .mega-menu {
        position: static;
        width: 95vw;
        height: auto;
        min-height: 300px;
        left: auto;
        transform: none;
        margin: 0 auto;
    }
    
    .nav-item.has-mega:hover .mega-menu {
        transform: none;
    }
    
    .nav-item {
        position: relative;
    }
    
    .mega-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px 15px;
        height: auto;
    }
    
    .mega-column {
        height: auto;
        min-height: 180px;
    }
    
    .mega-feature {
        height: auto;
        min-height: 180px;
    }
    
    .feature-box {
        padding: 20px;
    }
    
    .hero-section h1 {
        font-size: 32px;
    }
    
    .hero-section p {
        font-size: 16px;
    }
    
    .main-content {
        margin-top: 160px;
    }
}

@media (max-width: 480px) {
    .search-input {
        width: 200px;
        font-size: 13px;
    }
    
    .search-btn {
        font-size: 13px;
        padding: 0 15px;
    }
    
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-section h1 {
        font-size: 24px;
    }
    
    .hero-section p {
        font-size: 14px;
    }
}

/* 스크롤 효과 */
.header.scrolled {
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
}

.header.scrolled .nav-link:hover {
    background: rgba(0,102,204,0.05);
}

/* 메가메뉴 스크롤바 스타일링 */
.mega-column ul::-webkit-scrollbar {
    width: 6px;
}

.mega-column ul::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.mega-column ul::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.mega-column ul::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 메가메뉴 강제 동일 높이 */
.nav-item.has-mega .mega-menu {
    height: 400px !important;
}

.nav-item.has-mega .mega-container {
    height: 320px !important;
}

.nav-item.has-mega .mega-column {
    height: 280px !important;
}

.nav-item.has-mega .mega-feature {
    height: 280px !important;
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 포커스 스타일 */
.nav-link:focus,
.search-btn:focus,
.login-btn:focus,
.join-btn:focus,
.btn-feature:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* 호버 애니메이션 - 기존 after 선택자 제거 */

/* 메가메뉴 등장 애니메이션 개선 */
.mega-menu .mega-column {
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s ease;
}

.nav-item:hover .mega-menu .mega-column:nth-child(1) { transition-delay: 0.1s; }
.nav-item:hover .mega-menu .mega-column:nth-child(2) { transition-delay: 0.2s; }
.nav-item:hover .mega-menu .mega-column:nth-child(3) { transition-delay: 0.3s; }
.nav-item:hover .mega-menu .mega-column:nth-child(4) { transition-delay: 0.4s; }

.nav-item:hover .mega-menu .mega-column {
    transform: translateY(0);
    opacity: 1;
}

/* 메뉴 호버 효과 개선 */
.main-nav:hover .nav-item:not(.active) .nav-link {
    opacity: 0.6;
    color: #888;
    transition: all 0.3s ease;
}

.nav-list:hover .nav-item:not(:hover):not(.active) .nav-link {
    opacity: 0.5;
    transform: none;
}

/* 호버 시 부드러운 전환 효과 */
.nav-item .nav-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 메뉴 활성화 시 다른 메뉴 fade 효과 */
.nav-item.active ~ .nav-item .nav-link {
    opacity: 0.6;
}