/* --- 1. Reset & Base Variables --- */
:root {
    --primary-color: #445969;
    --primary-dark: #00a35e;
    --text-color: #1b1c1d;
    --gray-text: #616568;
    --border-color: #e4e4e4;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --footer-bg: #303740;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Noto Sans KR', sans-serif; color: var(--text-color); line-height: 1.5; background-color: var(--white); overflow-x: hidden; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
ul { list-style: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }

/* Layout Utility */
.container {max-width: 1200px;margin: 0 auto;padding: 0;}
.section-py { padding: 40px 0; border-bottom: 1px solid #f1f3f5; }
.section-py:last-child { border-bottom: none; }

/* --- 2. Header & Nav (Fixed Layout) --- */
header { 
    background: var(--white); 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    width: 100%; 
}

/* 상단 영역 (로고, 메뉴, 우측 버튼) */
.header-inner { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    height: 64px; 
    position: relative;
    z-index: 20; /* 하단 영역보다 위에 위치 */
    background: white; 
}

.nav-left { display: flex; align-items: center; gap: 24px; }
.logo {font-size: 24px;font-weight: 700;color: var(--primary-color);display: flex;align-items: center;gap: 8px;flex-shrink: 0;margin-top: 14px;}
.logo span { color: var(--text-color); }
.nav-menu { display: flex; gap: 20px; font-weight: 500; display: none; }
.logo span img {height: 60px;}
.nav-right { display: flex; align-items: center; gap: 12px; }
.btn { padding: 8px 16px; border-radius: 4px; font-size: 14px; font-weight: 500; transition: 0.2s; white-space: nowrap; }
.btn-outline { border: 1px solid var(--border-color); color: var(--text-color); background: white; }
.btn-primary { background: var(--primary-color); color: var(--white); }
.lang-switch { display: flex; align-items: center; gap: 4px; cursor: pointer; padding: 4px 8px; border-radius: 4px; font-weight: 600; font-size: 14px; }
.mobile-menu-btn { display: block; font-size: 20px; cursor: pointer; }

/* PC 화면 (768px 이상) */
@media(min-width: 768px) {
    .nav-menu { display: flex; }
    .mobile-menu-btn { display: none; }
}

/* ★ 하단 영역: 대형 검색바 & 아이콘 카테고리 ★ */
.header-bottom-area {
    position: relative;
    z-index: 10;
    padding-top: 0;
    padding-bottom: 10px;
    background: white; 
    
    /* 애니메이션용 초기값 */
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 대형 검색바 */
.search-bar-large-wrap { display: flex; justify-content: center; margin-bottom: 30px; width: 100%; }
.search-bar-large { 
    display: flex; align-items: center; 
    width: 100%; max-width: 580px; height: 50px; 
    border: 2px solid #445969; border-radius: 25px; 
    overflow: hidden; background: white; 
}
.search-icon-box { padding-left: 16px; font-size: 18px; color: #445969; }
.search-input { flex: 1; border: none; outline: none; padding: 0 12px; font-size: 15px; }
.search-btn { 
    background: #445969; color: white; border: none; 
    width: 48px; height: 100%; cursor: pointer; font-size: 18px; 
    display: flex; align-items: center; justify-content: center;
}

/* ★ 아이콘 카테고리 네비게이션 (가로 정렬 강제 고정) ★ */
.category-icon-nav { 
    display: flex !important; 
    flex-direction: row !important; 
    justify-content: center; 
    gap: 32px; 
    padding-bottom: 20px; 
    flex-wrap: wrap; 
}
.cat-item { 
    display: flex !important;
    flex-direction: column !important; /* 아이콘 위, 텍스트 아래 */
    align-items: center !important; 
    gap: 8px; 
    cursor: pointer; 
    color: #495057; 
    transition: 0.2s; 
    min-width: 60px;
}
.cat-item:hover, .cat-item.active { color: #445969; }
.ci-icon { 
    width: 48px; height: 48px; 
    border: 1px solid #dee2e6; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 20px; background: white; transition: 0.2s;
}
.cat-item:hover .ci-icon, .cat-item.active .ci-icon { background: #e6fcf5; color: #445969; border-color: #445969; }
.cat-item span { font-size: 13px; font-weight: 500; white-space: nowrap; }

/* --- Sticky Header Logic (스크롤 시) --- */
.sticky-search-box {
    margin-left: 20px;
    width: 400px;
    display: none; /* 기본 숨김 */
}
.sticky-search-box .input-wrap {
    display: flex; align-items: center;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 0 16px; 
    background: #f8f9fa;
    height: 40px;
    width: 100%;
}
.sticky-search-box .input-wrap:focus-within {
    border-color: #445969;
    background: white;
}
.sticky-search-box .icon-green { color: #445969; margin-right: 8px; font-size: 14px; }
.sticky-search-box input {
    border: none; background: transparent; outline: none;
    width: 100%; font-size: 14px;
}
.sticky-search-box button {
    background: none; border: none; color: #445969; cursor: pointer;
}

/* 스크롤 시 변화 (.scrolled 클래스) */
header.scrolled .header-bottom-area {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom: none;
    margin: 0;
    pointer-events: none; /* 클릭 방지 */
}
header.scrolled .default-menu { display: none !important; }
header.scrolled .sticky-search-box { 
    display: block !important; 
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 모바일 헤더 대응 (Max Width: 768px) */
@media (max-width: 768px) {
    .header-inner { height: 60px; padding: 0 16px; }
    .nav-right .btn, .nav-right .lang-switch { display: none; }
    .mobile-menu-btn { display: block !important; font-size: 24px; color: #333; }
    .sticky-search-box { display: none !important; }
    
    /* 모바일 메뉴 (JS 토글) */
    .nav-menu { display: none; }
    .nav-menu.active {
        display: flex; flex-direction: column;
        position: absolute; top: 60px; left: 0; width: 100%;
        background: white; padding: 20px;
        border-bottom: 1px solid #e4e4e4; z-index: 9999; gap: 16px;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    
    /* 모바일에서 아이콘 네비 스크롤 */
    .category-icon-nav { 
        justify-content: flex-start; 
        overflow-x: auto; 
        flex-wrap: nowrap; 
        padding-left: 16px; padding-right: 16px; 
        gap: 20px; 
        -webkit-overflow-scrolling: touch;
    }
    .cat-item { flex: 0 0 auto; }
}

/* --- 3. Hero Slider (Carousel) --- */
.hero-slider { position: relative; width: 100%; height: 400px; overflow: hidden; background: #000; }
.slide-container { display: flex; width: 300%; height: 100%; transition: transform 0.5s ease-in-out; }
.slide { width: 100%; height: 100%; position: relative; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; }
.slide::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.4); z-index: 1; }
.slide-content { position: relative; z-index: 2; text-align: center; color: white; padding: 0 20px; max-width: 800px; animation: fadeInUp 0.8s ease-out; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.slide-badge { display: inline-block; background: var(--primary-color); color: white; padding: 6px 12px; border-radius: 4px; font-weight: 700; font-size: 13px; margin-bottom: 16px; }
.slide-title { font-size: 36px; font-weight: 700; margin-bottom: 16px; line-height: 1.3; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.slide-desc { font-size: 18px; margin-bottom: 24px; opacity: 0.95; }
.slider-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.2); color: white; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 10; font-size: 20px; }
.prev-btn { left: 20px; } .next-btn { right: 20px; }
.slider-dots { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; z-index: 10; }
.dot { width: 12px; height: 12px; background: rgba(255,255,255,0.4); border-radius: 50%; cursor: pointer; transition: 0.3s; }
.dot.active { background: var(--primary-color); width: 30px; border-radius: 6px; }

/* --- 4. Course Lists --- */
.section-header {margin-bottom: 24px;display: flex;justify-content: space-between;align-items: flex-end;margin-top: 50px;}
.section-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.section-subtitle { font-size: 14px; color: var(--gray-text); }
.view-all { font-size: 14px; color: var(--gray-text); display: flex; align-items: center; gap: 4px; }
.view-all:hover { color: var(--primary-color); }
.course-grid { display: grid; grid-template-columns: repeat(1, 1fr); gap: 24px; }
@media(min-width: 500px) { .course-grid { grid-template-columns: repeat(2, 1fr); } }
@media(min-width: 768px) { .course-grid { grid-template-columns: repeat(4, 1fr); } }
@media(min-width: 1024px) { .course-grid { grid-template-columns: repeat(4, 1fr); } }
.course-card { background: var(--white); border-radius: 8px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; cursor: pointer; border: 1px solid transparent; }
.course-card:hover { transform: translateY(-4px); box-shadow: 0 8px 16px rgba(0,0,0,0.08); }
.card-thumb {position: relative;width: 100%;aspect-ratio: 16/9;overflow: hidden;}
.card-thumb img {width: 100%;height: auto;object-fit: cover;transition: transform 0.3s;}
.card-badge { position: absolute; top: 10px; left: 10px; padding: 4px 8px; font-size: 11px; font-weight: 700; border-radius: 4px; color: white; z-index: 1; }
.badge-best { background: var(--primary-color); } .badge-new { background: #3498db; } .badge-free { background: #f39c12; }
.card-body { padding: 12px 2px; }
.card-title {font-size: 15px;font-weight: 600;margin-bottom: 6px;line-height: 1.4;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;overflow: hidden;height: 21px;}
.card-instructor { font-size: 13px; color: var(--gray-text); margin-bottom: 8px; }
.card-meta { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #7d8287; margin-bottom: 10px; }
.rating { color: #f5a623; font-weight: 700; display: flex; align-items: center; gap: 2px; }
.card-price { font-size: 16px; font-weight: 700; color: #175cbe; }
.card-price.free { color: var(--primary-color); }
.original-price { font-size: 13px; color: #adb5bd; text-decoration: line-through; margin-left: 6px; font-weight: 400; }

/* --- 5. Footer --- */
footer { background: var(--footer-bg); color: #cdd1d4; font-size: 13px; padding: 50px 0; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 40px; }
@media(min-width: 768px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }
.footer-col h4 { color: white; font-weight: 700; margin-bottom: 16px; }
.footer-col ul li { margin-bottom: 10px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); margin-top: 40px; padding-top: 20px; display: flex; justify-content: space-between; align-items: center; }
.social-icons a { margin-left: 12px; font-size: 18px; color: white; }
/* 스크롤된 상태에서 아래 부분 완전히 숨기기 */
header.main-header.scrolled .header-bottom-area {
    display: none !important;
}

/* 스크롤된 상태에서는 nav-left 안에 있는 큰 검색바도 숨기고, sticky만 노출 */
header.main-header.scrolled .search-bar-large-wrap {
    display: none !important;
}

header.main-header.scrolled .sticky-search-box {
    display: block !important;
}

/* 스크롤 상태에서 헤더 높이를 한 줄로 줄이기 */
header.main-header.scrolled .header-inner {
    padding-top: 8px;
    padding-bottom: 8px;
}
