/* style.css — RockRun shared styles */
/* Dark rock theme, mobile-first */

/* ─── CSS variables ──────────────────────────────────────────────────────────── */
:root {
  --bg:          #0d0d0d;
  --bg-card:     #1a1a1a;
  --bg-elevated: #252525;
  --accent:      #ff3d00;
  --accent-soft: #ff6b3d;
  --text:        #f0f0f0;
  --text-muted:  #888;
  --border:      #2a2a2a;
  --green:       #22c55e;
  --yellow:      #eab308;
  --orange:      #f97316;
  --red:         #ef4444;
  --radius:      12px;
}

/* ─── Reset & base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body  {
  background:  var(--bg);
  color:       var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height:  100dvh;
  line-height: 1.5;
}
a              { color: var(--accent-soft); text-decoration: none; }
a:hover        { text-decoration: underline; }
button         { cursor: pointer; font-family: inherit; }
img            { display: block; }

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.page {
  max-width: 480px;
  margin:    0 auto;
  padding:   24px 16px;
}

/* ─── App header ─────────────────────────────────────────────────────────────── */
.app-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  margin-bottom:   32px;
}
.logo {
  font-size:      1.6rem;
  font-weight:    900;
  letter-spacing: -0.02em;
  color:          var(--accent);
  text-transform: uppercase;
}
.logo span { color: var(--text); }

.header-nav a {
  font-size:     0.85rem;
  color:         var(--text-muted);
  padding:       6px 12px;
  border-radius: 8px;
  transition:    background 0.15s;
}
.header-nav a:hover { background: var(--bg-card); text-decoration: none; }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background:    var(--bg-card);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       20px;
  margin-bottom: 16px;
}

/* ─── Form elements ──────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 20px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display:        block;
  font-size:      0.72rem;
  font-weight:    600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color:          var(--text-muted);
  margin-bottom:  8px;
}

.form-value {
  font-size:     1.1rem;
  font-weight:   600;
  color:         var(--accent-soft);
  margin-bottom: 6px;
}

/* Range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance:   none;
  width:        100%;
  height:       6px;
  background:   var(--bg-elevated);
  border-radius: 3px;
  outline:      none;
  cursor:       pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width:        20px;
  height:       20px;
  border-radius: 50%;
  background:   var(--accent);
  cursor:       pointer;
  transition:   transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb {
  width:        20px;
  height:       20px;
  border:       none;
  border-radius: 50%;
  background:   var(--accent);
  cursor:       pointer;
}

/* Segmented selector (intensity / genre) */
.selector-group {
  display:   flex;
  gap:       8px;
  flex-wrap: wrap;
}
.selector-btn {
  flex:          1;
  min-width:     fit-content;
  padding:       10px 14px;
  background:    var(--bg-elevated);
  border:        2px solid transparent;
  border-radius: 8px;
  color:         var(--text);
  font-size:     0.88rem;
  font-weight:   600;
  transition:    all 0.15s;
}
.selector-btn:hover  { border-color: var(--text-muted); }
.selector-btn.active {
  border-color: var(--accent);
  background:   rgba(255, 61, 0, 0.12);
  color:        var(--accent-soft);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             8px;
  padding:         14px 24px;
  border-radius:   10px;
  border:          none;
  font-size:       1rem;
  font-weight:     700;
  transition:      all 0.15s;
  width:           100%;
}
.btn-primary             { background: var(--accent); color: #fff; }
.btn-primary:hover       { background: var(--accent-soft); transform: translateY(-1px); }
.btn-primary:active      { transform: translateY(0); }
.btn-primary:disabled    { background: #333; color: #666; cursor: not-allowed; transform: none; }

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

.btn-spotify             { background: #1DB954; color: #fff; }
.btn-spotify:hover       { background: #1ed760; }
.btn-spotify:disabled    { background: #1a6e36; cursor: not-allowed; }

.btn-danger              { background: transparent; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover        { background: rgba(239, 68, 68, 0.1); }

/* ─── BPM range sliders ──────────────────────────────────────────────────────── */
.bpm-range-display {
  font-size:     1.1rem;
  font-weight:   600;
  color:         var(--accent-soft);
  margin-bottom: 10px;
}
.bpm-slider-row {
  display:     flex;
  align-items: center;
  gap:         10px;
  margin-bottom: 6px;
}
.bpm-slider-label {
  font-size:   0.72rem;
  font-weight: 600;
  color:       var(--text-muted);
  width:       28px;
  flex-shrink: 0;
}
.bpm-slider-row input[type="range"] { flex: 1; }

/* ─── Login screen ───────────────────────────────────────────────────────────── */
.login-section {
  text-align: center;
  padding:    48px 0;
}
.login-logo {
  font-size:      2.4rem;
  font-weight:    900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color:          var(--accent);
  margin-bottom:  4px;
}
.login-logo span   { color: var(--text); }
.login-tagline     { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 36px; }
.login-section .btn { max-width: 260px; margin: 0 auto; }

/* ─── Session screen layout ──────────────────────────────────────────────────── */
.session-page {
  display:        flex;
  flex-direction: column;
  min-height:     100dvh;
  padding:        16px;
  max-width:      480px;
  margin:         0 auto;
}
.session-header {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  margin-bottom:   12px;
}
.session-logo {
  font-size:      1rem;
  font-weight:    900;
  color:          var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Countdown timer */
.timer-display {
  font-size:           clamp(4rem, 20vw, 6rem);
  font-weight:         900;
  letter-spacing:      -0.03em;
  text-align:          center;
  color:               var(--text);
  line-height:         1;
  margin:              12px 0;
  font-variant-numeric: tabular-nums;
}

/* Session progress bar */
.progress-track {
  height:        4px;
  background:    var(--bg-elevated);
  border-radius: 2px;
  overflow:      hidden;
  margin-bottom: 20px;
}
#progress-bar {
  height:     100%;
  background: var(--accent);
  width:      0%;
  transition: width 1s linear;
}

/* Current track card */
.track-card {
  background:    var(--bg-card);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       16px;
  display:       flex;
  gap:           14px;
  align-items:   center;
  margin-bottom: 16px;
}
.track-art {
  width:         72px;
  height:        72px;
  border-radius: 8px;
  object-fit:    cover;
  background:    var(--bg-elevated);
  flex-shrink:   0;
}
.track-info   { flex: 1; min-width: 0; }
.track-name   { font-size: 1rem;    font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-bpm    { font-size: 1.4rem;  font-weight: 900; color: var(--accent-soft); margin-top: 4px; }

/* Coaching cue */
.coaching-cue {
  font-size:     clamp(1.2rem, 5vw, 1.8rem);
  font-weight:   800;
  text-align:    center;
  padding:       16px 8px;
  transition:    color 0.4s;
  margin-bottom: 12px;
  min-height:    60px;
}

/* Next Up card */
.next-up-card {
  background:    rgba(255, 61, 0, 0.07);
  border:        1px solid rgba(255, 61, 0, 0.22);
  border-radius: var(--radius);
  padding:       14px;
  margin-bottom: 12px;
  animation:     slideIn 0.3s ease;
}
.next-up-label {
  font-size:      0.68rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color:          var(--accent-soft);
  margin-bottom:  5px;
}
.next-up-name {
  font-weight:   700;
  font-size:     0.95rem;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
}
.next-up-meta {
  font-size: 0.82rem;
  color:     var(--text-muted);
  margin-top: 2px;
}

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

/* ─── Post-session overlay ───────────────────────────────────────────────────── */
.overlay {
  position:        fixed;
  inset:           0;
  background:      rgba(0, 0, 0, 0.88);
  display:         flex;
  align-items:     flex-end;
  justify-content: center;
  z-index:         100;
}
.overlay-sheet {
  background:    var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding:       28px 20px 44px;
  width:         100%;
  max-width:     480px;
  animation:     slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.overlay-title {
  font-size:     1.4rem;
  font-weight:   800;
  text-align:    center;
  margin-bottom: 20px;
}
.session-stats {
  display:               grid;
  grid-template-columns: repeat(2, 1fr);
  gap:                   12px;
  margin-bottom:         24px;
}
.stat-box {
  background:    var(--bg-elevated);
  border-radius: 10px;
  padding:       14px;
  text-align:    center;
}
.stat-value {
  font-size:   1.3rem;
  font-weight: 800;
  color:       var(--accent-soft);
}
.stat-label {
  font-size:      0.7rem;
  color:          var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top:     2px;
}
.overlay-actions { display: flex; flex-direction: column; gap: 10px; }

/* ─── History screen ─────────────────────────────────────────────────────────── */
.history-card {
  background:    var(--bg-card);
  border:        1px solid var(--border);
  border-radius: var(--radius);
  padding:       16px;
  margin-bottom: 12px;
}
.history-date { font-weight: 600; font-size: 0.95rem; margin-bottom: 8px; }
.history-meta {
  display:     flex;
  flex-wrap:   wrap;
  gap:         8px;
  align-items: center;
  font-size:   0.85rem;
  color:       var(--text-muted);
}
.badge {
  padding:        3px 10px;
  border-radius:  20px;
  background:     var(--bg-elevated);
  font-size:      0.76rem;
  font-weight:    600;
  text-transform: capitalize;
  color:          var(--text);
}
.badge.intensity-easy     { color: var(--green);  background: rgba(34,  197, 94,  0.12); }
.badge.intensity-moderate { color: var(--yellow); background: rgba(234, 179, 8,   0.12); }
.badge.intensity-hard     { color: var(--red);    background: rgba(239, 68,  68,  0.12); }

.playlist-link {
  display:    inline-block;
  margin-top: 10px;
  font-size:  0.82rem;
  color:      #1DB954;
}

/* Track list (collapsible) */
.track-list {
  margin-top: 10px;
}
.track-list summary {
  font-size:   0.82rem;
  color:       var(--text-muted);
  cursor:      pointer;
  user-select: none;
  padding:     4px 0;
}
.track-list summary:hover { color: var(--text); }
.track-list-items {
  margin:      8px 0 4px 16px;
  padding:     0;
  list-style:  decimal;
}
.track-list-items li {
  font-size:    0.82rem;
  padding:      3px 0;
  border-bottom: 1px solid var(--border);
  color:         var(--text);
}
.track-list-items li:last-child { border-bottom: none; }
.track-album { color: var(--text-muted); font-size: 0.78rem; }

/* ─── Utility ────────────────────────────────────────────────────────────────── */
.hidden        { display: none !important; }
.mt-4          { margin-top: 16px; }
.mt-2          { margin-top: 8px; }
.text-muted    { color: var(--text-muted); }
.text-center   { text-align: center; }
.section-title {
  font-size:      0.85rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color:          var(--text-muted);
  margin-bottom:  16px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (min-width: 480px) {
  .page, .session-page { padding: 32px 24px; }
  .timer-display       { font-size: 7rem; }
}
