/**
 * whisper webCLI Styles
 * Dark theme, responsive, accessible.
 * Shares the visual language of the webCLI family (see ffmpeg-webCLI).
 */

:root {
  --bg: #0d0f1a;
  --surface: #151827;
  --surface2: #1e2236;
  --surface3: #252a42;
  --accent: #3665b6;
  --accent-h: #81e2f8;
  --success: #70db97;
  --danger: #ef4444;
  --warn: #f59e0b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #5b515f;
  --r: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent-h); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; gap: 10px; }
header h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.pill { font-size: 0.7rem; padding: 2px 9px; border-radius: 20px; background: rgba(54,101,182,.22); color: var(--accent-h); font-weight: 600; }
.badge-local { font-size: 0.7rem; padding: 2px 9px; border-radius: 20px; background: rgba(112,219,151,.15); color: var(--success); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.gh-link { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 5px 12px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface2); transition: color .15s, border-color .15s, background .15s; white-space: nowrap; }
.gh-link:hover { color: var(--text); border-color: var(--accent); background: var(--surface3); text-decoration: none; }
@media (max-width: 600px) { .gh-link span { display: none; } .gh-link { padding: 5px 9px; } .badge-local { display: none; } }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 20px 24px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 820px) { .grid { grid-template-columns: 1fr; } }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.card-header { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; display: flex; align-items: center; justify-content: space-between; }
.card-body { padding: 16px; }

/* ── Status bar ── */
.statusbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 16px; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); flex-shrink: 0; transition: background .3s; }
.dot.loaded { background: var(--success); }
.dot.loading { background: var(--warn); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.25} }
#statusText { font-size: 0.82rem; color: var(--muted); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 7px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 600; transition: background .15s, opacity .15s; white-space: nowrap; }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); color: #08121e; }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface3); }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-danger { padding: 7px 14px; background: var(--danger); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.83rem; transition: background .15s; }
.btn-danger:hover { background: #dc2626; }
.btn-danger:disabled { background: var(--muted); cursor: not-allowed; opacity: 0.6; }
.btn-mode { padding: 8px 16px; background: var(--surface3); border: 1px solid var(--surface3); border-radius: 6px; color: var(--muted); font-size: 0.83rem; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.btn-mode:hover { background: var(--surface2); }
.btn-mode.active { background: var(--accent); border-color: var(--accent); color: white; }
.button-group { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Input Modes ── */
.input-mode { display: block; }
.input-mode.hidden { display: none; }

/* ── Upload zone ── */
.drop-zone { border: 2px dashed var(--border); border-radius: var(--r); padding: 36px 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--surface2); }
.drop-zone:hover, .drop-zone.over, .drop-zone.dragging { border-color: var(--accent); background: rgba(54,101,182,.10); }
.drop-zone svg { width: 36px; height: 36px; color: var(--muted); margin-bottom: 10px; }
.drop-zone p { font-size: 0.83rem; color: var(--muted); }
.drop-zone strong { color: var(--accent-h); }
#audio-file { display: none; }

/* ── File meta ── */
.file-meta-list { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--text); }
.file-meta-list .lbl { display: inline-block; min-width: 70px; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: .05em; }

/* ── Forms ── */
.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.form-group { flex: 1; min-width: 130px; }
label.lbl { font-size: 0.78rem; color: var(--muted); display: block; margin-bottom: 4px; font-weight: 600; }
input[type="number"], input[type="text"], select {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); padding: 7px 10px; font-size: 0.83rem; outline: none;
}
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
input[type="range"]:disabled { cursor: default; opacity: 0.6; }
input:focus, select:focus { border-color: var(--accent); }
.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-top: 12px; font-size: 0.85rem; }
.checkbox-row input { accent-color: var(--accent); cursor: pointer; }
.hint { font-size: 0.72rem; color: var(--muted); margin-top: 6px; }

/* ── Preview ── */
.preview-text {
  max-height: 400px; overflow-y: auto; padding: 12px; background: #080a10;
  border-radius: 6px; border: 1px solid var(--border); white-space: pre-wrap;
  word-wrap: break-word; font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.78rem; line-height: 1.6; color: #7dd3fc;
}

.media-seekbar {
  height: 6px; border-radius: 3px;
  -webkit-appearance: none; appearance: none;
  background: var(--surface3); outline: none;
}

.media-seekbar::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  border: 2px solid var(--accent);
}

.media-seekbar::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  border: 2px solid var(--accent);
}

.media-seekbar:disabled {
  opacity: 0.7; cursor: not-allowed;
}

/* ── Progress ── */
.progress { background: var(--surface3); border-radius: 6px; height: 22px; overflow: hidden; position: relative; }
.progress-bar { background: var(--accent); height: 100%; transition: width .2s ease; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; color: #fff; }
.progress-bar.indeterminate {
  background-image: linear-gradient(-45deg, rgba(255,255,255,.25) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.25) 50%, rgba(255,255,255,.25) 75%, transparent 75%, transparent);
  background-size: 32px 32px;
  animation: progress-stripes 1s linear infinite;
}
@keyframes progress-stripes { from { background-position: 32px 0; } to { background-position: 0 0; } }

/* ── Metrics Panel ── */
.metric-item { display: flex; flex-direction: column; gap: 4px; }
.metric-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.metric-value { font-size: 0.85rem; color: var(--accent-h); font-weight: 700; font-family: 'SF Mono', 'Courier New', monospace; }

#metrics-panel {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px;
  margin-top: 12px; padding: 12px; background: var(--surface3); border-radius: 6px;
}

#segment-details {
  font-family: 'SF Mono', 'Courier New', monospace; font-size: 0.7rem;
  color: var(--muted); max-height: 150px; overflow-y: auto;
  border-top: 1px solid var(--surface3); padding-top: 8px; margin-top: 8px;
  line-height: 1.4;
}

/* ── Raw Flags Input ── */
#raw-flags-input {
  width: 100%; padding: 8px; font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 0.75rem; background: var(--surface); border: 1px solid var(--surface3);
  border-radius: 4px; color: var(--text); resize: vertical;
  transition: border-color .15s;
}

#raw-flags-input:focus {
  outline: none; border-color: var(--accent);
}

#flags-status {
  margin-top: 8px; font-size: 0.7rem; color: var(--muted);
  font-family: 'SF Mono', 'Courier New', monospace; line-height: 1.4;
}

/* ── Collapsible (Advanced Settings) ── */
.collapsible { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.collapsible-header { background: var(--surface2); padding: 11px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); user-select: none; transition: background .15s; }
.collapsible-header:hover { background: var(--surface3); }
.collapsible-icon { display: inline-block; transition: transform .15s; }
.collapsible.open .collapsible-icon { transform: rotate(90deg); }
.collapsible-content { max-height: 0; overflow: hidden; transition: max-height .15s; }
.collapsible.open .collapsible-content { max-height: 1000px; padding: 16px; border-top: 1px solid var(--border); }

/* ── Alerts ── */
.alert { padding: 11px 14px; border-radius: 7px; margin-bottom: 10px; display: flex; align-items: flex-start; gap: 10px; font-size: 0.82rem; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0,0,0,.35); }
.alert-icon { font-size: 1rem; flex-shrink: 0; line-height: 1.3; }
.alert-content { flex: 1; }
.alert-success { border-color: var(--success); color: var(--success); }
.alert-warning { border-color: var(--warn); color: var(--warn); }
.alert-error { border-color: var(--danger); color: var(--danger); }
.alert-info { border-color: var(--accent); color: var(--accent-h); }

/* ── Utilities ── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-secondary { color: var(--muted); }
.text-small { font-size: 0.8rem; }

/* ── Responsive ── */
@media (max-width: 480px) {
  header { padding: 10px 14px; }
  header h1 { font-size: 1rem; }
  .container { padding: 12px 14px; }
  .card-body { padding: 12px; }
  .card-header { padding: 9px 12px; }
  .drop-zone { padding: 24px 14px; }
  .form-group { min-width: 0; flex-basis: 100%; }
}

/* ── Quill Rich Text Editor ── */
#editor { background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: 6px; overflow: hidden; min-height: 300px;    max-height: 90vh; }
#editor .ql-container { font-size: 14px; font-family: inherit; border: none; }
#editor .ql-editor { min-height: 300px; padding: 16px; color: var(--text); background: var(--surface); }
#editor .ql-editor.ql-blank::before { color: var(--muted); font-style: italic; }
#editor .ql-toolbar { background: var(--surface2); border: none !important; border-bottom: 1px solid var(--border) !important; border-radius: 6px 6px 0 0; padding: 10px; }
#editor .ql-toolbar button:hover, #editor .ql-toolbar button:focus,
#editor .ql-toolbar button.ql-active, #editor .ql-toolbar select:hover,
#editor .ql-toolbar select.ql-active { color: var(--accent-h); }
#editor .ql-toolbar.ql-snow .ql-picker-label,
#editor .ql-toolbar.ql-snow .ql-picker { color: var(--text); }
#editor .ql-toolbar.ql-snow .ql-stroke, #editor .ql-snow .ql-stroke { stroke: var(--muted); }
#editor .ql-toolbar.ql-snow .ql-fill, #editor .ql-toolbar.ql-snow .ql-stroke.ql-fill,
#editor .ql-snow .ql-fill { fill: var(--muted); }
#editor .ql-snow a { color: var(--accent-h); }
#editor .ql-editor h1, #editor .ql-editor h2, #editor .ql-editor h3 { color: var(--text); }
#editor .ql-editor blockquote { border-left: 4px solid var(--border); color: var(--muted); margin: 1rem 0; padding-left: 1rem; }
#editor .ql-editor code, #editor .ql-editor pre { background: #080a10; color: var(--accent-h); border-radius: 4px; padding: 0.25rem 0.5rem; font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace; }
