/* =======================================
   Great Books - Complete Stylesheet
   File: assets/css/great-books.css
   Version: 3.5
   ======================================= */

/* 컨테이너 공통 */
.we-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 16px;
}

.we-container--narrow {
    max-width: 840px;
}

.we-container--wide {
    max-width: 1120px;
}

/* ---------------------------------------
   Hero
   --------------------------------------- */

.gb-hero {
    background-color: #f5f5f8;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    padding: 40px 0 36px;
}

.gb-hero-inner {
    max-width: 720px;
}

.gb-hero__back,
.we-back-link {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #6366f1;
    opacity: 0.85;
}

.gb-hero__back:hover,
.we-back-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.gb-hero__title,
.we-section-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0 0 10px;
    color: #1e293b;
}

.gb-hero__subtitle,
.we-section-subtitle {
    font-size: 1.0625rem;
    line-height: 1.6;
    margin: 0 0 10px;
    color: #475569;
}

.gb-hero__description,
.gb-hero-text {
    font-size: 0.9375rem;
    line-height: 1.7;
    margin: 0;
    color: #64748b;
    max-width: 720px;
}

/* ---------------------------------------
   Filter Bar
   --------------------------------------- */

.gb-filter-bar-wrap {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    background-color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 50;
}

.gb-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    padding: 14px 0;
    font-size: 0.9rem;
}

.gb-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gb-filter-label {
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    color: #64748b;
}

.gb-filter-select,
.gb-filter-group select {
    padding: 8px 12px;
    font-size: 0.875rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background-color: #fff;
    color: #475569;
    cursor: pointer;
}

/* Level 필터 pills */
.gb-filter-pills {
    display: flex;
    gap: 6px;
}

.gb-filter-pill {
    border: 2px solid #e2e8f0;
    border-radius: 999px;
    padding: 6px 14px;
    background-color: #ffffff;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    transition: all 0.2s ease;
}

.gb-filter-pill:hover {
    border-color: #cbd5e1;
    color: #1e293b;
}

.gb-filter-pill.is-active {
    border-color: #6366f1;
    background-color: #6366f1;
    color: #ffffff;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .gb-filter-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .gb-filter-group.gb-filter-levels {
        width: 100%;
    }

    .gb-filter-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }
}

/* ---------------------------------------
   Book List Section
   --------------------------------------- */

.gb-book-list {
    padding: 40px 0 60px;
    background: #ffffff;
}

.gb-book-list__header {
    text-align: center;
    margin-bottom: 36px;
}

.gb-book-list__header .we-section-title {
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.gb-book-list__header .we-section-subtitle {
    font-size: 1rem;
    color: #64748b;
    margin: 0;
}

/* ---------------------------------------
   Book Grid & Cards
   --------------------------------------- */

.gb-book-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    max-width: 1120px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .gb-book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .gb-book-grid {
        grid-template-columns: 1fr;
    }
}

/* 카드 기본 */
.gb-book-card {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 14px;
    background-color: #ffffff;
    overflow: hidden;
    transition: all 0.25s ease;
}

.gb-book-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.08);
    transform: translateY(-4px);
}

.gb-book-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* 커버 영역 */
.gb-book-card__cover {
    aspect-ratio: 3 / 2;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gb-book-card__cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gb-book-card:hover .gb-book-card__cover-img {
    transform: scale(1.05);
}

.gb-book-card__cover-placeholder {
    font-size: 4rem;
    opacity: 0.25;
}

/* 텍스트 영역 */
.gb-book-card__body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gb-book-card__title {
    font-size: 1.0625rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 4px;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gb-book-card:hover .gb-book-card__title {
    color: #6366f1;
}

.gb-book-card__author-line {
    font-size: 0.8125rem;
    line-height: 1.5;
    margin: 0;
    color: #64748b;
}

.gb-book-card__dot {
    margin: 0 4px;
    color: #cbd5e1;
}

.gb-book-card__meta-line {
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0 0 6px;
    color: #94a3b8;
}

.gb-book-card__summary {
    font-size: 0.875rem;
    line-height: 1.6;
    margin: 4px 0 10px;
    color: #64748b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Footer meta */
.gb-book-card__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    font-size: 0.8rem;
    margin-top: 4px;
}

.gb-level-range-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #dbeafe 0%, #ede9fe 100%);
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

.gb-book-card__chapters {
    color: #94a3b8;
}

/* CTA */
.gb-book-card__cta {
    padding: 0 20px 18px;
}

.gb-book-card__start {
    display: inline-block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6366f1;
    transition: color 0.2s ease;
}

.gb-book-card:hover .gb-book-card__start {
    color: #4f46e5;
}

/* Pagination & Empty State */
.gb-pagination {
    margin-top: 40px;
}

.gb-no-results {
    padding: 60px 0;
    text-align: center;
    font-size: 0.95rem;
    color: #64748b;
}

/* ---------------------------------------
   Single Book Page (existing styles)
   --------------------------------------- */

.we-single--great-book {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 16px 60px;
}

.we-single-book-meta {
    color: #666;
    margin: 8px 0;
}

.we-single-book-source a {
    color: #D97757;
}

.we-single-book-description {
    margin-top: 12px;
    max-width: 640px;
}

/* Chapter list */
.we-single-book-chapters {
    margin-top: 40px;
}

.we-chapter-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 12px;
    background: #FAF6F0;
}

.we-chapter-list__item+.we-chapter-list__item {
    border-top: 1px solid #E4DED4;
}

.we-chapter-list__link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
}

.we-chapter-list__link:hover {
    background: #F2EBE1;
}

.we-chapter-list__main {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.we-chapter-list__number {
    font-weight: 600;
    color: #D97757;
}

.we-chapter-list__title {
    font-weight: 500;
}

.we-chapter-list__levels {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Level chips */
.we-level-chip {
    display: inline-block;
    padding: 2px 7px;
    font-size: 11px;
    border-radius: 9999px;
    border: 1px solid #D2C7BB;
    min-width: 32px;
    text-align: center;
}

.we-level-chip.is-available {
    background: #D97757;
    color: #fff;
    border-color: #D97757;
}

.we-level-chip.is-disabled {
    opacity: 0.3;
}

/* Single Chapter */
.we-single--chapter {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 16px 60px;
}

.we-breadcrumb {
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 8px;
}

.we-breadcrumb__link {
    color: #D97757;
    text-decoration: none;
}

.we-breadcrumb__separator {
    margin: 0 4px;
}

.we-single-title .we-chapter-number {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #CC785C;
    margin-right: 6px;
}

/* Level tabs & panels */
.we-level-switcher--chapter {
    margin-top: 24px;
}

.we-level-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 4px;
    border-radius: 999px;
    background: #F2EBE1;
    margin-bottom: 16px;
}

.we-level-panels {
    background: #FDF9F3;
    border-radius: 14px;
    padding: 18px 20px;
}

.we-level-panel {
    display: none;
}

.we-level-panel.is-visible {
    display: block;
}

.we-level-panel__inner p {
    line-height: 1.6;
}

/* Navigation buttons */
.we-single-nav {
    margin-top: 32px;
    display: flex;
    gap: 12px;
}

.we-button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.9rem;
}

.we-button--ghost {
    background: transparent;
    border: 1px solid #D2C7BB;
    color: #7C6E60;
}

.we-button--ghost:hover {
    background: #F5F1EB;
}

/* Chapter page nav */
.we-single--chapter .we-single-nav--chapter {
    max-width: 860px;
    margin: 24px auto 0;
    padding: 0 16px;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 12px;
}

.we-single--chapter .we-single-nav--chapter .we-button {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
}

.we-single--chapter .we-level-panel__inner {
    max-width: 720px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    .gb-hero {
        padding: 32px 0 28px;
    }

    .gb-hero__title,
    .we-section-title {
        font-size: 1.75rem;
    }

    .gb-book-list {
        padding: 28px 0 48px;
    }
}
/* ========== Single Great Book Page ========== */

.gb-single-book {
    background: #ffffff;
}

/* Hero Section */
.gb-single-hero {
    padding: 40px 0 48px;
    background: linear-gradient(180deg, #f7f7f9 0%, #fafafa 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.gb-single-hero__layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 768px) {
    .gb-single-hero__layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Cover */
.gb-single-cover {
    position: sticky;
    top: 100px;
}

.gb-single-cover__img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.gb-single-cover__placeholder {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    opacity: 0.4;
}

/* Text Content */
.gb-single-hero__title {
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 12px;
    line-height: 1.3;
}

.gb-single-hero__meta {
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0 0 8px;
}

.gb-meta__dot {
    margin: 0 6px;
    color: #cbd5e1;
}

.gb-single-hero__original {
    font-size: 0.875rem;
    color: #94a3b8;
    font-style: italic;
    margin: 0 0 16px;
}

.gb-single-hero__badges {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.gb-single-hero__description {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #475569;
    margin-bottom: 24px;
}

.gb-single-hero__description p {
    margin: 0 0 1em;
}

/* CTA Button */
.gb-single-cta {
    margin-top: 8px;
}

.gb-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.gb-button--primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.gb-button--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.gb-coming-soon {
    color: #94a3b8;
    font-style: italic;
}

/* Chapter Section */
.gb-chapter-section {
    padding: 48px 0 80px;
}

.gb-chapter-section__title {
    font-size: 1.375rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 24px;
}

/* Chapter List */
.gb-chapter-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.gb-chapter-item {
    border-bottom: 1px solid #e2e8f0;
}

.gb-chapter-item:last-child {
    border-bottom: none;
}

.gb-chapter-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s ease;
}

.gb-chapter-link:hover {
    background: #f8fafc;
}

.gb-chapter-link__number {
    font-weight: 700;
    color: #6366f1;
    min-width: 32px;
}

.gb-chapter-link__title {
    flex: 1;
    font-weight: 500;
    color: #1e293b;
}

.gb-chapter-link__levels {
    display: flex;
    gap: 4px;
}

/* Level Chips */
.gb-level-chip {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 4px;
    background: #f1f5f9;
    color: #64748b;
}

.gb-level-chip--a1 {
    background: #dcfce7;
    color: #15803d;
}

.gb-level-chip--a2 {
    background: #fef3c7;
    color: #b45309;
}

.gb-level-chip--b1 {
    background: #dbeafe;
    color: #1d4ed8;
}

.gb-level-chip--b2 {
    background: #ede9fe;
    color: #6d28d9;
}

.gb-no-chapters {
    text-align: center;
    padding: 40px 0;
    color: #64748b;
    font-style: italic;
}

/* ========== Single Chapter Reader ========== */

.gb-single-chapter {
    background: #ffffff;
}

/* Chapter Hero */
.gb-chapter-hero {
    padding: 32px 0 24px;
    background: linear-gradient(180deg, #f7f7f9 0%, #fafafa 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.gb-chapter-hero__inner {
    max-width: 720px;
}

.gb-chapter-hero__book {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0 0 8px;
}

.gb-chapter-hero__book-title {
    font-weight: 600;
    color: #475569;
}

.gb-chapter-hero__title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 12px;
    line-height: 1.35;
}

.gb-chapter-hero__number {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.gb-chapter-hero__levels {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

/* Chapter Layout Grid */
.gb-chapter-layout {
    padding: 40px 0 80px;
}

.gb-chapter-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr);
    gap: 48px;
    max-width: 1120px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .gb-chapter-grid {
        grid-template-columns: 1fr;
    }
}

/* Level Tabs */
.gb-level-tabs__nav {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: 24px;
    width: fit-content;
}

.gb-level-tab {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gb-level-tab:hover {
    color: #1e293b;
}

.gb-level-tab.is-active {
    background: #ffffff;
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Level-specific active colors */
.gb-level-tab--a1.is-active { background: #dcfce7; color: #15803d; }
.gb-level-tab--a2.is-active { background: #fef3c7; color: #b45309; }
.gb-level-tab--b1.is-active { background: #dbeafe; color: #1d4ed8; }
.gb-level-tab--b2.is-active { background: #ede9fe; color: #6d28d9; }
.gb-level-tab--original.is-active { background: #f1f5f9; color: #475569; }

/* Level Panels */
.gb-level-panel {
    display: none;
}

.gb-level-panel.is-active {
    display: block;
}

/* Chapter Content */
.gb-chapter-content {
    font-size: 1.0625rem;
    line-height: 1.85;
    color: #374151;
    max-width: 720px;
}

.gb-chapter-content p {
    margin: 0 0 1.5em;
}

.gb-chapter-content h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 2em 0 0.75em;
    color: #1e293b;
}

.gb-chapter-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.5em 0 0.5em;
    color: #374151;
}

/* Chapter Navigation */
.gb-chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.gb-chapter-nav a {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #6366f1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.gb-chapter-nav a:hover {
    color: #4f46e5;
}

.gb-chapter-nav__index {
    color: #64748b !important;
}

.gb-chapter-nav__index:hover {
    color: #1e293b !important;
}

/* Sidebar */
.gb-chapter-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
}

.gb-sidebar-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
}

.gb-sidebar-card__title {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin: 0 0 12px;
}

.gb-sidebar-card__book a {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    text-decoration: none;
}

.gb-sidebar-card__book a:hover {
    color: #6366f1;
}

.gb-sidebar-card__author {
    font-size: 0.875rem;
    color: #64748b;
    margin: 4px 0 12px;
}

.gb-sidebar-card__level {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .gb-chapter-hero__title {
        font-size: 1.5rem;
    }
    
    .gb-level-tabs__nav {
        width: 100%;
        overflow-x: auto;
    }
    
    .gb-chapter-sidebar {
        position: static;
        margin-top: 32px;
    }
}
