/* Minimal, mobile-first renewal stylesheet focusing on readability */
:root {
  /* Base palette */
  --bg: #ffffff;
  --fg: #0f172a;          /* slate-900 */
  --text: #0f172a;        /* slate-900 - alias for consistency */
  --muted: #64748b;       /* slate-500 */
  --accent: #2563eb;      /* blue-600 */
  --accent-700: #1d4ed8;  /* blue-700 */
  --accent-500: #3b82f6;  /* blue-500 */
  --success: #10b981;     /* emerald-500 */
  --warning: #f59e0b;     /* amber-500 */
  --danger:  #ef4444;     /* red-500 */
  --border: #e5e7eb;      /* gray-200 */
  --surface: #f8fafc;     /* slate-50 */
  --background: #ffffff;  /* white */

  /* Elevation & radius */
  --radius: 12px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.06);
  --shadow-md: 0 6px 16px rgba(2, 6, 23, 0.08);

  /* Spacing */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: clamp(14px, 1.6vw, 16px); }

.renewal-header { padding: var(--space-6) var(--space-4); border-bottom: 1px solid var(--border); background: linear-gradient(135deg, var(--accent) 0%, var(--accent-700) 100%); color: #fff; }
.renewal-header h1 { margin: 0 0 var(--space-2) 0; font-size: clamp(20px, 4vw, 28px); color: #fff; }
.renewal-header p { margin: 0; color: rgba(255,255,255,0.9); font-size: 14px; }
.renewal-header .lang-btn { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.2); }
.renewal-header .lang-btn.active { background: #fff; color: var(--accent-700); border-color: #fff; }
.renewal-header .lang-text { font-weight: 600; }

.renewal-main { padding: var(--space-6) var(--space-4); max-width: 960px; margin: 0 auto; }
.block { padding: var(--space-4) 0; }
.block + .block { border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: var(--space-3); }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.gap { gap: var(--space-4); }
.stat { font-size: 14px; color: var(--muted); }

h2 { margin: 0 0 var(--space-3) 0; font-size: 18px; }
h3 { margin: 0 0 var(--space-3) 0; font-size: 16px; }

.btn { appearance: none; border: 1px solid var(--border); background: #fff; color: var(--fg); border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 14px; transition: all .2s ease; box-shadow: var(--shadow-sm); }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-700); border-color: var(--accent-700); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--fg); }
.btn.ghost:hover { background: rgba(2,6,23,0.04); }
.input { width: auto; min-width: 160px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 14px; transition: box-shadow .15s ease, border-color .15s ease; }
.input:focus { outline: none; border-color: var(--accent-500); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.input::placeholder { color: #94a3b8; }

.upload-zone { border: 1px dashed var(--border); border-radius: var(--radius); padding: var(--space-6); text-align: center; background: var(--surface); transition: all .2s ease; }
.upload-zone:hover { border-color: var(--accent-500); background: var(--background); }
.upload-zone.dragover { border-color: var(--success); background: #ecfdf5; box-shadow: var(--shadow-sm) inset; }
.upload-icon { font-size: 36px; margin-bottom: var(--space-2); }
.file-types { color: var(--muted); font-size: 13px; }

.bar { height: 10px; background: var(--border); border-radius: 6px; overflow: hidden; }
.bar .progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent) 0%, var(--accent-500) 100%); transition: width 300ms ease; position: relative; }
.bar .progress-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,.2) 0%, rgba(255,255,255,.6) 50%, rgba(255,255,255,.2) 100%); transform: translateX(-100%); animation: shimmer 1.8s infinite; }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.bar .progress-fill.progress-low { background: #ef4444; }
.bar .progress-fill.progress-medium { background: #f59e0b; }
.bar .progress-fill.progress-high { background: #10b981; }
.events { border: 1px solid var(--border); border-radius: 8px; padding: var(--space-3); max-height: 200px; overflow: auto; }
.events { display: none; }

/* Progress helper text */
.progress-helper { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Progress status styling */
.progress-status {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}

/* Network status styling */
#networkStatus {
  display: none;
  align-items: center;
  gap: 8px;
}

#statusIndicator {
  font-size: 12px;
  color: var(--success);
}

#statusText {
  font-size: 12px;
  color: var(--muted);
}

/* Hide connected/connecting badges unless error */
.status-error, .status-connection-error { display: inline-flex !important; }
.list { display: block; border: 1px solid var(--border); border-radius: 8px; padding: var(--space-3); }
.list.hidden { display: none; }

/* Language button active state */
.lang-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Config collapsible summary */
.config-summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.config-summary::marker { color: var(--muted); }

.renewal-footer { padding: var(--space-6) var(--space-4); border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 480px) {
  .renewal-main { padding: var(--space-4) var(--space-3); }
  .btn, .input { width: 100%; }
}

/* ===== Script display (readable, minimal) ===== */
.script-section .list { padding: 0; }
.script-segment { padding: 12px 0; border-top: 1px solid var(--border); }
.script-segment:first-child { border-top: 0; }
.speaker-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.speaker-name { font-weight: 700; color: var(--accent); }
.speaker-name[data-speaker="SPEAKER_00"] { color: #3b82f6; }
.speaker-name[data-speaker="SPEAKER_01"] { color: #10b981; }
.speaker-name[data-speaker="SPEAKER_02"] { color: #ef4444; }
.speaker-name[data-speaker="SPEAKER_03"] { color: #a855f7; }
.speaker-name[data-speaker="SPEAKER_04"] { color: #f97316; }
.time-range { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); background: var(--surface); }
.confidence { font-size: 12px; color: var(--muted); }
.confidence.high { color: var(--success); }
.confidence.medium { color: var(--warning); }
.confidence.low { color: var(--danger); }
.speech-text { line-height: 1.7; font-size: 14px; color: var(--text); }
.script-metadata { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.overlap-indicator { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; border-radius: 6px; padding: 2px 6px; font-size: 12px; }

/* ===== Script Statistics ===== */
.script-stats-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.stat-item {
  text-align: center;
  padding: 12px;
  background: var(--background);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.stat-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* ===== Enhanced visibility for Korean text ===== */
.stat-label:lang(ko) {
  font-size: 11px;
  line-height: 1.3;
}

/* ===== Additional contrast improvements ===== */
.script-section .list { padding: 0; }
.script-segment { padding: 12px 0; border-top: 1px solid var(--border); }
.script-segment:first-child { border-top: 0; }
.speaker-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.speaker-name { font-weight: 700; color: var(--accent); }
.speaker-name[data-speaker="SPEAKER_00"] { color: #3b82f6; }
.speaker-name[data-speaker="SPEAKER_01"] { color: #10b981; }
.speaker-name[data-speaker="SPEAKER_02"] { color: #ef4444; }
.speaker-name[data-speaker="SPEAKER_03"] { color: #a855f7; }
.speaker-name[data-speaker="SPEAKER_04"] { color: #f97316; }
.time-range { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--muted); }
.confidence-badge { font-size: 11px; padding: 2px 6px; border-radius: 3px; font-weight: 600; }
.confidence-badge.high { background: #dcfce7; color: #166534; }
.confidence-badge.medium { background: #fef3c7; color: #92400e; }
.confidence-badge.low { background: #fee2e2; color: #991b1b; }

