/* ============================================================
   SUPERGOOD TRANSCRIBE — Dark theme
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0f0f0f;
    --surface:   #1a1a1a;
    --surface2:  #222222;
    --border:    #2e2e2e;
    --border2:   #3a3a3a;
    --text:      #e8e8e8;
    --text-muted:#888888;
    --accent:    #f5c518;
    --accent-dim:#c9a012;
    --success:   #4ade80;
    --error:     #f87171;
    --warning:   #fbbf24;
    --radius:    8px;
    --radius-lg: 12px;
    --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --mono:      'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

html { height: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100%;
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.muted { color: var(--text-muted); }

/* ---- Login ---- */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 360px;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.logo-mark {
    background: var(--accent);
    color: #000;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.04em;
    padding: 4px 8px;
    border-radius: 4px;
}

.logo-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.12em;
    color: var(--text);
}

.login-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.login-box input[type="password"] {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    padding: 10px 14px;
    outline: none;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}

.login-box input[type="password"]:focus {
    border-color: var(--accent);
}

.login-box input.input-error { border-color: var(--error); }

.form-error {
    color: var(--error);
    font-size: 13px;
    margin-bottom: 12px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: #000;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-dim); }

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border2);
}
.btn-secondary:hover:not(:disabled) { background: var(--border2); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; }

.btn-link {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

/* ---- App header ---- */
.app-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.monthly-badge {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px 10px;
}

/* ---- Layout ---- */
.app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.app-layout {
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .app-layout { grid-template-columns: 1fr; }
}

/* When transcript is visible, collapse the upload column and go full-width */
.app-layout.transcript-mode {
    grid-template-columns: 1fr;
}
.app-layout.transcript-mode .upload-panel {
    display: none;
}
.app-layout.transcript-mode .sidebar {
    position: static;
}

/* ---- Panels ---- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.panel + .panel { margin-top: 20px; }

.panel-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ---- Dropzone ---- */
.dropzone {
    border: 2px dashed var(--border2);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    margin-bottom: 20px;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(245, 197, 24, 0.04);
}

.dropzone-icon {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    margin: 0 auto 10px;
    display: block;
}

.dropzone-label {
    font-weight: 600;
    margin-bottom: 4px;
}

.dropzone-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dropzone-btn { margin-top: 14px; }

.dropzone-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.file-icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

#selected-filename {
    font-weight: 600;
    word-break: break-all;
}

/* ---- Form fields ---- */
.field { margin-bottom: 18px; }

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.field-hint {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 2px;
}

.keyterms-area {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.7;
    padding: 10px 12px;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.keyterms-area:focus { border-color: var(--accent); }

.field-count {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    margin-top: 4px;
}

/* ---- Alerts ---- */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.alert-error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--error);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--warning);
}

/* ---- Progress ---- */
.progress-file {
    font-weight: 600;
    margin-bottom: 16px;
    word-break: break-all;
}

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

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

#progress-label {
    font-size: 15px;
    font-weight: 600;
}

.progress-bar-wrap {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 14px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-note {
    font-size: 12px;
    color: var(--text-muted);
}

/* ---- Transcript ---- */
.transcript-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.transcript-header .panel-title { margin-bottom: 0; }

.transcript-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.transcript-text,
#transcript-text {
    display: block;
    box-sizing: border-box;
    width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.9;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    min-height: 500px;
    resize: vertical;
    overflow-y: auto;
    margin-bottom: 8px;
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

.transcript-text:focus {
    border-color: var(--accent);
}

.transcript-edit-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ---- History ---- */
.history-list { list-style: none; }

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.history-item:last-child { border-bottom: none; }
.history-item:hover .history-name { color: var(--accent); }

.history-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-completed { background: var(--success); }
.dot-processing, .dot-queued { background: var(--accent); }
.dot-error { background: var(--error); }

.history-info { flex: 1; min-width: 0; }

.history-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s;
}

.history-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.history-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}
.history-status.completed { color: var(--success); }
.history-status.processing,
.history-status.queued { color: var(--accent); }
.history-status.error { color: var(--error); }

.history-delete {
    background: none;
    border: none;
    color: var(--border2);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    flex-shrink: 0;
    line-height: 0;
    transition: color 0.15s;
}
.history-delete:hover { color: var(--error); }
.history-delete:disabled { opacity: 0.3; cursor: not-allowed; }

.empty-history {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0;
}

.sidebar { position: sticky; top: 80px; }

/* ---- Speaker labels ---- */
.options-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-muted);
    user-select: none;
}
.toggle-label:hover { color: var(--text); }
.toggle-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
}
.toggle-label input:checked + span { color: var(--text); }

.speaker-summary {
    font-size: 12px;
    color: var(--accent);
}

.input-number {
    width: 80px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    padding: 7px 10px;
    outline: none;
}
.input-number:focus { border-color: var(--accent); }

.input-text {
    width: 100%;
    box-sizing: border-box;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    padding: 7px 10px;
    outline: none;
}
.input-text:focus { border-color: var(--accent); }

.speaker-name-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.speaker-name-label {
    width: 80px;
    flex-shrink: 0;
    margin-bottom: 0;
}

/* ---- Keyterms toggle button ---- */
.keyterms-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 13px;
}
.keyterms-toggle:hover { color: var(--text); }

.keyterms-count-badge {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 10px;
    font-size: 11px;
    padding: 1px 7px;
    color: var(--text-muted);
}

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 15px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}
.modal-close:hover { color: var(--text); }

.modal-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: -6px;
}

.modal .keyterms-area {
    width: 100%;
    box-sizing: border-box;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
