/**
 * Stylesheet: Phân Hệ Từ Vựng 20 Chủ Đề (Vocabulary Module)
 * Thiết kế chuẩn Mockup: Sidebar phân nhóm Loại từ gọn gàng, Header Hero Card với Ảnh lớn không viền, Tab Lọc, và Bảng từ vựng Accordion 2 cấp
 */

/* ==========================================================================
   1. PAGE WRAPPER & CORE LAYOUT
   ========================================================================== */
.vocabulary-page-wrapper {
    background-color: #f8fafc;
    min-height: calc(100vh - 180px);
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px 80px 20px;
    box-sizing: border-box;
    font-family: var(--font-heading), 'Pretendard', sans-serif;
    width: 100%;
    min-width: 0;
}

.vocabulary-layout-container {
    width: 100%;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 215px minmax(0, 1fr);
    gap: 20px;
    align-items: flex-start;
    box-sizing: border-box;
    min-width: 0;
}

/* ==========================================================================
   2. LEFT SIDEBAR: LOẠI TỪ & 20 CHỦ ĐỀ (BỌC TRONG KHUNG LIỀN MẠCH CHUẨN MOCKUP)
   ========================================================================== */
.vocabulary-sidebar-col {
    position: sticky;
    top: 85px;
    z-index: 20;
    align-self: flex-start;
    min-width: 0;
}

.vocabulary-sidebar-card {
    width: 215px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 10px 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

/* Khối từng loại từ (명사, 동사, 형용사...) */
.vocab-pos-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.vocab-pos-card.is-active-pos {
    border: 1.5px solid #3b82f6;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.vocab-pos-header-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
    text-align: left;
    box-sizing: border-box;
}

.vocab-pos-header-btn:hover {
    background: #f8fafc;
}

.vocab-pos-link-btn {
    text-decoration: none;
    display: flex;
}

.pos-header-left {
    display: flex;
    align-items: center;
    gap: 7px;
}

.vocab-pos-flashcard-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.pos-title-kr {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.2px;
}

.vocab-pos-card.is-active-pos .pos-title-kr {
    color: #1d4ed8;
}

.pos-title-vn {
    font-family: var(--font-vietnamese), 'Be Vietnam Pro', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: #64748b;
}

.vocab-pos-card.is-active-pos .pos-title-vn {
    color: #2563eb;
}

.pos-header-right {
    display: flex;
    align-items: center;
    color: #94a3b8;
}

.pos-chevron-icon {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.vocab-pos-card.is-expanded .pos-chevron-icon {
    transform: rotate(180deg);
    color: #2563eb;
}

/* Danh sách 20 nhóm chủ đề bên trong Danh từ / Động từ / Tính từ (Hiệu ứng mở/cuộn êm mượt) */
.vocab-pos-body-collapse {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: none;
}

.vocab-pos-card.is-expanded .vocab-pos-body-collapse {
    grid-template-rows: 1fr;
}

.vocab-pos-body-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 4px 0 6px;
    transition: padding 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.vocab-pos-card.is-expanded .vocab-pos-body-inner {
    padding: 6px 4px 6px 6px;
    max-height: 185px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.vocab-pos-body-inner::-webkit-scrollbar {
    width: 4px;
}

.vocab-pos-body-inner::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.vocab-main-cats-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vocab-cat-nav-item {
    width: 100%;
}

.vocab-cat-nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.vocab-cat-nav-link:hover {
    background: #f1f5f9;
}

.cat-num {
    font-size: 13.5px;
    color: #94a3b8;
    width: 22px;
    flex-shrink: 0;
    font-weight: 600;
}

.cat-name-kr {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
    letter-spacing: -0.2px;
}

.vocab-cat-nav-item.is-active .cat-num {
    color: #2563eb;
    font-weight: 800;
}

.vocab-cat-nav-item.is-active .cat-name-kr {
    color: #2563eb;
    font-weight: 800;
}

.vocab-cat-nav-item.is-active .vocab-cat-nav-link {
    background: transparent;
}

.vocab-pos-empty-hint {
    padding: 8px 10px;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}

/* ==========================================================================
   3. RIGHT MAIN CONTENT: BANNER & TOPIC HEADER
   ========================================================================== */
.vocabulary-main-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
    width: 100%;
}

/* Topic Banner Card */
.vocabulary-topic-banner-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 24px;
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.03);
}

.vocab-banner-inner {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Ảnh minh họa không bọc khung thừa, không bóng mờ, kích thước to rõ chuẩn mockup */
.vocab-banner-media {
    width: 185px;
    height: 140px;
    border-radius: 0;
    overflow: visible;
    flex-shrink: 0;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vocab-banner-thumb-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: none;
}

.vocab-banner-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.vocab-banner-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0;
    flex-wrap: wrap;
}

.banner-title-kr {
    font-size: 26px;
    font-weight: 900;
    color: #000000;
    letter-spacing: -0.5px;
}

.banner-title-vn {
    font-family: var(--font-vietnamese), 'Be Vietnam Pro', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #2563eb;
    letter-spacing: -0.2px;
}

.vocab-banner-desc {
    font-size: 14px;
    font-weight: 600;
    color: #000000;
    line-height: 1.5;
    margin: 2px 0 6px 0;
}

.vocab-banner-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.vocab-banner-stats-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vocab-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12.5px;
    color: #475569;
    font-weight: 600;
}

.vocab-stat-pill strong {
    color: #2563eb;
    font-weight: 800;
}

.vocab-stat-pill svg {
    color: #64748b;
}

/* Search Box trong Banner */
.vocab-banner-search-wrapper {
    width: 220px;
    flex-shrink: 0;
}

.vocab-search-input-box {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.vocab-search-field {
    width: 100%;
    height: 38px;
    padding: 0 34px 0 12px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12.5px;
    color: #0f172a;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.vocab-search-field:focus {
    outline: none;
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-clear-search {
    position: absolute;
    right: 28px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-clear-search:hover {
    color: #1e293b;
}

.vocab-search-icon-btn {
    position: absolute;
    right: 10px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* ==========================================================================
   4. FILTER TABS: 전체 단어 / 저장한 단어
   ========================================================================== */
.vocabulary-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
}

.vocab-filter-pill-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vocab-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.vocab-filter-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.vocab-filter-btn.is-active {
    background: #ffffff;
    border-color: #2563eb;
    color: #2563eb;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.vocab-tab-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.vocab-tab-fallback-svg {
    width: 20px;
    height: 20px;
}

.vocab-search-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #dbeafe;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 12.5px;
    color: #1e40af;
    font-weight: 700;
}

.btn-reset-search-tag {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    color: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   5. ACCORDION GROUPS & VOCABULARY TABLES (STANDALONE BARS & SMOOTH GRID COLLAPSE)
   ========================================================================== */
.vocabulary-accordion-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Subcategory Section (Level 2: 01. 숫자와 서수...) */
.vocab-subcat-section {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Subcategory Header Bar (Thanh độc lập chuẩn Mockup, không bọc khung lồng) */
.vocab-subcat-header-bar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    text-align: left;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.vocab-subcat-header-bar:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.vocab-subcat-section.is-expanded .vocab-subcat-header-bar {
    border-color: #e2e8f0;
    background: #ffffff;
}

.subcat-header-left {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.subcat-seq-num {
    font-size: 16px;
    font-weight: 800;
    color: #1d4ed8;
}

.subcat-heading-title {
    margin: 0;
    font-size: 15.5px;
    font-weight: 800;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.subcat-title-kr {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.subcat-title-vn {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    font-family: var(--font-vietnamese), 'Be Vietnam Pro', sans-serif;
}

.subcat-header-right {
    display: flex;
    align-items: center;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: 10px;
}

.subcat-chevron-arrow {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.vocab-subcat-section.is-expanded .subcat-chevron-arrow {
    transform: rotate(180deg);
    color: #2563eb;
}

/* Subcategory Collapse Animation (CSS Grid Smooth Height) */
.vocab-subcat-collapse {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.vocab-subcat-section.is-expanded .vocab-subcat-collapse {
    grid-template-rows: 1fr;
}

.vocab-subcat-collapse-inner {
    min-height: 0;
    overflow: hidden;
    padding-top: 6px;
}

/* Danh sách nhóm con (Subtopics): Hẹp hơn và thụt lề 20px biểu thị rõ quan hệ cha-con */
.vocab-subtopics-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 20px;
    box-sizing: border-box;
    width: 100%;
}

/* Subtopic Item Card (Level 3 Accordion) */
.vocab-subtopic-card {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Subtopic Header Bar ((1) 기본 숫자 - Chữ số cơ bản (11개)) */
.vocab-subtopic-header-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #eef6ff;
    border: 1.5px solid #dbeafe;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    text-align: left;
    box-sizing: border-box;
}

.vocab-subtopic-header-btn:hover {
    background: #e0f2fe;
    border-color: #bae6fd;
}

.vocab-subtopic-card.is-open .vocab-subtopic-header-btn {
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid #dbeafe;
    background: #eef6ff;
}

.subtopic-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.subtopic-circle-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #3b82f6;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.subtopic-title {
    margin: 0;
    font-size: 15px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.subtopic-kr {
    font-weight: 800;
    color: #0f172a;
}

.subtopic-vn-meta {
    font-weight: 500;
    color: #64748b;
    font-size: 13.5px;
    font-family: var(--font-vietnamese), 'Be Vietnam Pro', sans-serif;
}

.subtopic-header-right {
    display: flex;
    align-items: center;
    color: #94a3b8;
    flex-shrink: 0;
    margin-left: 8px;
}

.subtopic-chevron-arrow {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.vocab-subtopic-card.is-open .subtopic-chevron-arrow {
    transform: rotate(180deg);
    color: #2563eb;
}

/* Subtopic Collapse Animation (CSS Grid Smooth Height) */
.vocab-subtopic-collapse {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.vocab-subtopic-card.is-open .vocab-subtopic-collapse {
    grid-template-rows: 1fr;
}

.vocab-subtopic-table-wrap {
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

/* Bảng Từ Vựng Trực Tiếp (Dành cho danh mục không chia nhỏ mục con) */
.vocab-direct-table-wrap {
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
    margin-top: 6px;
}

/* Bảng Từ Vựng */
.vocab-table-container {
    width: 100%;
    overflow-x: auto;
}

.vocabulary-items-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.vocabulary-items-table th {
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    border-bottom: 1.5px solid #f1f5f9;
    background: #ffffff;
}

.th-word-vn {
    width: 45%;
}

.th-meaning-kr {
    width: 40%;
}

.th-audio {
    width: 48px;
    text-align: center;
}

.th-bookmark {
    width: 48px;
    text-align: center;
}

.vocab-table-row td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    transition: background 0.15s ease;
}

.vocab-table-row:last-child td {
    border-bottom: none;
}

.vocab-table-row:hover td {
    background: #fbfcfe;
}

.col-word-vn .vocab-word-text {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    font-family: var(--font-vietnamese), 'Be Vietnam Pro', sans-serif;
    letter-spacing: -0.1px;
}

.vocab-pronun-tag {
    font-size: 13px;
    color: #94a3b8;
    margin-left: 5px;
    font-weight: 500;
}

.col-meaning-kr .vocab-meaning-text {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    font-family: var(--font-body), 'SUIT', sans-serif;
}

/* Nút Loa TTS */
.btn-vocab-audio {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.08);
}

.btn-vocab-audio:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    transform: scale(1.08);
}

.btn-vocab-audio.is-playing {
    background: #2563eb;
    color: #ffffff;
    animation: audioWavePulse 0.9s infinite alternate;
}

@keyframes audioWavePulse {
    from { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    to { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
}

/* Nút Bookmark Yêu thích */
.btn-vocab-bookmark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-vocab-bookmark:hover {
    background: #f8fafc;
    color: #f59e0b;
    transform: scale(1.1);
}

.btn-vocab-bookmark.is-saved {
    color: #f59e0b;
}

/* Empty States */
.vocab-empty-state,
.vocab-search-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
}

.empty-title,
.search-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin: 12px 0 4px 0;
}

.empty-desc,
.search-empty-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

.vocab-no-words-hint {
    padding: 14px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    background: #ffffff;
    border: 1px dashed #e2e8f0;
    border-radius: 10px;
}

/* ==========================================================================
   6. RESPONSIVE MEDIA QUERIES (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 1024px) {
    .vocabulary-layout-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .vocabulary-sidebar-col {
        position: static;
        width: 100%;
    }

    .vocab-pos-body-inner {
        max-height: 260px;
    }
}

@media (max-width: 768px) {
    .vocabulary-page-wrapper {
        padding: 10px 10px 40px 10px;
    }

    .vocabulary-topic-banner-card {
        padding: 14px;
        border-radius: 14px;
    }

    .vocab-banner-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 14px;
    }

    .vocab-banner-media {
        width: 130px;
        height: 100px;
    }

    .vocab-banner-title {
        justify-content: center;
    }

    .banner-title-kr {
        font-size: 20px;
    }

    .banner-title-vn {
        font-size: 15px;
    }

    .vocab-banner-bottom-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .vocab-banner-stats-row {
        width: 100%;
    }

    .vocab-stat-pill {
        flex: 1;
        justify-content: center;
    }

    .vocab-banner-search-wrapper {
        width: 100%;
    }

    .vocabulary-filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .vocab-filter-pill-group {
        width: 100%;
    }

    .vocab-filter-btn {
        flex: 1;
        justify-content: center;
        padding: 8px 10px;
        font-size: 12.5px;
    }

    .vocabulary-items-table th,
    .vocab-table-row td {
        padding: 8px 10px;
    }

    .col-word-vn .vocab-word-text {
        font-size: 14px;
    }

    .col-meaning-kr .vocab-meaning-text {
        font-size: 13px;
    }
}
