/* ═══════════════════════════════════════════════════════════════════════════
   app.css — Sistema de diseño completo para Transcriptor Groq
   Dark mode premium · Glassmorphism · Responsive · Micro-animaciones
═══════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Colors */
  --bg:          #07090f;
  --surface:     #0d1120;
  --surface-2:   #111827;
  --card:        rgba(13, 17, 32, 0.82);
  --border:      rgba(255, 255, 255, 0.07);
  --border-hover:rgba(255, 255, 255, 0.15);

  --accent:      #00e5bc;
  --accent-dim:  rgba(0, 229, 188, 0.12);
  --accent-glow: rgba(0, 229, 188, 0.3);
  --accent-2:    #6366f1;
  --accent-2-dim:rgba(99, 102, 241, 0.12);

  --text:        #e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;

  --danger:      #f87171;
  --danger-dim:  rgba(248, 113, 113, 0.12);
  --warn:        #fbbf24;
  --warn-dim:    rgba(251, 191, 36, 0.12);
  --success:     #34d399;
  --success-dim: rgba(52, 211, 153, 0.12);

  /* Radii */
  --r-sm:  8px;
  --r-md:  14px;
  --r-lg:  20px;
  --r-xl:  28px;
  --r-2xl: 36px;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
  --shadow-md:  0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg:  0 20px 50px rgba(0,0,0,0.6);
  --glow-accent:0 0 24px rgba(0,229,188,0.25);

  /* Transitions */
  --t: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --t-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Navbar */
  --nav-h: 60px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

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

.glass {
  background: var(--card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
}

/* ── Screen system ────────────────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  transition: opacity var(--t-slow), transform var(--t-slow);
}
.screen.active { opacity: 1; pointer-events: all; z-index: 10; }
.screen.hidden  { opacity: 0; pointer-events: none; z-index: 0; transform: scale(0.98); }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN
════════════════════════════════════════════════════════════════════════ */
#screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 60% 20%, #0f1f3d 0%, #07090f 60%);
}

/* Animated background orbs */
.login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
  animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 { width: 500px; height: 500px; background: #00e5bc; top: -120px; right: -100px; animation-delay: 0s; }
.orb-2 { width: 400px; height: 400px; background: #6366f1; bottom: -80px; left: -80px; animation-delay: -4s; }
.orb-3 { width: 300px; height: 300px; background: #0ea5e9; top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: -8s; }

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  33%  { transform: translateY(-30px) scale(1.05); }
  66%  { transform: translateY(20px) scale(0.97); }
}

/* Login card */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 1rem;
  padding: 2.5rem 2.5rem 2rem;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.5s var(--t-bounce) both;
}

@keyframes cardIn {
  from { transform: translateY(32px) scale(0.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.login-logo {
  font-size: 3rem;
  text-align: center;
  display: block;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 0 20px var(--accent-glow));
  animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 16px var(--accent-glow)); }
  50%       { filter: drop-shadow(0 0 32px var(--accent-glow)); }
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
  margin-bottom: 2rem;
}

.login-badge {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 1.5rem;
}

/* Error state shake */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
}
.shake { animation: shake 0.45s ease; }

/* ═══════════════════════════════════════════════════════════════════════════
   FORM ELEMENTS (shared)
════════════════════════════════════════════════════════════════════════ */
.input-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }

.input-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  padding: 0.75rem 3rem 0.75rem 1rem;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  background: rgba(0, 229, 188, 0.05);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::placeholder { color: var(--text-muted); }
.input.error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-dim); }

.select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}
.select:focus { border-color: var(--accent); }
.select option { background: var(--surface-2); color: var(--text); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t);
  outline: none;
  white-space: nowrap;
  padding: 0.55rem 1.1rem;
  text-decoration: none;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--accent-dim); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #00b89c);
  color: #07090f;
  font-weight: 700;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 28px var(--accent-glow); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }

.btn-glow { position: relative; overflow: hidden; }
.btn-glow::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s;
}
.btn-glow:hover:not(:disabled)::before { transform: translateX(100%); }

.btn-ghost {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); border-color: var(--border-hover); color: var(--text); }

.btn-danger-ghost { }
.btn-danger-ghost:hover { background: var(--danger-dim); border-color: rgba(248,113,113,0.3); color: var(--danger); }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color var(--t), background var(--t);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.btn-full { width: 100%; padding: 0.85rem 1rem; font-size: 1rem; }
.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.75rem; }

/* ── Error message ────────────────────────────────────────────────────────── */
.error-msg {
  color: var(--danger);
  font-size: 0.86rem;
  margin-bottom: 0.75rem;
  min-height: 1.2em;
  background: var(--danger-dim);
  border: 1px solid rgba(248,113,113,0.2);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.75rem;
  display: none;
}
.error-msg.visible { display: block; }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════════════════
   APP SCREEN
════════════════════════════════════════════════════════════════════════ */
#screen-app {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: rgba(7, 9, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  gap: 1rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  flex-shrink: 0;
}
.nav-icon { font-size: 1.2rem; }
.nav-title { background: linear-gradient(90deg, #fff 0%, var(--accent) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Usage pill in navbar */
.usage-pill {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: default;
}
.usage-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: dotPulse 2s ease-in-out infinite;
}
.usage-dot.warn  { background: var(--warn); }
.usage-dot.danger{ background: var(--danger); animation: none; }
@keyframes dotPulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

/* ── Main layout ──────────────────────────────────────────────────────────── */
.app-main {
  margin-top: var(--nav-h);
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - var(--nav-h));
  overflow: hidden;
}

/* ── Panels ───────────────────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.panel::-webkit-scrollbar { width: 4px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.panel-left {
  border-right: 1px solid var(--border);
  background: rgba(7, 9, 15, 0.6);
}
.panel-right { background: transparent; }

.panel-header { flex-shrink: 0; }
.panel-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.panel-sub { font-size: 0.84rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── Drop zone ────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  position: relative;
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: var(--glow-accent);
}
.drop-zone.drag-over .drop-zone-icon svg { stroke: var(--accent); transform: scale(1.1) translateY(-4px); }

.drop-zone-icon svg {
  stroke: var(--text-muted);
  transition: all var(--t-bounce);
  margin-bottom: 0.75rem;
}

.drop-zone-text {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-dim);
}
.drop-zone-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

#file-input { display: none; }

/* ── File list ────────────────────────────────────────────────────────────── */
.file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 160px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.55rem 0.75rem;
  animation: fileIn 0.25s var(--t-bounce) both;
}
@keyframes fileIn {
  from { transform: translateX(-12px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.file-icon { font-size: 1.1rem; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.85rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.75rem; color: var(--text-muted); }
.file-remove { color: var(--text-muted); padding: 0.2rem; flex-shrink: 0; transition: color var(--t); }
.file-remove:hover { color: var(--danger); }

/* ── Controls ─────────────────────────────────────────────────────────────── */
.controls { display: flex; flex-direction: column; gap: 0.75rem; flex-shrink: 0; }
.control-group { display: flex; flex-direction: column; gap: 0.35rem; }
.control-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ── Usage card ───────────────────────────────────────────────────────────── */
.usage-card {
  border-radius: var(--r-md);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: auto;
}
.usage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.usage-row:last-child { border-bottom: none; }
.usage-bar-wrap { width: 80px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.6s ease;
}
.usage-bar-fill.warn { background: var(--warn); }
.usage-bar-fill.danger { background: var(--danger); }

/* ═══════════════════════════════════════════════════════════════════════════
   RESULTS PANEL
════════════════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.75rem;
  color: var(--text-muted);
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.empty-icon { font-size: 3rem; opacity: 0.4; }
.empty-title { font-size: 1.05rem; font-weight: 600; color: var(--text-dim); }
.empty-sub { font-size: 0.88rem; text-align: center; max-width: 300px; }

.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Result card ──────────────────────────────────────────────────────────── */
.result-card {
  border-radius: var(--r-xl);
  overflow: hidden;
  animation: cardSlideIn 0.35s var(--t-bounce) both;
  box-shadow: var(--shadow-md);
}
@keyframes cardSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
}
.result-meta { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.result-name { font-weight: 700; font-size: 0.95rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-badge {
  font-size: 0.73rem;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0,229,188,0.2);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  display: inline-block;
  width: fit-content;
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.result-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  transition: color var(--t), background var(--t);
  position: relative;
}
.tab:hover { color: var(--text-dim); }
.tab.active {
  color: var(--accent);
  background: var(--accent-dim);
}
.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.tab-panel { display: none; padding: 1rem 1.25rem 1.25rem; }
.tab-panel.active { display: block; }

/* Style pills */
.style-selector { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.style-pills { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.style-pill {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--t);
}
.style-pill:hover { border-color: var(--border-hover); color: var(--text); }
.style-pill.active {
  background: var(--accent-dim);
  border-color: rgba(0,229,188,0.35);
  color: var(--accent);
}

/* Result textarea */
.result-textarea {
  width: 100%;
  min-height: 280px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.65;
  padding: 0.85rem 1rem;
  resize: vertical;
  cursor: text;
  transition: border-color var(--t);
  outline: none;
}
.result-textarea:focus { border-color: var(--border-hover); }

/* Download grid */
.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.btn-download {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 1rem 0.75rem;
  cursor: pointer;
  transition: all var(--t);
}
.btn-download:hover {
  background: var(--accent-dim);
  border-color: rgba(0,229,188,0.3);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.download-icon { font-size: 1.6rem; }

/* Details list */
.details-list { display: flex; flex-direction: column; gap: 0; }
.details-list dt {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.75rem;
}
.details-list dd {
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}
.details-list dd:first-of-type { margin-top: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   HISTORY SIDEBAR
════════════════════════════════════════════════════════════════════════ */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  transition: opacity var(--t);
}
.sidebar-overlay.visible { opacity: 1; }
.sidebar-overlay.hidden { opacity: 0; pointer-events: none; }

.history-sidebar {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 360px;
  max-width: 100vw;
  z-index: 210;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  border-radius: var(--r-xl) 0 0 var(--r-xl);
  transform: translateX(100%);
  transition: transform var(--t-slow);
  overflow: hidden;
}
.history-sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-title { font-size: 1rem; font-weight: 700; }
.sidebar-actions { display: flex; align-items: center; gap: 0.5rem; }

.history-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.history-item {
  display: flex;
  align-items: stretch;
  border-radius: var(--r-md);
  overflow: hidden;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: all var(--t);
  animation: fileIn 0.2s ease both;
}
.history-item:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.05); }

.history-btn {
  flex: 1;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--text);
}
.history-name { font-size: 0.85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-date { font-size: 0.73rem; color: var(--text-muted); }
.history-model { font-size: 0.7rem; color: var(--accent); background: var(--accent-dim); padding: 0.15rem 0.45rem; border-radius: 999px; margin-right: 0.5rem; white-space: nowrap; }

.history-delete {
  padding: 0 0.75rem;
  border-left: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-muted);
  background: none;
  border-top: none;
  border-right: none;
  border-bottom: none;
  cursor: pointer;
  transition: all var(--t);
}
.history-delete:hover { background: var(--danger-dim); color: var(--danger); }

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESS OVERLAY
════════════════════════════════════════════════════════════════════════ */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 9, 15, 0.85);
  backdrop-filter: blur(12px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.progress-overlay.hidden { display: none; }

.progress-card {
  width: 100%;
  max-width: 400px;
  margin: 1rem;
  padding: 2.5rem 2rem;
  border-radius: var(--r-xl);
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.4s var(--t-bounce) both;
}

/* Audio wave animation */
.progress-animation {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 48px;
  margin-bottom: 1.5rem;
}
.wave {
  width: 5px;
  border-radius: 3px;
  background: var(--accent);
  animation: waveAnim 1.2s ease-in-out infinite;
  box-shadow: 0 0 10px var(--accent-glow);
}
.wave-1 { height: 20px; animation-delay: 0s; }
.wave-2 { height: 40px; animation-delay: 0.2s; }
.wave-3 { height: 28px; animation-delay: 0.4s; }
@keyframes waveAnim {
  0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.progress-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.3rem; }
.progress-filename { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #00b89c);
  transition: width 0.3s ease;
  box-shadow: 0 0 8px var(--accent-glow);
  width: 0%;
}

.progress-pct { font-size: 0.85rem; font-weight: 600; color: var(--accent); margin-bottom: 0.75rem; }
.progress-hint { font-size: 0.8rem; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOASTS
════════════════════════════════════════════════════════════════════════ */
.toasts {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  color: var(--text);
  box-shadow: var(--shadow-md);
  pointer-events: all;
  animation: toastIn 0.35s var(--t-bounce) both;
  max-width: 340px;
  min-width: 220px;
}
.toast.removing { animation: toastOut 0.3s ease forwards; }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }

@keyframes toastIn {
  from { transform: translateX(100%) scale(0.9); opacity: 0; }
  to   { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

.toast-success { border-color: rgba(52,211,153,0.25); }
.toast-error   { border-color: rgba(248,113,113,0.25); }
.toast-warn    { border-color: rgba(251,191,36,0.25); }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    overflow: auto;
  }
  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
    max-height: none;
  }
  .panel-right {
    min-height: 50vh;
  }
}

@media (max-width: 600px) {
  :root { --nav-h: 54px; }

  .navbar { padding: 0 1rem; }
  .nav-title { font-size: 0.9rem; }
  .usage-pill { display: none; }
  .hide-mobile { display: none; }

  .login-card { padding: 2rem 1.5rem; }
  .login-title { font-size: 1.3rem; }

  .panel { padding: 1rem; }

  .download-grid { grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }

  .history-sidebar { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; top: auto; height: 75vh; }

  .toasts { right: 1rem; bottom: 1rem; left: 1rem; }
  .toast { max-width: 100%; }
}

@media (max-width: 400px) {
  .control-row { grid-template-columns: 1fr; }
}
