* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: #f4f5f7;
    color: #2a2a2a;
}

:root {
    --orange: #ff6b35;
    --dark: #1a2b4a;
    --bg: #f4f5f7;
    --border: #e8ebf0;
    --muted: #8b95a1;
    --green: #10b981;
}

/* ── Header ── */
.header {
    background: rgba(255,255,255,0.97);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    flex-shrink: 0;
    margin-right: 12px;
}

.logo-primary { font-size: 18px; font-weight: 700; color: #3d5afe; }
.logo-secondary { font-size: 13px; font-weight: 700; color: #45556c; }

.header-search {
    flex: 1;
    max-width: 320px;
    position: relative;
    margin-right: auto;
}

.header-search input {
    width: 100%;
    height: 34px;
    padding: 0 36px 0 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: #2a2a2a;
    font-family: inherit;
    outline: none;
}

.header-search input::placeholder { color: var(--muted); }

.header-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--muted);
}

.header-nav { display: flex; align-items: center; gap: 20px; list-style: none; }
.header-nav a { font-size: 14px; color: #314158; text-decoration: none; white-space: nowrap; }
.header-nav a:hover { color: #3d5afe; }


/* ── Top Navigation ── */
.top-nav {
    background: white;
    border-bottom: 1px solid var(--border);
}

.top-nav-inner {
    margin: 0 auto;
    padding: 0 24px;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    justify-content: center;
}
.top-nav-inner::-webkit-scrollbar { display: none; }

.top-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #2a2a2a;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
}
.top-nav-link:hover { background: var(--bg); }
.top-nav-link.active { background: var(--dark); color: white; }

/* ── Filter Bar ── */
.filter-bar {
    background: white;
    border-bottom: 1px solid var(--border);
}

.filter-bar-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.filter-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
}
.filter-bar-left::-webkit-scrollbar { display: none; }

.sub-cat-btn {
    height: 32px;
    padding: 0 14px;
    border-radius: 16px;
    border: none;
    background: var(--bg);
    font-size: 13px;
    font-weight: 500;
    color: #2a2a2a;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}
.sub-cat-btn:hover { background: #dde0e6; }
.sub-cat-btn.active { background: var(--orange); color: white; }

.filter-search-wrap {
    display: flex;
    align-items: center;
    position: relative;
    flex-shrink: 0;
}

.filter-search-wrap input {
    height: 32px;
    width: 160px;
    padding: 0 12px 0 34px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: 10px 0 0 10px;
    font-size: 13px;
    color: #2a2a2a;
    font-family: inherit;
    outline: none;
    flex: 1;
}
.filter-search-wrap input::placeholder { color: var(--muted); }

.filter-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    color: var(--muted);
    pointer-events: none;
    z-index: 1;
}

.filter-search-btn {
    height: 32px;
    padding: 0 14px;
    background: var(--dark);
    color: white;
    border: none;
    border-radius: 0 10px 10px 0;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s;
}

.filter-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.content-type-btns { display: flex; align-items: center; gap: 4px; }

.ct-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 10px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}
.ct-btn:hover { background: var(--bg); color: #2a2a2a; }
.ct-btn.active { background: var(--dark); color: white; }

.fb-divider { width: 1px; height: 20px; background: var(--border); }

.sort-select {
    height: 32px;
    padding: 0 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: #2a2a2a;
    cursor: pointer;
    font-family: inherit;
    outline: none;
}

/* ── Sub-cat expand/collapse ── */
.sub-cat-btn.sub-cat-hidden { display: none; }
.filter-bar-left.expanded .sub-cat-btn.sub-cat-hidden {
    display: flex;
    align-items: center;
}

.sub-cat-more {
    height: 32px;
    padding: 0 12px;
    border-radius: 16px;
    border: 1px dashed var(--border);
    background: white;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.sub-cat-more:hover { border-color: var(--orange); color: var(--orange); background: #fff5f0; }

/* ── Page Body ── */
.page-body {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 24px 60px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ── Filter Sidebar ── */
.filter-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(26,43,74,0.08);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 116px;
}

.sb-header { display: flex; align-items: center; justify-content: space-between; }
.sb-title { font-size: 15px; font-weight: 700; color: var(--dark); }
.sb-reset { font-size: 14px; color: var(--orange); background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
.sb-divider { height: 1px; background: var(--border); }

.filter-group { display: flex; flex-direction: column; gap: 10px; }
.filter-group-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.filter-options { display: flex; flex-direction: column; gap: 8px; }

.filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.filter-option input[type="checkbox"],
.filter-option input[type="radio"] {
    width: 18px; height: 18px;
    accent-color: var(--orange);
    cursor: pointer; flex-shrink: 0;
}
.filter-option span { font-size: 14px; color: #2a2a2a; white-space: nowrap; }

/* ── Course Section ── */
.course-section { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

.section-top {
    background: white;
    border-radius: 10px;
    padding: 0 16px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-count { font-size: 15px; font-weight: 700; color: var(--dark); }

.view-btns { display: flex; gap: 8px; }

.view-btn {
    width: 36px; height: 36px;
    border-radius: 4px; border: none;
    background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 7px;
    transition: background 0.2s;
}


.icon-grid-sq { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 100%; }
.icon-grid-sq span { display: block; background: var(--muted); aspect-ratio: 1; border-radius: 1px; }

.icon-list-lines { display: flex; flex-direction: column; gap: 4px; width: 100%; }
.icon-list-lines span { display: block; height: 2px; background: var(--muted); border-radius: 1px; }

.view-btn:hover {background: var(--bg);}
.view-btn.active .icon-grid-sq span { background: #FF6B35; }
.view-btn.active .icon-list-lines span { background: #FF6B35; }

/* ── Course Grid ── */
.course-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ── Course Card ── */
.course-card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(26,43,74,0.08);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.25s, box-shadow 0.25s;
}
.course-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px rgba(26,43,74,0.14); }

.card-thumb {
    height: 160px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}
.card-thumb img { width: 100%; height: 100%; object-fit: inherit; display: block; }

.card-badge {
    position: absolute;
    top: 8px; left: 8px;
    height: 19px; padding: 0 8px;
    border-radius: 4px;
    font-size: 10px; font-weight: 700;
    color: white;
    display: flex; align-items: center;
}
.badge-vod     { background: var(--orange); }
.badge-live    { background: var(--dark); }
.badge-offline { background: var(--green); }

.card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 14px; font-weight: 700; color: var(--dark);
    line-height: 1.4; margin-bottom: 6px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.card-instructor { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

.card-rating { display: flex; align-items: center; gap: 4px; margin-bottom: 7px; }
.card-rating-score { font-size: 13px; font-weight: 700; color: var(--orange); }
.card-rating-count { font-size: 11px; color: var(--muted); }

.card-meta { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.card-meta-icon { width: 14px; height: 14px; flex-shrink: 0; filter: opacity(0.55); }
.card-meta-text { font-size: 11px; color: var(--muted); }

.card-price-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-price { font-size: 16px; font-weight: 800; color: var(--dark); }
.card-discount { font-size: 12px; font-weight: 700; color: var(--orange); }

.card-buy-btn {
    width: 100%; height: 38px;
    background: var(--orange); color: white;
    border: none; border-radius: 10px;
    font-size: 13px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    margin-top: auto;
    transition: background 0.2s;
}
.card-buy-btn:hover { background: #e85f2a; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 0 4px;
}

.pg-btn {
    width: 36px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: white;
    font-size: 13px; font-weight: 500;
    color: var(--muted);
    cursor: pointer; font-family: inherit;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.pg-btn:hover { background: var(--bg); color: #2a2a2a; }
.pg-btn.active { background: var(--dark); color: white; border-color: var(--dark); }
.pg-btn.disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* ── Footer ── */
.footer { background: var(--dark); color: white; padding: 48px 24px; }
.footer-inner { max-width: 1440px; margin: 0 auto; }

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 32px;
}
.footer-section h4 { font-size: 15px; font-weight: 500; margin-bottom: 14px; }
.footer-section p, .footer-section a {
    font-size: 14px; color: #cad5e2; text-decoration: none; line-height: 1.9; display: block;
}
.footer-section a:hover { color: var(--orange); }

.footer-bottom {
    border-top: 1px solid #314158;
    padding-top: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.footer-copy { font-size: 14px; color: #cad5e2; }
.footer-langs { display: flex; gap: 8px; }
.lang-btn {
    height: 32px; padding: 0 14px;
    border-radius: 4px; border: none;
    font-size: 14px; font-weight: 500;
    cursor: pointer; font-family: inherit;
}
.lang-btn.active  { background: var(--orange); color: var(--dark); }
.lang-btn.inactive { background: transparent; color: #cad5e2; }

/* ── List View ── */
.course-grid.list-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.course-grid.list-view .course-card {
    flex-direction: row;
    height: 152px;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(26,43,74,0.08);
}
.course-grid.list-view .course-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26,43,74,0.13);
}

.course-grid.list-view .card-thumb {
    width: 200px;
    height: 80%;
    flex-shrink: 0;
    border-radius: 10px;
    margin: 16px 0 16px 16px;
    overflow: hidden;
}
.course-grid.list-view .card-thumb img {
    border-radius: 10px;
}

.course-grid.list-view .card-body {
    flex: 1;
    padding: 16px 16px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.course-grid.list-view .card-title {
    font-size: 15px;
    margin-bottom: 4px;
    -webkit-line-clamp: 1;
    padding-right: 36px;
}

.course-grid.list-view .card-instructor {
    font-size: 13px;
    margin-bottom: 8px;
}

.course-grid.list-view .card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
}
.course-grid.list-view .card-rating::after {
    content: attr(data-meta);
    font-size: 12px;
    color: var(--muted);
}
.course-grid.list-view .card-rating-sep {
    color: var(--muted);
    font-size: 15px;
    line-height: 1;
    margin: 0 1px;
}

.course-grid.list-view .card-meta {
    display: none;
}

.course-grid.list-view .card-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.course-grid.list-view .card-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}
.course-grid.list-view .card-price {
    font-size: 17px;
    font-weight: 800;
}
.course-grid.list-view .card-original-price {
    font-size: 13px;
    color: var(--muted);
    text-decoration: line-through;
}
.course-grid.list-view .card-discount {
    font-size: 13px;
}

.course-grid.list-view .card-btn-group {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.course-grid.list-view .card-cart-btn {
    height: 36px;
    padding: 0 14px 0 36px;
    background: white;
    border: 1px solid var(--orange);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--orange);
    cursor: pointer;
    font-family: inherit;
    position: relative;
    white-space: nowrap;
    transition: background 0.2s;
}
.course-grid.list-view .card-cart-btn:hover { background: #fff5f0; }
.course-grid.list-view .card-cart-btn::before {
    content: '🛒';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
}
.course-grid.list-view .card-buy-btn {
    width: auto;
    height: 36px;
    padding: 0 18px;
    margin-top: 0;
    border-radius: 10px;
    font-size: 13px;
}

/* heart button in list view */
.course-grid.list-view .card-wish {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #c8cfd8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.course-grid.list-view .card-wish:hover { color: var(--orange); }

/* hide original buy btn in list view */
.course-grid.list-view > .course-card > .card-body > .card-buy-btn {
    display: none;
}
/* hide list-only elements in grid view */
.course-grid:not(.list-view) .card-bottom-row { display: none; }
.course-grid:not(.list-view) .card-rating-sep { display: none; }
.course-grid:not(.list-view) .card-rating-meta { display: none; }
.course-grid:not(.list-view) .card-wish { display: none; }
/* card-body relative for absolute wish button */
.card-body { position: relative; }

/* ── Search Empty State ── */
.search-empty {
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(26,43,74,0.08);
    min-height: 312px;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
}
.search-empty-icon {
    font-size: 60px;
    line-height: 1;
    margin-bottom: 4px;
    filter: grayscale(0.3);
}
.search-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #2a2a2a;
}
.search-empty-desc {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 4px;
}
.search-empty-reset {
    height: 44px;
    padding: 0 28px;
    background: var(--orange);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
    transition: background 0.2s;
}
.search-empty-reset:hover { background: #e85f2a; }

/* ── Responsive ── */
@media (max-width: 1200px) {
    .course-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .filter-sidebar { display: none; }
    .header-nav { display: none; }
    .course-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .filter-bar-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 10px 16px;
        gap: 8px;
    }
    .filter-bar-left {
        order: 1;
        width: 100%;
        flex: none;
    }
    .filter-search-wrap {
        order: 2;
        width: 100%;
    }
    .filter-search-wrap input {
        width: auto;
        flex: 1;
        min-width: 0;
        border-radius: 10px 0 0 10px;
    }
    .filter-bar-right {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
    .course-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .footer-bottom { flex-direction: column; gap: 16px; align-items: flex-start; }

    .course-grid.list-view .course-card {height: auto; flex-direction: column; align-items: center;}
    .course-grid.list-view .card-body {flex: auto; width: 100%;}
}
@media (max-width: 480px) {
    .page-body { padding: 12px 12px 48px; }
    .header-search { max-width: 160px; }
    .content-type-btns { flex-wrap: wrap; }
    .fb-divider { display: none; }
    .sort-select { flex: 1; }
}