/* ============================================================ */
/* FILE 1A: css/components.css - COMPONENTS STYLES (CORE)       */
/* Buttons, Inputs, Cards, Folder Tree, Modals, Toast, Scrollbar */
/* ============================================================ */
/* ⭐ V4: Import Choice Modal (Merge/Overwrite)                  */
/* ⭐ V6: AI Vocab Generator box                                */
/* ⭐ V21 (SPLIT từ V20): Tách thành 2 files                     */
/*   - FILE 1A (file này) — Core components:                    */
/*     • Buttons, Inputs, Cards, Card list                      */
/*     • Delete & Edit buttons, Speaker icon                    */
/*     • Folder Tree (manage panel — vocab folders)             */
/*     • Modals (base + Duplicate + Import Choice)              */
/*     • AI Vocab Generator                                     */
/*     • Toast + Scrollbar                                      */
/*   - FILE 1B (componentsV18.css) — V18/V19/V20 features:      */
/*     • Voice Control Tabs + Speed Chips Bar                   */
/*     • Selector Badge + Bottom Sheet system                   */
/*     • Voice Badges (V19) + iOS Alex Hint (V20)               */
/*     • Sync Badge (V8) + Pulse-remote (V20) + Mobile (V9)     */
/*     • Responsive V18 cho voice control + bottom sheet        */
/* ⭐ V22 (Move Card Button): Thêm .move-card cho nút 📦 Chuyển */
/* ⭐ V23 (VCARD REDESIGN): Section .vcard* cho danh sách thẻ   */
/*     trong bộ (renderManageUI).                               */
/*   - Compact card + progressive disclosure (expand metadata)  */
/*   - Border-left màu theo mastery level (xanh/vàng/đỏ/xám)    */
/*   - Actions icon-only (28-34px) thay vì full button          */
/*   - KHÔNG đụng .card-item cũ (dùng cho fb/sb/dict list)      */
/*   - Class namespace riêng → zero side-effect cho list khác   */
/* ⭐ V24 (SEARCHABLE DROPDOWN): Section .move-card-modal-*     */
/*   - Thay native <select> trong modal Chuyển từ vựng bằng:    */
/*     • Ô search input (bo tròn 60px)                          */
/*     • List custom scrollable (max-height 240px)              */
/*     • Item có hover/active/disabled state                    */
/*   - Mục đích: user có nhiều bộ (>20) vẫn search tìm nhanh    */
/*   - Dùng trong openMoveCardModal() ở renderUI.js V7          */
/* ============================================================ */

/* ============================================================ */
/* ⭐ Global overflow-x safety                                   */
/* ============================================================ */

html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* ===== BUTTONS ===== */
.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem 1.8rem;
    border-radius: 60px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-success { background: var(--success); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-card);
    color: white;
    border-color: var(--accent);
}

.btn-danger { background: var(--danger); }
.btn-warning { background: var(--warning); }

.ctrl-btn {
    background: var(--bg-card);
    color: white;
    border: none;
    padding: 0.6rem 1.6rem;
    border-radius: 60px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    font-size: 0.9rem;
}

.ctrl-btn:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.btn-mode {
    background: var(--bg-card);
    font-size: 0.85rem;
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-mode:hover {
    background: var(--bg-primary);
    transform: translateY(-1px);
    border-color: var(--accent);
}

.btn-mode.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-mode.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== INPUTS ===== */
.batch-textarea,
.listen-input,
.input-group input,
#newSetName,
#newFolderName,
#newQuestionSetName,
#newFbQuestion,
#newFbAnswer,
#newFbDistractor1,
#newFbDistractor2,
#newFbDistractor3,
#newFbExplanation,
#sortModeSelect,
#newSbSetName,
#newSbVI,
#newSbEN {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.85rem 1.2rem;
    border-radius: 60px;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.batch-textarea {
    border-radius: 24px;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

.batch-textarea:focus,
.listen-input:focus,
.input-group input:focus,
#newSetName:focus,
#newFolderName:focus,
#newQuestionSetName:focus,
#newFbQuestion:focus,
#newFbAnswer:focus,
#newFbDistractor1:focus,
#newFbDistractor2:focus,
#newFbDistractor3:focus,
#newFbExplanation:focus,
#sortModeSelect:focus,
#newSbSetName:focus,
#newSbVI:focus,
#newSbEN:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#sortModeSelect option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    width: 100%;
    max-width: 750px;
    min-height: 420px;
    border-radius: 40px;
    box-shadow: 0 25px 45px -12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    margin: 1.5rem auto;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.card-content {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.card-pronounce {
    margin-top: 0.5rem;
    font-size: 1rem;
    color: var(--text-secondary);
    font-family: monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 1rem;
    border-radius: 60px;
    display: inline-block;
}

.card-detail {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    max-width: 90%;
}

.card-detail strong { color: var(--accent); }

/* ===== CARD LIST ===== */
.card-list {
    max-height: 350px;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.card-item {
    background: var(--bg-primary);
    padding: 0.9rem 1rem;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
    border: 1px solid var(--border);
    transition: 0.1s;
}

.card-item:hover { border-color: var(--accent); }

.card-item-info { flex: 1; font-size: 0.85rem; }
.card-item-info strong { color: var(--accent); font-size: 1rem; }
.card-item-info small { color: var(--text-secondary); font-size: 0.7rem; }

/* ============================================================ */
/* ⭐ V23: VCARD — VOCAB CARD REDESIGN                          */
/* ============================================================ */
/* Compact card + progressive disclosure cho renderManageUI().  */
/*                                                              */
/* Layout:                                                       */
/*   ┌─────────────────────────────────────────────────────┐    */
/*   │ ▌ hello  /həˈloʊ/ · thán từ      📦 ✏️ 🗑  ▼       │    */
/*   │   xin chào                                          │    */
/*   │   ▓▓▓▓▓▓▓▓░░ 80% (4/5)                             │    */
/*   └─────────────────────────────────────────────────────┘    */
/*                                                              */
/* - Collapsed: title-row + def + mastery + actions            */
/* - Expanded:  thêm metadata (syn, example, dịch, speak)      */
/* - Border-left màu theo mastery: xanh/vàng/đỏ/xám            */
/* - KHÔNG dùng class .card-item để tránh side-effect          */
/*   cho list của Fill Blank / Sentence / Dictation            */
/* ============================================================ */

/* ----- Root vcard ----- */
.vcard {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    cursor: pointer;
    position: relative;
}

.vcard:hover {
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    border-bottom-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.vcard:active {
    transform: translateY(0);
}

/* Mastery color variants — border-left */
.vcard[data-mastery-level="high"] { border-left-color: var(--success); }
.vcard[data-mastery-level="mid"]  { border-left-color: var(--warning); }
.vcard[data-mastery-level="low"]  { border-left-color: var(--danger); }
.vcard[data-mastery-level="none"] { border-left-color: var(--border); }

/* ----- Header row (main + actions + toggle) ----- */
.vcard-header {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    width: 100%;
}

.vcard-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* ----- Title row: term + IPA + word type ----- */
.vcard-title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    min-width: 0;
}

.vcard-term {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    word-break: break-word;
    line-height: 1.3;
    transition: color 0.15s ease;
}

.vcard-term:hover {
    text-decoration: underline;
    color: var(--accent-hover);
}

.vcard-pronounce {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    flex-shrink: 0;
    opacity: 0.85;
}

.vcard-word-type {
    background: var(--bg-card);
    padding: 0.1rem 0.5rem;
    border-radius: 20px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ----- Definition ----- */
.vcard-def {
    font-size: 0.88rem;
    color: var(--text-primary);
    margin-top: 0.15rem;
    line-height: 1.4;
    word-break: break-word;
}

/* ----- Mastery row: bar + text ----- */
.vcard-mastery {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.vcard-mastery-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    max-width: 200px;
}

.vcard-mastery-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
    background: var(--border);
}

.vcard[data-mastery-level="high"] .vcard-mastery-fill { background: var(--success); }
.vcard[data-mastery-level="mid"]  .vcard-mastery-fill { background: var(--warning); }
.vcard[data-mastery-level="low"]  .vcard-mastery-fill { background: var(--danger); }
.vcard[data-mastery-level="none"] .vcard-mastery-fill { background: var(--border); }

.vcard-mastery-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ----- Actions: 3 nút icon vuông 32x32 ----- */
.vcard-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
    align-items: flex-start;
}

.vcard-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    font-family: inherit;
    line-height: 1;
    flex-shrink: 0;
}

.vcard-btn:hover {
    transform: scale(1.08);
}

.vcard-btn:active {
    transform: scale(0.95);
}

.vcard-btn-move:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.vcard-btn-edit:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.vcard-btn-delete:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ----- Toggle expand (▼/▲) ----- */
.vcard-toggle {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, color 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    font-family: inherit;
    line-height: 1;
    margin-top: 4px;
}

.vcard-toggle:hover {
    color: var(--text-primary);
}

.vcard.expanded .vcard-toggle {
    transform: rotate(180deg);
}

/* ----- Details (progressive disclosure) ----- */
.vcard-details {
    display: none;
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--border);
}

.vcard.expanded .vcard-details {
    display: block;
    animation: vcardSlideDown 0.25s ease;
}

@keyframes vcardSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vcard-detail-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    line-height: 1.5;
    align-items: flex-start;
}

.vcard-detail-row:last-child {
    margin-bottom: 0;
}

.vcard-detail-label {
    flex-shrink: 0;
    opacity: 0.7;
    min-width: 1.4rem;
    text-align: center;
}

.vcard-detail-value {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    color: var(--text-secondary);
}

.vcard-detail-value em {
    font-style: italic;
    opacity: 0.9;
}

/* ----- Detail actions (nút Nghe) ----- */
.vcard-detail-actions {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.vcard-speak-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent);
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.15s ease;
}

.vcard-speak-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.vcard-speak-btn:active {
    transform: translateY(0);
}

/* ----- Responsive mobile ≤ 768px ----- */
@media (max-width: 768px) {
    .vcard {
        padding: 0.75rem 0.85rem;
        border-radius: 14px;
    }

    .vcard-header {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .vcard-main {
        flex: 1 1 100%;
        order: 1;
    }

    .vcard-toggle {
        order: 2;
        margin-left: auto;
        margin-top: 0;
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .vcard-actions {
        order: 3;
        flex-basis: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
        gap: 0.4rem;
    }

    .vcard-btn {
        width: 34px;
        height: 34px;
        font-size: 0.9rem;
    }

    .vcard-term {
        font-size: 1rem;
    }

    .vcard-def {
        font-size: 0.85rem;
    }

    .vcard-pronounce {
        font-size: 0.76rem;
    }

    .vcard-word-type {
        font-size: 0.64rem;
        padding: 0.08rem 0.45rem;
    }

    .vcard-mastery-bar {
        max-width: none;
    }

    .vcard-mastery-text {
        font-size: 0.68rem;
    }

    .vcard-detail-row {
        font-size: 0.78rem;
    }

    .vcard-speak-btn {
        font-size: 0.74rem;
        padding: 0.32rem 0.8rem;
    }
}

/* ----- Responsive mobile nhỏ ≤ 480px ----- */
@media (max-width: 480px) {
    .vcard {
        padding: 0.7rem 0.75rem;
    }

    .vcard-title-row {
        gap: 0.35rem;
    }

    .vcard-term {
        font-size: 0.95rem;
    }

    .vcard-def {
        font-size: 0.82rem;
    }

    .vcard-mastery {
        gap: 0.4rem;
    }

    .vcard-mastery-text {
        font-size: 0.65rem;
    }

    .vcard-btn {
        width: 32px;
        height: 32px;
        font-size: 0.82rem;
    }
}

/* ===== DELETE & EDIT BUTTONS ===== */
.delete-card,
.edit-card,
.delete-fb-question-btn,
.edit-fb-question-btn,
.delete-sb-question-btn,
.edit-sb-question-btn {
    border: none;
    padding: 0.3rem 1rem;
    border-radius: 40px;
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: 0.2s;
}

.delete-card,
.delete-fb-question-btn,
.delete-sb-question-btn { background: var(--danger); }

.edit-card,
.edit-fb-question-btn,
.edit-sb-question-btn {
    background: var(--warning);
    margin-right: 0.5rem;
}

.delete-card:hover,
.edit-card:hover,
.delete-fb-question-btn:hover,
.edit-fb-question-btn:hover,
.delete-sb-question-btn:hover,
.edit-sb-question-btn:hover {
    opacity: 0.8;
    transform: scale(0.96);
}

/* ============================================================ */
/* ⭐ V22: MOVE CARD BUTTON                                     */
/* ============================================================ */
/* Nút 📦 Chuyển từ vựng sang bộ khác.                          */
/* Vị trí: ngay SAU block hover của .edit-card, TRƯỚC SPEAKER.  */
/* Không kế thừa group cũ (để không đụng rule gốc) → tự viết    */
/* đầy đủ property giống .edit-card nhưng đổi màu accent.       */
/* ============================================================ */

.move-card {
    background: var(--accent);
    border: none;
    padding: 0.3rem 1rem;
    border-radius: 40px;
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: 0.2s;
    margin-right: 0.5rem;
    font-family: inherit;
}

.move-card:hover {
    opacity: 0.85;
    transform: scale(0.96);
    background: var(--accent-hover);
}

.move-card:active {
    transform: scale(0.94);
}

/* ============================================================ */
/* ⭐ V24: MOVE CARD MODAL — SEARCHABLE DROPDOWN                */
/* ============================================================ */
/* Thay native <select> trong modal "Chuyển từ vựng" bằng:      */
/*   • Ô search input (bo tròn 60px, giống .bs-search-wrap)     */
/*   • List custom scrollable (max-height 240px)                */
/*   • Item có 3 state: default / hover / active / disabled     */
/*                                                              */
/* Mục đích: user có nhiều bộ (>20) vẫn search tìm nhanh.       */
/* Dùng trong openMoveCardModal() ở renderUI.js V7.             */
/* ============================================================ */

/* ----- Search input wrapper ----- */
.move-card-modal-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 60px;
    transition: all 0.2s ease;
    margin-bottom: 0.6rem;
}

.move-card-modal-search-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.move-card-modal-search-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    opacity: 0.7;
}

.move-card-modal-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.2rem 0;
    outline: none;
    font-family: inherit;
    min-width: 0;
}

.move-card-modal-search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ----- List container ----- */
.move-card-modal-list {
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    -webkit-overflow-scrolling: touch;
}

.move-card-modal-list::-webkit-scrollbar {
    width: 6px;
}

.move-card-modal-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}

.move-card-modal-list::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: 10px;
}

.move-card-modal-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ----- Item ----- */
.move-card-modal-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    min-width: 0;
}

.move-card-modal-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.move-card-modal-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
}

.move-card-modal-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.move-card-modal-item-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
    line-height: 1;
}

.move-card-modal-item-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.move-card-modal-item-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.3;
}

.move-card-modal-item.active .move-card-modal-item-name {
    color: var(--accent);
}

.move-card-modal-item-count {
    font-size: 0.72rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.move-card-modal-item.disabled .move-card-modal-item-count {
    color: var(--warning);
}

.move-card-modal-item-check {
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}

/* ----- Empty state ----- */
.move-card-modal-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    font-style: italic;
    opacity: 0.8;
}

/* ----- Responsive mobile ≤ 480px ----- */
@media (max-width: 480px) {
    .move-card-modal-list {
        max-height: 180px;
    }

    .move-card-modal-item {
        padding: 0.55rem 0.7rem;
        gap: 0.5rem;
    }

    .move-card-modal-item-name {
        font-size: 0.85rem;
    }

    .move-card-modal-item-count {
        font-size: 0.68rem;
    }

    .move-card-modal-search-wrap {
        padding: 0.55rem 0.85rem;
    }

    .move-card-modal-search-input {
        font-size: 0.85rem;
    }
}

/* ===== SPEAKER ICON ===== */
.speaker-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    cursor: pointer;
    background: var(--bg-primary);
    padding: 4px 10px;
    border-radius: 40px;
    font-size: 0.75rem;
    gap: 4px;
    transition: 0.2s;
}

.speaker-icon:hover {
    background: var(--accent);
    color: white;
}

/* ============================================================ */
/* ===== FOLDER TREE (Manage panel — vocab folders) =====      */
/* ============================================================ */

.folder-tree {
    max-height: none;
    overflow-y: visible;
    overscroll-behavior: contain;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.folder-item {
    background: var(--bg-primary);
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
    overflow: hidden;
}

.folder-item:hover { border-color: var(--accent); }

.folder-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    gap: 8px;
    transition: 0.2s;
    user-select: none;
}

.folder-header:hover { background: rgba(59, 130, 246, 0.05); }

.folder-toggle {
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.25s ease;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.folder-toggle.open { transform: rotate(90deg); }
.folder-icon { font-size: 1.2rem; flex-shrink: 0; }

.folder-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.folder-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 2px 10px;
    border-radius: 20px;
    flex-shrink: 0;
}

.folder-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.folder-item:hover .folder-actions { opacity: 1; }

.folder-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 6px;
    transition: 0.2s;
}

.folder-actions .rename-folder-btn { color: var(--success); }
.folder-actions .rename-folder-btn:hover { background: rgba(34, 197, 94, 0.15); }
.folder-actions .delete-folder-btn { color: var(--danger); }
.folder-actions .delete-folder-btn:hover { background: rgba(239, 68, 68, 0.15); }

.folder-children {
    padding-left: var(--folder-indent);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.folder-children.open {
    max-height: 5000px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.set-item-in-folder {
    display: flex;
    align-items: center;
    padding: 8px 14px 8px 10px;
    margin: 2px 8px 2px 0;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 8px;
}

.set-item-in-folder:hover {
    border-color: var(--accent);
    background: var(--bg-primary);
}

.set-item-in-folder.active {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.08);
}

.set-item-in-folder .set-icon { font-size: 1rem; flex-shrink: 0; }
.set-item-in-folder .set-name { font-size: 0.85rem; color: var(--text-primary); flex: 1; }
.set-item-in-folder .set-count { font-size: 0.7rem; color: var(--text-secondary); margin-right: 8px; }

.set-item-in-folder .set-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.set-item-in-folder:hover .set-actions { opacity: 1; }

.set-item-in-folder .set-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 6px;
    transition: 0.2s;
}

.set-item-in-folder .set-actions .rename-set-btn { color: var(--success); }
.set-item-in-folder .set-actions .rename-set-btn:hover { background: rgba(34, 197, 94, 0.15); }
.set-item-in-folder .set-actions .delete-set-btn { color: var(--danger); }
.set-item-in-folder .set-actions .delete-set-btn:hover { background: rgba(239, 68, 68, 0.15); }

.no-folder-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.no-folder-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 4px 10px 8px 10px;
    font-weight: 500;
    opacity: 0.6;
}

/* ============================================================ */
/* ===== MODALS ===== */
/* ============================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 0 15px;
    box-sizing: border-box;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 28px;
    max-width: 500px;
    width: 100%;
    box-sizing: border-box;
    overscroll-behavior: contain;
}

/* ===== DUPLICATE MODALS ===== */
#dupSingleModal .modal-content h3,
#dupBatchModal .modal-content h3 {
    margin: 0;
    color: var(--warning);
    font-size: 1.3rem;
}

#dupSingleModal .btn-warning,
#dupBatchModal .btn-warning {
    background: var(--warning);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 60px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

#dupSingleModal .btn-warning:hover,
#dupBatchModal .btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

#dupSingleModal .btn-danger,
#dupBatchModal .btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 60px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

#dupSingleModal .btn-danger:hover,
#dupBatchModal .btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

#dupSingleModal .btn-success,
#dupBatchModal .btn-success {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 60px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

#dupSingleModal .btn-success:hover,
#dupBatchModal .btn-success:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

#dupSingleModal .btn-outline,
#dupBatchModal .btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.6rem 1.5rem;
    border-radius: 60px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

#dupSingleModal .btn-outline:hover,
#dupBatchModal .btn-outline:hover {
    background: var(--bg-card);
    color: white;
    border-color: var(--accent);
}

#dupBatchList {
    max-height: 250px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
    text-align: left;
    font-size: 0.85rem;
}

#dupBatchList .dup-term-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr 0.5fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

#dupBatchList .dup-term-item:last-child { border-bottom: none; }
#dupBatchList .dup-term-item .term { font-weight: 600; color: var(--warning); }
#dupBatchList .dup-term-item .set-name { color: var(--accent); font-weight: 500; font-size: 0.8rem; }
#dupBatchList .dup-term-item .old-def { color: var(--danger); font-size: 0.8rem; }
#dupBatchList .dup-term-item .new-def { color: var(--success); font-size: 0.8rem; }
#dupBatchList .dup-term-item .line-info { color: var(--text-secondary); font-size: 0.7rem; text-align: right; }

@media (max-width: 600px) {
    #dupBatchList .dup-term-item {
        grid-template-columns: 1fr;
        gap: 2px;
        padding: 8px 0;
    }
    #dupBatchList .dup-term-item .line-info { text-align: left; }
}

#dupSingleCompare {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
    text-align: left;
    font-size: 0.9rem;
}

#dupSingleCompare .old-def { color: var(--danger); font-weight: 500; }
#dupSingleCompare .new-def { color: var(--success); font-weight: 500; }
#dupSingleCompare .label { color: var(--text-secondary); }
#dupSingleSetNameDisplay { color: var(--accent); font-weight: 500; }

/* ===== IMPORT CHOICE MODAL ===== */
#importChoiceModal .modal-content { max-width: 520px; }

.import-choice-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    text-align: center;
}

.import-choice-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1.2rem;
    line-height: 1.5;
}

.import-choice-options {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.import-choice-btn {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem 1.1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    font-family: inherit;
    color: inherit;
    width: 100%;
}

.import-choice-btn:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
    transform: translateY(-1px);
}

.import-choice-btn.import-choice-danger:hover {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.08);
}

.import-choice-icon { font-size: 1.8rem; flex-shrink: 0; line-height: 1; margin-top: 2px; }
.import-choice-content { flex: 1; min-width: 0; }

.import-choice-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    line-height: 1.3;
}

.import-choice-btn.import-choice-danger .import-choice-name { color: var(--danger); }

.import-choice-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.import-choice-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
    .import-choice-btn { padding: 0.85rem 0.9rem; gap: 0.7rem; }
    .import-choice-icon { font-size: 1.5rem; }
    .import-choice-name { font-size: 0.88rem; }
    .import-choice-desc { font-size: 0.72rem; }
    .import-choice-title { font-size: 1rem; }
    .import-choice-subtitle { font-size: 0.78rem; }
}

/* ============================================================ */
/* ===== AI VOCAB GENERATOR ===== */
/* ============================================================ */

.aigen-container {
    background: var(--bg-secondary);
    border-radius: 28px;
    padding: 1.8rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.8rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.aigen-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ec4899, #a855f7, #3b82f6);
}

.aigen-container h3 { display: flex; align-items: center; gap: 0.5rem; }

.aigen-status-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    margin-top: 1rem;
    background: var(--bg-primary);
    border-radius: 16px;
    border-left: 3px solid var(--accent);
    animation: fadeIn 0.3s ease;
}

.aigen-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: aigenSpin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes aigenSpin { to { transform: rotate(360deg); } }

.aigen-preview-area {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 16px;
    border-left: 3px solid var(--success);
    animation: fadeIn 0.3s ease;
}

.aigen-preview-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.aigen-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: 500px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.3rem;
    margin-bottom: 0.8rem;
}

.aigen-preview-list::-webkit-scrollbar { width: 6px; }
.aigen-preview-list::-webkit-scrollbar-track { background: var(--bg-secondary); border-radius: 10px; }
.aigen-preview-list::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 10px; }
.aigen-preview-list::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.aigen-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.9rem 1rem;
    transition: all 0.15s ease;
}

.aigen-item:hover { border-color: var(--accent); }

.aigen-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px dashed var(--border);
}

.aigen-item-num { font-weight: 700; color: var(--accent); font-size: 0.9rem; flex-shrink: 0; }
.aigen-item-term-display { font-weight: 700; color: var(--text-primary); font-size: 1rem; word-break: break-word; }

.aigen-item-fields { display: flex; flex-direction: column; gap: 0.4rem; }

.aigen-field {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 0.6rem;
    align-items: center;
}

.aigen-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.aigen-field input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.15s;
    font-family: inherit;
    width: 100%;
}

.aigen-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
    background: var(--bg-secondary);
}

.aigen-field input::placeholder { color: var(--text-secondary); opacity: 0.5; }

.aigen-preview-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.aigen-preview-actions .btn { padding: 0.5rem 1.2rem; font-size: 0.85rem; }

@media (max-width: 768px) {
    .aigen-container { padding: 1.2rem; }
    .aigen-preview-list { max-height: 400px; }
    .aigen-item { padding: 0.75rem 0.85rem; }
    .aigen-field { grid-template-columns: 1fr; gap: 0.2rem; }
    .aigen-field label { text-align: left; font-size: 0.72rem; }
    .aigen-field input { font-size: 0.82rem; padding: 0.45rem 0.65rem; }
    .aigen-preview-actions { justify-content: stretch; }
    .aigen-preview-actions .btn { flex: 1; min-width: 0; }
}

@media (max-width: 480px) {
    .aigen-container { padding: 1rem; border-radius: 20px; }
    .aigen-preview-area { padding: 0.8rem; }
    .aigen-preview-header { font-size: 0.82rem; }
    .aigen-item { padding: 0.65rem 0.75rem; border-radius: 12px; }
    .aigen-item-header { margin-bottom: 0.5rem; padding-bottom: 0.5rem; }
    .aigen-item-term-display { font-size: 0.9rem; }
    .aigen-item-fields { gap: 0.3rem; }
    .aigen-field label { font-size: 0.68rem; }
    .aigen-field input { font-size: 0.78rem; padding: 0.4rem 0.6rem; }
}

/* ============================================================ */
/* ===== TOAST ===== */
/* ============================================================ */

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-secondary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    animation: slideIn 0.3s ease;
    border-left: 4px solid var(--success);
    max-width: 90vw;
    white-space: pre-line;
    line-height: 1.5;
}

.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@media (max-width: 768px) {
    .toast {
        right: 15px;
        left: 15px;
        bottom: 20px;
        max-width: calc(100vw - 30px);
        border-radius: 20px;
        padding: 0.8rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* ============================================================ */
/* ===== SCROLLBAR ===== */
/* ============================================================ */

.card-list::-webkit-scrollbar,
.folder-tree::-webkit-scrollbar,
#sbQuestionListContainer::-webkit-scrollbar,
#sbHistoryContainer::-webkit-scrollbar,
#dupBatchList::-webkit-scrollbar { width: 6px; }

.card-list::-webkit-scrollbar-track,
.folder-tree::-webkit-scrollbar-track,
#sbQuestionListContainer::-webkit-scrollbar-track,
#sbHistoryContainer::-webkit-scrollbar-track,
#dupBatchList::-webkit-scrollbar-track { background: var(--bg-primary); border-radius: 10px; }

.card-list::-webkit-scrollbar-thumb,
.folder-tree::-webkit-scrollbar-thumb,
#sbQuestionListContainer::-webkit-scrollbar-thumb,
#sbHistoryContainer::-webkit-scrollbar-thumb,
#dupBatchList::-webkit-scrollbar-thumb { background: var(--bg-card); border-radius: 10px; }

.card-list::-webkit-scrollbar-thumb:hover,
.folder-tree::-webkit-scrollbar-thumb:hover,
#sbQuestionListContainer::-webkit-scrollbar-thumb:hover,
#sbHistoryContainer::-webkit-scrollbar-thumb:hover,
#dupBatchList::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================ */
/* ===== END FILE 1A ===== */
/* ============================================================ */