:root {
  --font-sans: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', ui-monospace, monospace;
  --bg-dark: #0b0f14;
  --bg-card: rgba(16, 22, 30, 0.82);
  --bg-card-hover: rgba(22, 30, 40, 0.92);
  --border-glass: rgba(255, 255, 255, 0.08);
  --text-primary: #e8eef6;
  --text-secondary: #9aa8b6;
  --accent-primary: #22d3ee;
  --accent-secondary: #4ade80;
  --accent-success: #22c55e;
  --accent-error: #ef4444;
  --terminal-bg: #0a120f;
  --terminal-border: rgba(34, 211, 238, 0.2);
  --terminal-text: #c7f9cc;
  --radius: 16px;
  --radius-sm: 8px;
}

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

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

/* Background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(34, 211, 238, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(74, 222, 128, 0.12) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 2rem;
  backdrop-filter: blur(20px);
  margin-bottom: 1.5rem;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.05);
}

.drop-zone-content .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.drop-zone-content p {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.drop-zone-content .or {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
}
.file-input-label {
  position: relative;
  display: inline-block;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-spinner {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  display: none;
  animation: spin 0.9s linear infinite;
}

.btn.loading .btn-spinner {
  display: inline-block;
}

.upload-status {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

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

.btn-primary:hover {
  background: var(--accent-secondary);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-large {
  width: 100%;
  padding: 1rem;
  margin-top: 1.5rem;
  font-size: 1rem;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

.btn-icon:hover {
  color: var(--text-primary);
}

/* File Info */
.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

#file-name {
  font-weight: 500;
}

/* Progress */
.progress-content {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
  padding: 2rem;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.status-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 999px;
  background: var(--accent-secondary);
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.8);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.35);
    opacity: 0.6;
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
}

#progress-text {
  color: var(--text-primary);
}

.elapsed {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

#elapsed-time {
  color: var(--text-primary);
}

.terminal {
  border-radius: 14px;
  border: 1px solid var(--terminal-border);
  background: var(--terminal-bg);
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(3, 7, 18, 0.35);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
}

.terminal-dots {
  display: inline-flex;
  gap: 0.35rem;
}

.terminal-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  opacity: 0.9;
}

.terminal-dot.dot-close {
  background: #f97316;
}

.terminal-dot.dot-min {
  background: #facc15;
}

.terminal-dot.dot-max {
  background: #22c55e;
}

.terminal-title {
  font-weight: 600;
}

.terminal-log {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  padding: 0.85rem 1rem 1.1rem;
  color: var(--terminal-text);
  height: 240px;
  overflow-y: auto;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.02) 0px,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 2px,
      transparent 6px
    );
}

.terminal-line {
  white-space: pre-wrap;
}

.terminal-line.success {
  color: #7ee787;
}

.terminal-line.warn {
  color: #fcd34d;
}

.terminal-line.error {
  color: #f87171;
}

.progress-details {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-primary);
  transition: width 0.3s ease;
}

.progress-count {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  min-height: 1rem;
  font-family: var(--font-mono);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover {
  border-color: var(--accent-primary);
}

.tab.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* Result Panels */
.result-panel {
  max-height: 60vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.panel-header h2 {
  flex: 1;
  font-size: 1.125rem;
  font-weight: 600;
}

.speakers {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.speaker-tag {
  padding: 0.25rem 0.75rem;
  background: rgba(34, 211, 238, 0.18);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent-primary);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
}

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

.content::-webkit-scrollbar-track {
  background: transparent;
}

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

.content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Transcript styling */
.transcript {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
}

/* Markdown styling */
.markdown h1 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.markdown h2 {
  font-size: 1.125rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent-secondary);
}

.markdown p {
  margin-bottom: 0.75rem;
}

.markdown ul,
.markdown ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.markdown li {
  margin-bottom: 0.25rem;
}

.markdown strong {
  color: var(--text-primary);
}

.markdown code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.875em;
}

/* Checkbox styling */
.markdown input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: var(--accent-primary);
}

/* Error */
.error {
  border-color: var(--accent-error);
  background: rgba(239, 68, 68, 0.1);
}

.error p {
  margin-bottom: 1rem;
}

/* New upload button */
#new-upload-btn {
  width: 100%;
  margin-top: 1rem;
}

/* Utility */
.hidden {
  display: none !important;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 3rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: 1rem;
  }

  header h1 {
    font-size: 1.75rem;
  }

  .card {
    padding: 1.5rem;
  }

  .drop-zone {
    padding: 2rem 1rem;
  }

  .terminal-log {
    height: 200px;
  }
}

/* Login */
.login-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
}

.login-content .icon {
  font-size: 3rem;
}

.login-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

.login-subtitle {
  color: var(--text-secondary);
}

.password-input {
  width: 100%;
  max-width: 300px;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  text-align: center;
}

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

.login-error {
  color: var(--accent-error);
  font-size: 0.875rem;
}

/* Audio Players */
.audio-players {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.audio-player-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-glass);
}

.audio-player-item .speaker-name {
  font-weight: 600;
  color: var(--accent-secondary);
  font-size: 0.875rem;
}

.audio-player-item audio {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-sm);
}

/* Custom audio styling for dark mode */
.audio-player-item audio::-webkit-media-controls-panel {
  background: rgba(255, 255, 255, 0.05);
}
