/* ═══════════════════════════════════════════════
   Voice Training Studio - Styles
   Clean, mobile-first, professional
   ═══════════════════════════════════════════════ */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --success: #22c55e;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 120px; /* Space for fixed controls */
}

/* ─── Header ──────────────────────────────────── */

header {
  text-align: center;
  padding: 24px 0 16px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--primary);
}

.logo h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.subtitle {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ─── Cards ───────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* ─── Speaker Setup ───────────────────────────── */

#speaker-setup label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

#speaker-name {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

#speaker-name:focus {
  outline: none;
  border-color: var(--primary);
}

/* ─── Language Selector ───────────────────────── */

#lang-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.lang-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.lang-btn:hover {
  border-color: var(--primary-light);
}

.lang-btn.active {
  border-color: var(--primary);
  background: #eef2ff;
  color: var(--primary-dark);
  font-weight: 600;
}

/* ─── Section Navigation ──────────────────────── */

#section-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

#section-nav button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

#section-nav button:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: var(--primary-light);
}

#section-nav button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#section-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ─── Section Header ──────────────────────────── */

#section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

#section-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: #eef2ff;
  color: var(--primary);
  font-weight: 500;
}

/* ─── Text Display ────────────────────────────── */

#text-display {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  max-height: 50vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  scroll-behavior: smooth;
}

#text-content p {
  font-size: 1.25rem;
  line-height: 1.9;
  color: var(--text);
  margin-bottom: 20px;
  text-align: justify;
}

#text-content p:last-child {
  margin-bottom: 0;
}

/* Mobile: larger text for better readability */
@media (max-width: 640px) {
  #text-content p {
    font-size: 1.15rem;
    line-height: 1.8;
    text-align: left;
  }

  #text-display {
    max-height: 40vh;
    padding: 18px;
  }
}

/* ─── Recording Controls (Fixed at bottom) ───── */

#controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}

#timer {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  letter-spacing: 0.05em;
}

#control-buttons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.control-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow-lg);
}

.record-idle {
  background: var(--primary);
  color: white;
}

.record-idle:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.record-idle:active {
  transform: scale(0.95);
}

.recording {
  background: var(--danger);
  color: white;
  animation: pulse 1.5s ease-in-out infinite;
}

.recording:hover {
  background: var(--danger-dark);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

#status-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

#status-text.recording-status {
  color: var(--danger);
  font-weight: 600;
}

/* ─── Preview ─────────────────────────────────── */

#preview {
  margin-bottom: 16px;
}

#preview audio {
  width: 100%;
  margin-bottom: 12px;
}

.preview-info {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

#upload-controls {
  display: flex;
  gap: 10px;
}

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  background: #f1f5f9;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
  width: 0%;
}

#progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ─── Success Message ─────────────────────────── */

.success {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--success);
  font-weight: 600;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

/* ─── Recordings List ─────────────────────────── */

#recordings-list {
  list-style: none;
}

#recordings-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

#recordings-list li:last-child {
  border-bottom: none;
}

.recording-name {
  font-weight: 500;
  color: var(--text);
}

.recording-meta {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

#no-recordings {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-style: italic;
}

/* ─── Tips ────────────────────────────────────── */

#tips ul {
  list-style: none;
  padding: 0;
}

#tips li {
  padding: 6px 0;
  padding-left: 24px;
  position: relative;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

#tips li::before {
  content: "•";
  position: absolute;
  left: 8px;
  color: var(--primary);
  font-weight: 700;
}

/* ─── Invite Banner ──────────────────────────── */

.invite-banner {
  background: #eef2ff;
  border-color: var(--primary-light);
}

.invite-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.invite-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.invite-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.invite-notes {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* ─── Section Progress Dots ──────────────────── */

#section-progress {
  margin-bottom: 12px;
}

.progress-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.progress-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.progress-dot.current {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.progress-dot.completed {
  background: var(--success);
  border-color: var(--success);
  color: white;
}
