/* --- Reset & Variables --- */
:root {
  --bg-main: #09090b;
  --surface: #18181b;
  --surface-hover: #27272a;
  --border: #3f3f46;
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --primary: #f4f4f5;
  --primary-bg: #e4e4e7;
  --accent: #6366f1;
  --success: #10b981;
  --error: #ef4444;
  --radius: 12px;
  --font-sans: "Inter", -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4rem 1rem;
}

.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

/* --- Header --- */
.header {
  text-align: center;
  margin-bottom: 3rem;
}
.title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  letter-spacing: -0.025em;
}
.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  transition: 0.2s;
}

/* --- Input Group (Language) --- */
.input-group {
  margin-bottom: 1.5rem;
}
.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.select-wrapper {
  position: relative;
}
select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-main);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}
select:hover {
  border-color: var(--text-muted);
}
select:focus {
  outline: none;
  border-color: var(--primary);
}
.select-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  background: rgba(255, 255, 255, 0.02);
}
.drop-zone:hover {
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}
.drop-zone.drag-active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}
.drop-content {
  pointer-events: none;
}
.drop-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.drop-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.drop-info {
  color: var(--text-muted);
  font-size: 0.75rem;
  opacity: 0.6;
}

.icon-xl {
  width: 40px;
  height: 40px;
  margin-bottom: 1rem;
  color: var(--text-muted);
}
.drop-zone:hover .icon-xl {
  color: var(--text-main);
}

/* --- Process Card --- */
.process-card {
  display: none;
}
.process-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.file-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.icon-sm {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}
.filename {
  font-weight: 500;
  font-size: 0.95rem;
}

.process-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  background: var(--surface-hover);
  color: var(--text-muted);
}
.badge.active {
  color: #818cf8;
  background: rgba(99, 102, 241, 0.15);
}
.badge.completed {
  color: #34d399;
  background: rgba(52, 211, 153, 0.15);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  border-radius: 6px;
  display: flex;
}
.btn-icon svg {
  width: 18px;
  height: 18px;
}
.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}
.btn-icon.danger:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* Progress Bar */
.progress-track {
  height: 4px;
  background: var(--surface-hover);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.progress-fill {
  height: 100%;
  background: var(--text-main);
  width: 0%;
  transition: width 0.3s ease;
}

/* Timeline */
.timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
  padding: 0 0.5rem;
}
.timeline::before {
  /* Line background */
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--surface-hover);
  z-index: 0;
}
.step {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100px; /* Force width for centering */
}
.dot {
  width: 14px;
  height: 14px;
  background: var(--bg-main);
  border: 2px solid var(--border);
  border-radius: 50%;
  transition: 0.3s;
}
.label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  text-align: center;
}
/* States */
.step.active .dot {
  border-color: var(--accent);
  background: var(--bg-main);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.step.active .label {
  color: var(--text-main);
}
.step.completed .dot {
  background: var(--accent);
  border-color: var(--accent);
}
/* Fix for left/right alignment of first/last items to be mostly centered visually */
.step:first-child {
  align-items: flex-start;
  width: auto;
}
.step:last-child {
  align-items: flex-end;
  width: auto;
}

/* --- Results Section --- */
.results-section {
  display: none;
  text-align: center;
  max-width: 800px;
  width: 90%;
  margin: 2rem auto;
  padding: 2.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.checkmark {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  color: var(--success);
  filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.2));
}

.results-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.download-grid {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s;
}
.btn:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}
.btn-primary {
  background: var(--text-main);
  color: var(--bg-main);
  border-color: var(--text-main);
}
.btn-primary:hover {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
}
.btn svg {
  width: 16px;
  height: 16px;
}

/* Transcription Preview - Segmented List Style */
#transcriptionPreview {
  margin-top: 2rem;
  text-align: left;
  background: rgba(9, 9, 11, 0.5); /* Zinc-950/50 */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
#transcriptionPreview::-webkit-scrollbar {
  width: 8px;
}
#transcriptionPreview::-webkit-scrollbar-track {
  background: transparent;
}
#transcriptionPreview::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
#transcriptionPreview::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Segment Row (fallback if Tailwind fails) */
.transcript-row {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}
.transcript-row:hover {
  background: rgba(255, 255, 255, 0.02);
}
.t-time {
  color: #a78bfa; /* Violet-400 */
  font-family: monospace;
  font-size: 0.85rem;
  min-width: 70px;
  opacity: 0.7;
  padding-top: 2px;
}
.t-text {
  color: #e4e4e7; /* Zinc-200 */
  font-size: 0.95rem;
  line-height: 1.6;
}

/* History */
#historySection {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* Utils */
.pulse {
  animation: pulse 2s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}
.error-banner {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  padding: 0.75rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  text-align: center;
  font-size: 0.9rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  background-color: #34d399;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(52, 211, 153, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}
@media (max-width: 500px) {
  .drop-zone {
    padding: 2rem 1rem;
  }
  .timeline {
    display: none;
  } /* Hide complex timeline on mobile */
  .file-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2rem;
  border-radius: var(--radius);
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  animation: scaleUp 0.2s ease-out;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.modal-text {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn.danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

@keyframes scaleUp {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
