/* Word bank view: level breakdown, collapsible sections, mastery badges */

.wordbank-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border-radius: 12px;
}

.wordbank-toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.8rem;
    color: #64748b;
    min-width: 180px;
}

.wordbank-toolbar-field select {
    margin-bottom: 0;
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 8px;
}

.wordbank-list-meta {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0 0 16px;
}

.word-last-reviewed {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 4px;
}

.level-breakdown {
    margin-bottom: 24px;
    background: #f8fafc;
    border-radius: 20px;
    padding: 16px;
}

.level-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.level-name {
    width: 60px;
    font-weight: 600;
    font-size: 0.85rem;
}

.level-bar {
    flex: 1;
    height: 8px;
    background: var(--color-border, #e2e8f0);
    border-radius: 4px;
    overflow: hidden;
}

.level-fill {
    height: 100%;
    background: var(--color-primary, #e63946);
    border-radius: 4px;
}

.level-count {
    flex: 1 1 120px;
    min-width: 80px;
    font-size: 0.8rem;
    color: var(--color-text-muted, #64748b);
    text-align: right;
}

.word-bank-levels {
    margin-top: 16px;
}

.level-section {
    margin-bottom: 16px;
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 16px;
    overflow: hidden;
}

.level-header {
    background: #f1f5f9;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.level-title {
    font-weight: 700;
    color: var(--color-text, #1e293b);
}

.level-word-count {
    flex: 1;
    font-size: 0.8rem;
    color: var(--color-text-muted, #64748b);
}

.collapse-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--color-text-muted, #64748b);
    width: auto;
    padding: 0 8px;
}

.level-words {
    padding: 8px;
}

.word-info {
    flex: 1;
}

.word-bank-levels .word-char {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--color-primary, #e63946);
    margin-right: 8px;
}

.word-bank-levels .word-pinyin {
    color: var(--color-text-muted, #64748b);
    font-size: 0.85rem;
    margin-right: 12px;
}

.word-bank-levels .word-def {
    color: #334155;
    font-size: 0.85rem;
    margin-top: 4px;
    margin-left: 0;
}

.word-bank-levels .word-item {
    align-items: flex-start;
}

.word-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    flex: 0 0 auto;
    min-width: min(200px, 100%);
    max-width: 240px;
}

.mastery-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    width: 100%;
    box-sizing: border-box;
}

.mastery-progress {
    width: 100%;
}

.mastery-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted, #64748b);
    margin-bottom: 4px;
}

.mastery-progress-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.mastery-progress-fill {
    height: 100%;
    background: var(--color-primary, #e63946);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.mastery-progress-fill.complete {
    background: var(--color-success, #10b981);
}

.word-meta .word-remove-btn {
    align-self: flex-end;
}

.mastery-badge.mastered {
    background: var(--color-success, #10b981);
    color: white;
}

.mastery-badge.learning {
    background: var(--color-warn-bg, #fef3c7);
    color: var(--color-warn-text, #92400e);
}

.review-due-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #fee2e2;
    color: #b91c1c;
    white-space: nowrap;
}

.word-bank-stats-hint {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--color-text-muted, #64748b);
    background: #f8fafc;
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--color-border, #e2e8f0);
}

/* Level progress report modal (>20% level coverage) */
.level-report-modal {
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
}

.level-report-intro {
    color: var(--color-text-muted, #64748b);
    line-height: 1.5;
    margin: 0 0 20px;
    font-size: 0.92rem;
}

.level-report-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.level-report-card {
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 16px;
    padding: 16px;
    background: #f8fafc;
}

.level-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.level-report-level {
    font-weight: 700;
    font-size: 1.1rem;
}

.level-report-grade {
    font-size: 1.5rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 12px;
    background: #e2e8f0;
}

.level-report-card.grade-a .level-report-grade { background: #d1fae5; color: #065f46; }
.level-report-card.grade-b .level-report-grade { background: #dbeafe; color: #1e40af; }
.level-report-card.grade-c .level-report-grade { background: #e0e7ff; color: #3730a3; }
.level-report-card.grade-d .level-report-grade { background: #fef3c7; color: #92400e; }
.level-report-card.grade-pass .level-report-grade { background: #f3f4f6; color: #374151; }
.level-report-card.grade-keep-practicing .level-report-grade { background: #fee2e2; color: #991b1b; }

.level-report-label {
    margin: 0 0 8px;
    color: #64748b;
    font-size: 0.9rem;
}

.level-report-score {
    margin: 0 0 12px;
    font-size: 1rem;
}

.level-report-stats {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.88rem;
}

.level-report-stats li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-top: 1px solid #e2e8f0;
}

.level-report-stats li:first-child {
    border-top: none;
}

#level-report-close-btn {
    width: 100%;
}

@media (min-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .word-bank-levels .word-item {
        flex-wrap: nowrap;
    }

    .word-meta {
        min-width: 220px;
    }
}

@media (max-width: 640px) {
    .word-bank-levels .word-item {
        flex-direction: column;
    }

    .word-meta {
        max-width: none;
        width: 100%;
    }

    .level-stat {
        flex-wrap: wrap;
    }

    .level-count {
        width: 100%;
        text-align: left;
    }
}
