/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0f1117; --bg-card: #1a1d27; --bg-hover: #242836;
    --border: #2a2e3d; --text: #e4e6ed; --text-dim: #8b8fa3;
    --accent: #007acc; --accent-hover: #0098ff; --accent-glow: rgba(0,122,204,0.15);
    --success: #2ecc71; --error: #e74c3c; --warning: #f39c12;
    --radius: 12px; --radius-sm: 8px;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.6; min-height: 100vh; }
.container { max-width: 860px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

/* ─── Header ───────────────────────────────────────────────────────────────── */
header { text-align: center; margin-bottom: 2.5rem; }
header h1 { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.02em; background: linear-gradient(135deg, var(--accent), #a855f7); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.subtitle { color: var(--text-dim); font-size: 1rem; margin-top: 0.3rem; }

/* ─── Card ─────────────────────────────────────────────────────────────────── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; margin-bottom: 1.5rem; }

/* ─── Drop Zone ────────────────────────────────────────────────────────────── */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--radius-sm); padding: 3rem 2rem; text-align: center; cursor: pointer; transition: all 0.25s; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: var(--accent-glow); }
.upload-icon { width: 48px; height: 48px; color: var(--text-dim); margin-bottom: 1rem; }
.drop-zone p { color: var(--text-dim); font-size: 1rem; }
.browse-link { color: var(--accent); cursor: pointer; text-decoration: underline; }
.hint { font-size: 0.85rem !important; margin-top: 0.5rem; opacity: 0.6; }

/* ─── File List ────────────────────────────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
.file-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1rem; background: var(--bg-hover); border-radius: var(--radius-sm); font-size: 0.9rem; }
.file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-item-size { color: var(--text-dim); white-space: nowrap; font-size: 0.85rem; }
.file-item-remove { background: none; border: none; color: var(--text-dim); font-size: 1.2rem; cursor: pointer; padding: 0 0.25rem; line-height: 1; }
.file-item-remove:hover { color: var(--error); }

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.5rem; border: none; border-radius: var(--radius-sm); font-size: 0.95rem; font-weight: 500; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; margin-top: 1rem; width: 100%; justify-content: center; font-size: 1.05rem; padding: 0.85rem; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--bg-hover); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-outline:hover { color: var(--text); border-color: var(--text-dim); }
.btn-icon-svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ─── Job Cards ────────────────────────────────────────────────────────────── */
.job-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 0.75rem; transition: border-color 0.2s; }
.job-card.clickable { cursor: pointer; }
.job-card.clickable:hover { border-color: var(--accent); }
.job-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.job-header h3 { font-size: 1rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; margin-right: 1rem; }
.status-badge { font-size: 0.8rem; padding: 0.25rem 0.75rem; border-radius: 20px; background: var(--accent-glow); color: var(--accent); white-space: nowrap; font-weight: 500; }
.status-badge.done { background: rgba(46,204,113,0.15); color: var(--success); }
.status-badge.error { background: rgba(231,76,60,0.15); color: var(--error); }
.job-progress { width: 100%; height: 3px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; }
.job-progress-bar { height: 100%; width: 30%; background: linear-gradient(90deg, var(--accent), #a855f7); border-radius: 2px; animation: progress-indeterminate 1.5s ease-in-out infinite; }
.job-progress-bar.done { width: 100%; animation: none; background: var(--success); }
.job-progress-bar.error { width: 100%; animation: none; background: var(--error); }
.job-message { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.4rem; }

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); width: 30%; }
    50% { width: 60%; }
    100% { transform: translateX(350%); width: 30%; }
}

/* ─── Results ──────────────────────────────────────────────────────────────── */
.result-header { margin-bottom: 1.25rem; }
.result-header h2 { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.export-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.transcript-text { max-height: 60vh; overflow-y: auto; line-height: 1.8; font-size: 1rem; white-space: pre-wrap; word-wrap: break-word; padding-right: 0.5rem; }
.transcript-text::-webkit-scrollbar { width: 6px; }
.transcript-text::-webkit-scrollbar-track { background: transparent; }
.transcript-text::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── History ──────────────────────────────────────────────────────────────── */
.section-title { font-size: 1.1rem; font-weight: 600; color: var(--text-dim); margin-bottom: 0.75rem; }
.history-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.25rem; margin-bottom: 0.5rem; display: flex; gap: 1rem; align-items: center; }
.history-main { flex: 1; min-width: 0; }
.history-info { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.25rem; }
.history-name { font-weight: 500; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-date { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }
.history-preview { color: var(--text-dim); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.btn-xs { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* ─── Upload Progress ──────────────────────────────────────────────────────── */
.upload-progress { margin-top: 1.5rem; }
.upload-progress-label { font-size: 0.95rem; margin-bottom: 0.5rem; color: var(--text); }
.upload-progress-label span { font-weight: 600; color: var(--accent); }

/* ─── Button animations ────────────────────────────────────────────────────── */
.btn-success { border-color: var(--success) !important; color: var(--success) !important; }
.btn-download { transition: all 0.2s; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ─── Form input (login) ──────────────────────────────────────────────────── */
.form-input { width: 100%; padding: 0.75rem 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 0.95rem; font-family: inherit; }
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

/* ─── Google Login Button ──────────────────────────────────────────────────── */
.btn-google { display: inline-flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1.5rem; background: #fff; color: #333; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 500; text-decoration: none; transition: box-shadow 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.btn-google:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* ─── Toast ────────────────────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%); background: var(--bg-card); border: 1px solid var(--success); border-radius: var(--radius-sm); padding: 0.75rem 1.25rem; display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; box-shadow: 0 8px 32px rgba(0,0,0,0.4); z-index: 100; animation: toast-in 0.3s ease; }
.toast a { color: var(--accent); font-weight: 500; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(1rem); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.hidden { display: none !important; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .container { padding: 1.25rem 1rem 3rem; }
    header h1 { font-size: 1.7rem; }
    .card { padding: 1.25rem; }
    .drop-zone { padding: 2rem 1rem; }
    .export-actions { flex-direction: column; }
    .export-actions .btn { width: 100%; justify-content: center; }
    .segment { flex-direction: column; gap: 0.15rem; }
    .timestamp { min-width: auto; }
}
