/* PaceCraft / GSL Fitness Audio Studio - Theme Styles */
:root {
  --bg-main: #0b0f19;
  --bg-card: #131b2e;
  --bg-card-hover: #1a243d;
  --bg-input: #090d15;
  --border-color: #23304c;
  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  /* Brand & Phase Accents */
  --volt: #e2f952;
  --volt-hover: #d2ec36;
  --phase-walk: #38bdf8;
  --phase-run: #ff603e;
  --phase-core: #10b981;
  --phase-cooldown: #a855f7;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Header & Navigation */
.app-header {
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--volt), #ff603e);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 900;
  color: #000;
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-info span {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: block;
}

.nav-tabs {
  display: flex;
  background: rgba(19, 27, 46, 0.8);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 0.25rem;
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: var(--volt);
  color: #000;
  box-shadow: 0 0 16px rgba(226, 249, 82, 0.25);
}

/* Main Container */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}

.tab-view {
  display: none;
}

.tab-view.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--volt);
  color: #000;
}
.btn-primary:hover:not(:disabled) {
  background: var(--volt-hover);
  box-shadow: 0 0 16px rgba(226, 249, 82, 0.3);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-muted);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.775rem;
}

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

/* Library View */
.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.view-head h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.view-head p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.workouts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

.workout-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.workout-card:hover {
  transform: translateY(-2px);
  border-color: rgba(226, 249, 82, 0.4);
}

.workout-card.selected {
  border-color: var(--volt);
  box-shadow: 0 0 16px rgba(226, 249, 82, 0.15);
}

.workout-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.workout-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.workout-duration {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--volt);
}

.workout-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
}

.workout-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  flex-grow: 1;
}

.workout-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.775rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
}

.workout-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Studio & Editor View */
.editor-top-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.editor-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

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

/* Interactive Timeline */
.timeline-wrapper {
  background: rgba(9, 13, 21, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.timeline-bar {
  height: 28px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  display: flex;
  overflow: hidden;
  gap: 2px;
}

.timeline-block {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s ease, filter 0.2s ease;
  position: relative;
}

.timeline-block:hover {
  filter: brightness(1.25);
}

.timeline-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.85);
  white-space: nowrap;
  pointer-events: none;
}

/* Phase Colors */
.phase-walk { background-color: var(--phase-walk); }
.phase-run { background-color: var(--phase-run); }
.phase-core { background-color: var(--phase-core); }
.phase-cooldown { background-color: var(--phase-cooldown); }

.phase-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  color: #000;
  letter-spacing: 0.04em;
}

/* Cue Cards */
.cues-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.cue-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cue-card::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.cue-card.phase-walk::before { background: var(--phase-walk); }
.cue-card.phase-run::before { background: var(--phase-run); }
.cue-card.phase-core::before { background: var(--phase-core); }
.cue-card.phase-cooldown::before { background: var(--phase-cooldown); }

.cue-card.highlight-flash {
  border-color: var(--volt);
  box-shadow: 0 0 20px rgba(226, 249, 82, 0.35);
}

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

.cue-time-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cue-time {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--volt);
}

.cue-title-area {
  flex-grow: 1;
}

.cue-title-input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  outline: none;
}
.cue-title-input:focus {
  border-bottom: 1px solid var(--volt);
}

.cue-stats {
  display: flex;
  gap: 0.5rem;
}

.stat-pill {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
}

.cue-card-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.cue-card-body .cue-field:last-child {
  grid-column: 1 / -1;
}

.cue-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cue-field input, .cue-field textarea, .phase-selector {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.cue-field textarea {
  resize: vertical;
  line-height: 1.45;
}

.cue-field input:focus, .cue-field textarea:focus {
  border-color: var(--volt);
}

.cue-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.75rem;
  gap: 1rem;
}

.cue-audio-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cue-manage-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.phase-selector {
  width: auto;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Runner Live Player View */
.player-container {
  max-width: 680px;
  margin: 1rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.player-header {
  text-align: center;
}

.player-timer-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.player-time-display {
  font-family: var(--font-mono);
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.player-sub-time {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  color: var(--text-dim);
  font-weight: 600;
}

.player-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.player-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--volt), #ff603e);
  transition: width 0.2s linear;
}

.player-segment-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.player-badge {
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.3rem 0.9rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  color: #000;
}

.player-seg-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
}

.player-target-pace {
  font-size: 0.9rem;
  color: var(--volt);
  font-weight: 600;
}

.player-transcript-card {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  font-style: italic;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.3s ease;
}

.player-transcript-card.speaking-active {
  border-color: var(--volt);
  background: rgba(226, 249, 82, 0.05);
  color: #fff;
  box-shadow: 0 0 20px rgba(226, 249, 82, 0.2);
  animation: pulseSpeaking 1.5s infinite;
}

@keyframes pulseSpeaking {
  0% { transform: scale(1); }
  50% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

.player-next-cue-info {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.btn-player-main {
  font-size: 1.15rem;
  font-weight: 800;
  padding: 1rem 2.2rem;
  border-radius: var(--radius-full);
}

.player-beat-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Forms & Settings */
.form-container {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-group .form-help {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}
.form-control:focus {
  border-color: var(--volt);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  border-left: 4px solid var(--phase-core);
}

.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-info {
  border-left: 4px solid var(--volt);
}

/* Responsive */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-tabs {
    overflow-x: auto;
  }
  .cue-card-body {
    grid-template-columns: 1fr;
  }
  .player-time-display {
    font-size: 3rem;
  }
}
