/* === BookVoicer — Dark Nebula Theme === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: hsl(260, 30%, 6%);
  --card: hsl(260, 30%, 12%);
  --border: hsl(260, 30%, 20%);
  --text: hsl(240, 20%, 95%);
  --muted: hsl(240, 10%, 60%);
  --primary: hsl(270, 70%, 65%);
  --primary-dim: hsl(270, 70%, 65% / 0.15);
  --accent: hsl(180, 60%, 55%);
  --accent-dim: hsl(180, 60%, 55% / 0.15);
  --error: hsl(0, 70%, 55%);
  --glass-bg: hsl(260, 40%, 15% / 0.35);
  --glass-border: hsl(270, 60%, 65% / 0.35);
  --glass-subtle: hsl(260, 40%, 12% / 0.25);
  --radius: 14px;
}

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

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 1.125rem;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Space Grotesk', sans-serif; margin: 0; }

/* === Animated Background === */
.nebula-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  pointer-events: none;
}

/* Stars (static) */
.star {
  position: absolute;
  width: 2px; height: 2px;
  background: #fff;
  border-radius: 50%;
  opacity: var(--opa, 0.3);
}
.star.bright {
  width: 3px; height: 3px;
  box-shadow: 0 0 6px 1px rgba(255,255,255,0.4);
}

/* === Layout === */
.app-content {
  position: relative; z-index: 10;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: 32px 16px 24px;
}

@media (min-width: 768px) {
  .app-content { padding: 48px 24px 32px; justify-content: center; }
}

/* Logo */
a.logo-row {
  text-decoration: none;
  color: inherit;
}
.logo-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
  animation: fadeIn 0.5s ease;
  cursor: pointer;
}
.logo-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--primary-dim);
  border: 1px solid hsl(270, 60%, 65% / 0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.logo-row h1 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  letter-spacing: -0.02em;
}

/* Footer */
.app-footer {
  margin-top: 24px;
  font-size: 0.75rem;
  color: hsl(240, 10%, 60% / 0.4);
}

/* === Glass Cards === */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px hsl(260, 60%, 10% / 0.4),
    inset 0 1px 0 hsl(260, 40%, 60% / 0.08);
  padding: 24px;
  width: 100%;
  max-width: 680px;
  animation: fadeIn 0.4s ease;
}

.glass-subtle {
  background: var(--glass-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid hsl(260, 40%, 50% / 0.1);
  border-radius: calc(var(--radius) - 4px);
  padding: 16px;
}

/* === Stepper === */
.stepper {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: hsl(240, 10%, 60% / 0.25);
  transition: all 0.3s;
}
.step-dot.active {
  width: 32px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 12px hsl(270, 70%, 65% / 0.4);
}
.step-dot.done {
  background: hsl(270, 70%, 65% / 0.6);
}
.step-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 8px;
}

/* === Section Headers === */
.section-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  justify-content: center;
}
.section-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary-dim);
  border: 1px solid hsl(270, 60%, 65% / 0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(240, 20%, 95% / 0.9);
}

/* === Forms === */
.form-grid {
  display: grid;
  gap: 14px;
}

label {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}

input[type="file"],
input[type="number"],
select {
  width: 100%;
  background: hsl(260, 25%, 16%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 1.05rem;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsl(270, 70%, 65% / 0.15);
}

input[type="file"] {
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid hsl(270, 60%, 65% / 0.3);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  margin-right: 10px;
}

.inline-check {
  display: flex; align-items: center; gap: 8px;
  color: var(--muted);
}
.inline-check input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--primary);
}

/* === Buttons === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.btn-primary {
  background: var(--primary);
  color: hsl(260, 30%, 6%);
}
.btn-primary:hover { background: hsl(270, 70%, 72%); }

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid hsl(270, 60%, 65% / 0.3);
}
.btn-secondary:hover { background: var(--primary-dim); }

.btn-danger {
  background: transparent;
  color: var(--error);
  border: 1px solid hsl(0, 70%, 55% / 0.3);
}
.btn-danger:hover { background: hsl(0, 70%, 55% / 0.1); }

.btn-accent {
  background: var(--accent);
  color: hsl(260, 30%, 6%);
}
.btn-accent:hover { background: hsl(180, 60%, 62%); }

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

/* === Dropzone === */
.dropzone {
  border: 1.5px dashed hsl(270, 50%, 50% / 0.3);
  border-radius: var(--radius);
  background: hsl(260, 40%, 15% / 0.2);
  min-height: 180px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: hsl(270, 60%, 60% / 0.5);
  background: hsl(260, 40%, 20% / 0.3);
  box-shadow: 0 0 40px hsl(270, 60%, 50% / 0.12);
}
.dropzone-icon {
  font-size: 48px;
  color: hsl(270, 70%, 65% / 0.6);
}
.dropzone-text {
  color: var(--muted);
  font-size: 0.9rem;
}
.dropzone-hint {
  font-size: 0.75rem;
  color: hsl(240, 10%, 60% / 0.5);
}

/* File selected state */
.file-selected {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  margin-top: 12px;
}
.file-selected .file-icon { font-size: 24px; }
.file-selected .file-name {
  flex: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-selected .file-size { color: var(--muted); font-size: 0.8rem; }
.file-selected .file-remove {
  min-width: 36px; min-height: 36px;
  background: transparent;
  border: 1px solid hsl(0, 70%, 55% / 0.3);
  border-radius: 8px;
  color: var(--error);
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}

/* === Progress === */
.progress-wrap {
  height: 12px;
  background: hsl(260, 25%, 16%);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, hsl(270, 70%, 60%), hsl(270, 70%, 50%));
  box-shadow: 0 0 12px hsl(270, 70%, 65% / 0.4);
  width: 0;
  transition: width 0.35s ease;
  border-radius: 999px;
}
.percent-text {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--primary);
  margin-top: 8px;
}

/* Status badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
}
.status-badge.running {
  background: var(--primary-dim);
  border: 1px solid hsl(270, 60%, 65% / 0.4);
  color: var(--primary);
  animation: pulse 2s ease-in-out infinite;
}
.status-badge.done {
  background: var(--accent-dim);
  border: 1px solid hsl(180, 60%, 55% / 0.4);
  color: var(--accent);
}
.status-badge.paused {
  background: hsl(40, 70%, 50% / 0.15);
  border: 1px solid hsl(40, 70%, 50% / 0.4);
  color: hsl(40, 70%, 60%);
}
.status-badge.failed {
  background: hsl(0, 70%, 55% / 0.15);
  border: 1px solid hsl(0, 70%, 55% / 0.4);
  color: var(--error);
}

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* === Actions === */
.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.actions-row .btn { width: auto; flex: 1; min-width: 120px; }

/* === Files list === */
.files-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: hsl(260, 25%, 16% / 0.5);
  border: 1px solid hsl(260, 30%, 20% / 0.5);
  transition: background 0.2s;
}
.file-item:hover { background: hsl(260, 25%, 20% / 0.5); }
.file-item .fi-icon { font-size: 20px; color: var(--primary); }
.file-item a {
  flex: 1;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}
.file-item a:hover { color: var(--primary); }
.file-item .fi-size { color: var(--muted); font-size: 0.8rem; }

/* === History Items === */
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: hsl(260, 25%, 16% / 0.5);
  border: 1px solid hsl(260, 30%, 20% / 0.5);
  margin-bottom: 8px;
}
.hi-icon {
  flex-shrink: 0;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.hi-info {
  flex: 1;
  min-width: 0;
}
.hi-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}
.hi-meta {
  font-size: 0.8rem;
}
.hi-actions {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}
.hi-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.hi-btn-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid hsl(180, 60%, 55% / 0.3);
}
.hi-btn-accent:hover { background: hsl(180, 60%, 55% / 0.25); }
.hi-btn-secondary {
  background: var(--primary-dim);
  color: var(--primary);
  border: 1px solid hsl(270, 60%, 65% / 0.3);
}
.hi-btn-secondary:hover { background: hsl(270, 70%, 65% / 0.2); }
.hi-btn-danger {
  background: transparent;
  color: var(--muted);
  border: 1px solid hsl(260, 30%, 20% / 0.3);
}
.hi-btn-danger:hover { background: hsl(0, 70%, 55% / 0.1); color: var(--error); }

/* === Error === */
.error-text {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 8px;
}

/* === Utility === */
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.gap-12 { gap: 12px; }
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: hsl(260, 25%, 16%);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--primary);
}
a { color: var(--primary); }
.hidden { display: none !important; }

/* === Animations === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === Mobile sticky actions === */
@media (max-width: 767px) {
  .glass { max-width: 100%; padding: 16px; }
  .glass-subtle { padding: 12px; }
  .dropzone { min-height: 120px; padding: 20px; }
  .dropzone-icon { font-size: 36px; }
  .actions-row { flex-direction: column; }
  .actions-row .btn { width: 100%; min-width: unset; }
  .logo-row h1 { font-size: 1.3rem; }
  .section-header h2 { font-size: 0.75rem; }
}

@media (min-width: 768px) {
  .sticky-spacer { display: none; }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}
