/* ===== RESET & BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f8f9fb;
  color: #1a1a2e;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px;
  position: relative;
}

/* ===== HEADER ===== */
header {
  text-align: center;
  margin-bottom: 48px;
}

header h1 {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: -0.5px;
}

.tagline {
  font-size: 15px;
  color: #6b7280;
  margin-top: 8px;
}

/* ===== VIEW STATES ===== */
.view {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view.active {
  display: block;
}

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

/* ===== BUTTONS ===== */
.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-large {
  padding: 16px 36px;
  font-size: 16px;
  width: 100%;
  margin-top: 24px;
}

.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.btn-icon:hover {
  color: #374151;
  background: #f3f4f6;
}

/* ===== UPLOAD VIEW ===== */
#drop-zone {
  border: 2px dashed #d1d5db;
  border-radius: 16px;
  padding: 64px 32px;
  text-align: center;
  background: #fff;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

#drop-zone:hover {
  border-color: #93b4f5;
  background: #f8faff;
}

#drop-zone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  border-style: solid;
}

.drop-icon {
  color: #9ca3af;
  margin-bottom: 20px;
}

.drop-primary {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.drop-secondary {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 16px;
}

.supported-formats {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 20px;
}

/* ===== READY VIEW ===== */
.file-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px 20px;
}

.file-icon {
  color: #2563eb;
  flex-shrink: 0;
}

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

.file-name {
  font-size: 15px;
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

.first-time-notice {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin-top: 12px;
  padding: 10px;
  background: #fffbeb;
  border-radius: 8px;
  border: 1px solid #fde68a;
}

/* ===== PROCESSING VIEW ===== */
.processing-card {
  text-align: center;
  padding: 64px 32px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: spin 0.8s linear infinite;
}

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

.processing-step {
  font-size: 17px;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 20px;
  transition: opacity 0.2s;
}

.progress-bar-container {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  margin: 0 auto;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #2563eb;
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}

.progress-detail {
  font-size: 13px;
  color: #9ca3af;
  margin-top: 12px;
  min-height: 20px;
}

/* ===== RESULT VIEW ===== */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.result-header h2 {
  font-size: 22px;
  font-weight: 700;
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.transcript-container {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.paragraph {
  display: flex;
  gap: 16px;
  padding: 12px 0;
}

.paragraph + .paragraph {
  border-top: 1px solid #f3f4f6;
}

.timestamp {
  font-size: 13px;
  font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, monospace;
  color: #2563eb;
  white-space: nowrap;
  padding-top: 2px;
  flex-shrink: 0;
  cursor: default;
}

.paragraph .text {
  font-size: 15px;
  line-height: 1.7;
  color: #374151;
}

/* Copy success state */
.btn-secondary.copied {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #059669;
}

/* ===== ERROR BANNER ===== */
.error-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  width: calc(100% - 48px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 100;
  animation: slideUp 0.3s ease;
}

.error-banner[hidden] {
  display: none;
}

.error-banner p {
  font-size: 14px;
  color: #991b1b;
  flex: 1;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== FOOTER ===== */
footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

footer p {
  font-size: 13px;
  color: #9ca3af;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 540px) {
  #app {
    padding: 32px 16px;
  }

  header h1 {
    font-size: 26px;
  }

  #drop-zone {
    padding: 40px 20px;
  }

  .drop-primary {
    font-size: 16px;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-actions {
    width: 100%;
  }

  .result-actions .btn-secondary,
  .result-actions .btn-primary {
    flex: 1;
  }

  .paragraph {
    flex-direction: column;
    gap: 4px;
  }

  .transcript-container {
    padding: 16px;
  }
}
