/* Dashboard styles for Vietnamese Script Analyzer */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

header {
    background: #1a1a2e;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 { font-size: 1.3rem; font-weight: 600; }

#stats-bar { display: flex; gap: 1.5rem; }

.stat {
    background: rgba(255,255,255,0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

main { padding: 1.5rem 2rem; max-width: 1400px; margin: 0 auto; }

.panels { display: flex; gap: 1.5rem; align-items: flex-start; }

.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#selection-panel { width: 360px; flex-shrink: 0; }
#comparison-panel { flex: 1; min-width: 0; }

/* Tab bar */
.tab-bar { display: flex; gap: 0; margin-bottom: 1rem; border-bottom: 2px solid #e0e0e0; }
.tab {
    flex: 1; background: none; color: #666; border: none; padding: 0.5rem 0.3rem;
    font-size: 0.85rem; cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; transition: all 0.2s;
}
.tab.active { color: #1a1a2e; border-bottom-color: #1a1a2e; font-weight: 600; }
.tab:hover:not(.active) { color: #333; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* File drop zones */
.file-drop {
    border: 2px dashed #ccc; border-radius: 6px; padding: 0.8rem;
    text-align: center; cursor: pointer; transition: all 0.2s;
    background: #fafafa; min-height: 44px; display: flex; align-items: center; justify-content: center;
}
.file-drop:hover, .file-drop.dragover { border-color: #1a1a2e; background: #f0f0ff; }
.file-drop.has-file { border-color: #28a745; background: #f0fff0; border-style: solid; }
.drop-label { font-size: 0.82rem; color: #888; pointer-events: none; }
.file-drop.has-file .drop-label { color: #28a745; font-weight: 500; }

/* Doc name input */
#doc-name-input {
    width: 100%; padding: 0.5rem; border: 1px solid #ddd;
    border-radius: 4px; font-size: 0.9rem;
}

/* Pipeline steps */
#pipeline-steps { margin: 0.8rem 0; }
.step { font-size: 0.85rem; padding: 0.3rem 0; color: #888; display: flex; align-items: center; gap: 0.4rem; }
.step.active { color: #1a1a2e; font-weight: 600; }
.step.done { color: #28a745; }
.step.done .step-icon::before { content: ""; }
.step-icon { width: 18px; text-align: center; }

/* Upload button */
#upload-btn { width: 100%; margin-top: 0.5rem; background: #28a745; }
#upload-btn:hover:not(:disabled) { background: #218838; }

.card h2 { font-size: 1.1rem; margin-bottom: 1rem; color: #1a1a2e; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; color: #666; margin-bottom: 0.3rem; }
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
}

button, .btn-sm {
    background: #1a1a2e;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}
button:hover:not(:disabled) { background: #16213e; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }

#compare-btn { width: 100%; margin-top: 0.5rem; }

/* Audio panel */
.audio-panel { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #eee; }
.audio-panel h3 { font-size: 0.95rem; margin-bottom: 0.8rem; color: #1a1a2e; }
.audio-row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.audio-row span { font-size: 0.85rem; min-width: 60px; }
.audio-row audio { width: 100%; max-width: 200px; height: 32px; margin-top: 0.3rem; }
.btn-regen { padding: 0.2rem 0.5rem; font-size: 0.85rem; cursor: pointer; }

/* Summary box */
.summary-box {
    background: #f8f9fa;
    border-left: 3px solid #1a1a2e;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Changes table */
.table-wrap { overflow-x: auto; }

#changes-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
#changes-table th, #changes-table td {
    padding: 0.5rem 0.6rem;
    border: 1px solid #e0e0e0;
    text-align: left;
    vertical-align: top;
}
#changes-table th { background: #f0f0f0; font-weight: 600; white-space: nowrap; }
#changes-table td:nth-child(1) { width: 30px; text-align: center; color: #999; }
#changes-table td:nth-child(2) { width: 50px; font-weight: 600; }
#changes-table td:nth-child(3) { width: 70px; }
#changes-table td:nth-child(4) { width: 50px; text-align: center; }

/* Change type colors */
.type-sua { background: #fff3cd; color: #856404; }
.type-xoa { background: #f8d7da; color: #721c24; }
.type-them { background: #d4edda; color: #155724; }

/* Loading overlay */
#loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 1000;
}
#loading-overlay[hidden] { display: none; }
#loading-text { color: white; margin-top: 1rem; font-size: 1rem; }
#loading-percent { color: #4fc3f7; font-size: 1.8rem; font-weight: 700; margin-top: 0.5rem; }

/* Progress bar */
.progress-track {
    width: 320px; height: 8px; background: rgba(255,255,255,0.2);
    border-radius: 4px; margin-top: 0.8rem; overflow: hidden;
}
.progress-fill {
    height: 100%; background: #4fc3f7; border-radius: 4px;
    transition: width 0.4s ease;
}

.spinner {
    width: 40px; height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 900px) {
    .panels { flex-direction: column; }
    #selection-panel { width: 100%; }
}
