/* ============================
   WHISPER API - Clean Interface
   ============================ */

:root {
  /* Color Palette */
  --bg-primary: #0a0b0e;
  --bg-secondary: #12141a;
  --bg-card: #16181f;
  --bg-elevated: #1e2029;
  --bg-hover: #252830;
  
  --accent: #10b981;
  --accent-light: #34d399;
  --accent-glow: rgba(16, 185, 129, 0.15);
  --accent-subtle: rgba(16, 185, 129, 0.08);
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  --border: #27272a;
  --border-light: #3f3f46;
  
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  
  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  
  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: 200ms ease;
}

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

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 100% 100%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* ============================
   Layout
   ============================ */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main {
  flex: 1;
  padding: var(--space-xl);
  display: flex;
  justify-content: center;
}

.container-centered {
  width: 100%;
  max-width: 520px;
}

.container-wide {
  width: 100%;
  max-width: 1200px;
}

/* ============================
   Header
   ============================ */

.header {
  background: rgba(18, 20, 26, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) var(--space-xl);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav {
  display: flex;
  gap: var(--space-sm);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.nav-link:hover, .nav-link.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent);
}

.nav-link svg {
  width: 18px;
  height: 18px;
}

/* ============================
   Cards
   ============================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

.card-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.card-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.card-header p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ============================
   Dropzone
   ============================ */

.dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-2xl);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-elevated);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.dropzone-icon svg {
  width: 32px;
  height: 32px;
}

.dropzone-text {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.dropzone-subtext {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.dropzone-link {
  color: var(--accent);
  text-decoration: underline;
}

/* File Preview */
.file-preview {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.file-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.file-icon {
  width: 48px;
  height: 48px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-primary);
  flex-shrink: 0;
}

.file-icon svg {
  width: 24px;
  height: 24px;
}

.file-details {
  flex: 1;
  min-width: 0;
}

.file-name {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.file-remove {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.file-remove:hover {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

.file-remove svg {
  width: 18px;
  height: 18px;
}

/* ============================
   Options
   ============================ */

.options-simple {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.option-row label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.option-row input[type="number"] {
  width: 80px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 1rem;
  text-align: center;
}

.option-row input[type="text"] {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
}

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

.option-hint {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: var(--space-sm) 0;
}

.option-hint svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.option-hint.disabled {
  color: var(--text-muted);
  opacity: 0.6;
}

/* ============================
   Submit Button
   ============================ */

.submit-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  margin-top: var(--space-lg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: var(--bg-primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: all var(--transition);
}

.submit-btn:hover:not(:disabled) {
  background: var(--accent-light);
  transform: translateY(-2px);
}

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

.submit-btn svg {
  width: 20px;
  height: 20px;
}

/* ============================
   Processing Card
   ============================ */

.processing-card {
  text-align: center;
}

.processing-animation {
  margin-bottom: var(--space-xl);
}

.sound-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 60px;
}

.sound-wave span {
  width: 6px;
  background: var(--accent);
  border-radius: 3px;
  animation: wave 1s ease-in-out infinite;
}

.sound-wave span:nth-child(1) { animation-delay: 0s; height: 20px; }
.sound-wave span:nth-child(2) { animation-delay: 0.1s; height: 35px; }
.sound-wave span:nth-child(3) { animation-delay: 0.2s; height: 50px; }
.sound-wave span:nth-child(4) { animation-delay: 0.3s; height: 35px; }
.sound-wave span:nth-child(5) { animation-delay: 0.4s; height: 20px; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.5); }
}

.processing-card h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-xs);
}

.processing-step {
  color: var(--accent);
  font-weight: 500;
  margin-bottom: var(--space-xl);
}

/* Progress Bar */
.progress-container {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
  width: 0%;
}

.progress-percent {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 45px;
  text-align: right;
}

/* Logs */
.logs-details {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.logs-details summary {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--text-muted);
  list-style: none;
}

.logs-details summary::-webkit-details-marker {
  display: none;
}

.logs-container {
  max-height: 150px;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.8;
  background: var(--bg-primary);
}

.log-line {
  color: var(--text-muted);
}

/* ============================
   Result Card
   ============================ */

.result-card {
  text-align: center;
}

.result-header {
  margin-bottom: var(--space-xl);
}

.result-success {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-md);
  background: var(--accent-subtle);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.result-success svg {
  width: 32px;
  height: 32px;
}

.result-header h2 {
  font-size: 1.25rem;
}

.result-content {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  max-height: 300px;
  overflow-y: auto;
  text-align: left;
  font-size: 0.9375rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Action Buttons */
.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-decoration: none;
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

.action-btn.primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.action-btn.primary:hover {
  background: var(--accent-light);
}

.action-btn.secondary {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.action-btn.secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

/* ============================
   CR Generator
   ============================ */

.cr-generator {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border);
}

.cr-generator-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  text-align: left;
}

.cr-generator-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent-subtle), rgba(59, 130, 246, 0.1));
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.cr-generator-icon svg {
  width: 22px;
  height: 22px;
}

.cr-generator-title h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.cr-generator-title p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.cr-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.cr-form-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  text-align: left;
}

.cr-form-row label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.cr-form-row label svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.cr-form-row input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all var(--transition);
}

.cr-form-row input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
}

.cr-form-row input::placeholder {
  color: var(--text-muted);
}

.cr-form-row input[type="date"] {
  cursor: pointer;
}

.cr-form-row input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
}

.cr-copy-btn {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.cr-copy-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  opacity: 0;
  transition: opacity var(--transition);
}

.cr-copy-btn:hover::before {
  opacity: 1;
}

.cr-copy-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.3);
}

.cr-copy-btn:active {
  transform: translateY(0);
}

.cr-copy-btn svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
}

.cr-copy-btn span {
  position: relative;
  z-index: 1;
}

.cr-copy-btn.copied {
  background: var(--success);
}

.cr-copy-btn.copied::before {
  opacity: 0;
}

.cr-copy-btn .icon-check {
  display: none;
}

.cr-copy-btn.copied .icon-copy {
  display: none;
}

.cr-copy-btn.copied .icon-check {
  display: block;
}

/* ============================
   Error Card
   ============================ */

.error-card {
  text-align: center;
}

.error-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-lg);
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid var(--error);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--error);
}

.error-icon svg {
  width: 32px;
  height: 32px;
}

.error-card h2 {
  margin-bottom: var(--space-sm);
}

.error-card p {
  color: var(--text-muted);
  margin-bottom: var(--space-xl);
}

/* ============================
   History Page
   ============================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.page-header h1 {
  font-size: 1.5rem;
}

.refresh-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition);
}

.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.refresh-btn svg {
  width: 18px;
  height: 18px;
}

.refresh-btn.spinning svg {
  animation: spin 0.5s linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Jobs Grid */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md);
}

.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  cursor: pointer;
  transition: all var(--transition);
}

.job-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.job-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.job-card-date {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.job-card-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.job-card-status.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.job-card-status.running {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
}

.job-card-status.failed {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.job-card-status.pending {
  background: rgba(113, 113, 122, 0.15);
  color: var(--text-muted);
}

.job-card-preview {
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.job-card-id {
  margin-top: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.empty-state p {
  margin-bottom: var(--space-xl);
}

.empty-state .action-btn {
  display: inline-flex;
}

/* ============================
   Modal
   ============================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  animation: modalIn 0.3s ease;
}

.modal-large {
  max-width: 700px;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.125rem;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: var(--space-lg);
}

.job-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.job-status-badge {
  display: inline-flex;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
}

.job-status-badge.completed {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.job-meta-inline {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.modal-actions {
  margin-top: var(--space-lg);
}

/* ============================
   Responsive
   ============================ */

@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    gap: var(--space-md);
  }
  
  .main {
    padding: var(--space-md);
  }
  
  .card {
    padding: var(--space-lg);
  }
  
  .result-actions {
    flex-direction: column;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-elevated);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
