/* vocab-dialog.css — Shared vocabulary viewer/manager dialog (Standard + Pro) */
/* ========== Vocabulary Dialog (Theme-aware) ========== */

.vocab-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--shadow-rgb), 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

.vocab-dialog-box {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 24px;
    width: 720px;
    max-width: 90%;
    height: 80vh;            /* 固定高度：搜尋過濾時 box 不潰縮，列表區 flex:1 內部 scroll 吸收 */
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

.vocab-dialog-header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.vocab-dialog-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.vocab-dialog-header h2 .lucide {
    width: 20px;
    height: 20px;
    color: var(--color-text-tertiary);
}

.vocab-dialog-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-text-tertiary);
    font-size: 13px;
}

.vocab-dialog-meta .meta-sep {
    width: 1px;
    height: 14px;
    background: var(--color-border);
}

.vocab-dialog-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s;
    flex-shrink: 0;
}

.vocab-dialog-close:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.vocab-dialog-close .lucide {
    width: 18px;
    height: 18px;
}

.vocab-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 12px;
    transition: border-color 0.15s;
    flex-shrink: 0;
}

.vocab-search-input:focus {
    border-color: var(--color-brand);
}

.vocab-search-input::placeholder {
    color: var(--color-text-tertiary);
}

.vocab-table-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-primary);
}

.vocab-table {
    width: 100%;
    border-collapse: collapse;
}

.vocab-table thead {
    position: sticky;
    top: 0;
    background: var(--color-bg-secondary);
    z-index: 1;
}

.vocab-table th {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vocab-table th.center {
    text-align: center;
}

.vocab-table td {
    padding: 10px 12px;
}

.vocab-table td.center {
    text-align: center;
}

.vocab-table tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background 0.15s;
}

.vocab-table tbody tr:last-child {
    border-bottom: none;
}

.vocab-table tbody tr:hover {
    background: rgba(var(--overlay-rgb), 0.04);
}

.vocab-phrase-text {
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text-primary);
}

.vocab-pronunciation {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: 2px;
}

.vocab-translation-text {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.vocab-context-text {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: 2px;
}

.vocab-lang-badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: var(--radius-xs);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: rgba(var(--overlay-rgb), 0.08);
    color: var(--color-text-secondary);
}

.vocab-boost-badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.vocab-boost-badge.high {
    color: var(--color-text-primary);
    font-weight: 600;
}

.vocab-dialog-footer {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.vocab-btn-outline {
    padding: 8px 16px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.vocab-btn-outline:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border-color: var(--color-border-hover);
}

.vocab-btn-outline .lucide {
    width: 14px;
    height: 14px;
}

.vocab-btn-primary {
    padding: 8px 20px;
    background: var(--color-brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: background 0.15s;
}

.vocab-btn-primary:hover {
    background: var(--color-brand-dark);
}

/* Manager dialog variant */
.vocab-manager-count {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.vocab-manager-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: var(--color-bg-primary);
}

.vocab-manager-item {
    padding: 8px;
    border-bottom: 1px solid var(--color-border);
}

.vocab-manager-item:last-child {
    border-bottom: none;
}

.vocab-manager-phrase {
    font-weight: 500;
    color: var(--color-text-primary);
}

.vocab-manager-lang {
    color: var(--color-text-tertiary);
    margin-left: 8px;
}

/* Mobile: bottom sheet pattern */
@media (max-width: 768px) {
    .vocab-dialog-overlay {
        align-items: flex-end;
        animation: fadeIn 0.18s ease-out;
    }

    .vocab-dialog-box {
        width: 100%;
        max-width: 100%;
        height: 85vh;
        border-radius: 16px 16px 0 0;
        padding: 8px 16px 16px;
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
        animation: sheetSlideUp 0.22s cubic-bezier(0.32, 0.72, 0, 1);
    }

    /* Drag handle (visual affordance for swipe-to-dismiss feel) */
    .vocab-dialog-box::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        margin: 6px auto 10px;
        border-radius: 2px;
        background: var(--color-border);
        flex-shrink: 0;
    }

    .vocab-dialog-header {
        margin-bottom: 12px;
    }

    .vocab-dialog-header h2 {
        font-size: 16px;
    }

    .vocab-dialog-footer {
        margin-top: 12px;
        flex-direction: column;
    }

    .vocab-btn-outline,
    .vocab-btn-primary {
        width: 100%;
        justify-content: center;
    }

    /* Compact table on mobile + drop the Boost column (internal tuning value,
       not useful for end-user inspection; freed space prevents Chinese
       header chars from wrapping vertically) */
    .vocab-table th,
    .vocab-table td {
        padding: 8px 8px;
        white-space: nowrap;
    }

    .vocab-table th {
        font-size: 10px;
        letter-spacing: 0.3px;
    }

    .vocab-table th:nth-child(4),
    .vocab-table td:nth-child(4) {
        display: none;
    }

    /* Translation column is the only one that should wrap (long phrases) */
    .vocab-table td:nth-child(2) {
        white-space: normal;
    }

    .vocab-phrase-text {
        font-size: 13px;
    }

    .vocab-translation-text {
        font-size: 12px;
    }
}

@keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* 詞彙表格滾動條美化 */
#standardVocabDialog table {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--text-secondary-rgb), 0.5) transparent;
}

#standardVocabDialog table::-webkit-scrollbar {
    width: 8px;
}

#standardVocabDialog table::-webkit-scrollbar-track {
    background: transparent;
}

#standardVocabDialog table::-webkit-scrollbar-thumb {
    background: rgba(var(--text-secondary-rgb), 0.5);
    border-radius: var(--radius-xs);
}

#standardVocabDialog table::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--text-secondary-rgb), 0.7);
}
