/* ═══════════════════════════════════════════════════════════════════════════
   Radio Orlicko DVR – Stylesheet
   Paleta: tmavé pozadí + oranžový akcent (#f47b20) + bílý text
   Font: Barlow Condensed (headings) + Inter (tělo)
═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,400;0,600;0,700;0,800;1,600&family=Inter:wght@300;400;500;600&display=swap');

/* ── Proměnné ──────────────────────────────────────────────────────────── */
:root {
  --bg:           #0f0f12;
  --bg-surface:   #17171c;
  --bg-raised:    #1f1f27;
  --bg-hover:     #26262f;
  --accent:       #f47b20;
  --accent-dim:   rgba(244, 123, 32, 0.18);
  --accent-glow:  rgba(244, 123, 32, 0.35);
  --accent-dark:  #c4620f;
  --text:         #f0f0f5;
  --text-mid:     #9090a8;
  --text-dim:     #55556a;
  --border:       rgba(255,255,255,0.07);
  --border-mid:   rgba(255,255,255,0.12);
  --radius:       10px;
  --radius-sm:    6px;
  --shadow:       0 4px 24px rgba(0,0,0,0.5);
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────────────────── */
.app-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ── Header ────────────────────────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-badge {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: #fff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.logo-text .name {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: 0.5px;
}
.logo-text .tagline {
  font-size: 0.7rem;
  color: var(--text-mid);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Live / Rec badge ──────────────────────────────────────────────────── */
#live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: background 0.3s, color 0.3s;
}

#live-badge.is-live {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.3);
}
#live-badge.is-live .dot { background: #f87171; animation: blink 1.2s infinite; }

#live-badge.is-rec {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(244, 123, 32, 0.3);
}
#live-badge.is-rec .dot { background: var(--accent); }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Go Live tlačítko ──────────────────────────────────────────────────── */
#go-live-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
#go-live-btn:hover { background: var(--accent-dark); transform: scale(1.03); }
#go-live-btn svg { width: 13px; height: 13px; }

/* ── Player Card ───────────────────────────────────────────────────────── */
.player-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin: 20px 0 0;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Artwork / waveform vizuál */
.player-art {
  width: 72px;
  height: 72px;
  background: var(--bg-raised);
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.player-art .waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
}
.player-art .waveform span {
  width: 3px;
  background: var(--accent);
  border-radius: 3px;
  transform-origin: bottom;
  opacity: 0.85;
}
/* Animace vlnek – aktivní jen při přehrávání */
body.playing .waveform span:nth-child(1) { animation: wave 1.1s 0.0s ease-in-out infinite alternate; }
body.playing .waveform span:nth-child(2) { animation: wave 1.1s 0.15s ease-in-out infinite alternate; }
body.playing .waveform span:nth-child(3) { animation: wave 1.1s 0.3s ease-in-out infinite alternate; }
body.playing .waveform span:nth-child(4) { animation: wave 1.1s 0.45s ease-in-out infinite alternate; }
body.playing .waveform span:nth-child(5) { animation: wave 1.1s 0.6s ease-in-out infinite alternate; }
body.playing .waveform span:nth-child(6) { animation: wave 1.1s 0.0s ease-in-out infinite alternate; }
body.playing .waveform span:nth-child(7) { animation: wave 1.1s 0.2s ease-in-out infinite alternate; }

@keyframes wave {
  from { height: 8px; }
  to   { height: 100%; }
}

/* Waveform bary – výchozí výšky */
.waveform span:nth-child(1) { height: 14px; }
.waveform span:nth-child(2) { height: 28px; }
.waveform span:nth-child(3) { height: 36px; }
.waveform span:nth-child(4) { height: 24px; }
.waveform span:nth-child(5) { height: 36px; }
.waveform span:nth-child(6) { height: 20px; }
.waveform span:nth-child(7) { height: 12px; }

/* Now-playing info */
.np-info {
  flex: 1;
  min-width: 0;
}
.np-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.np-artist {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-show {
  font-size: 0.75rem;
  color: var(--text-mid);
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.np-show span {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
}

/* Ovládací tlačítka */
.player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ctrl-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.2s;
  font-size: 1.1rem;
}

.ctrl-btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 18px var(--accent-glow);
}
.ctrl-btn.primary:hover { background: var(--accent-dark); transform: scale(1.07); }

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

/* ── Timeline section ──────────────────────────────────────────────────── */
.timeline-section {
  margin-top: 18px;
}

.timeline-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-mid);
}

.tl-time-window {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Vnější obal timelines */
.timelines-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

/* Sdílené nastavení řádku */
.tl-row-wrap {
  position: relative;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.tl-row-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
  z-index: 5;
  pointer-events: none;
}

/* Vnitřní dráha – relativní pozicování bloků */
.tl-track {
  position: relative;
  height: 52px;
  margin-left: 4px;
}

/* Bloky pořadů */
.tl-block {
  position: absolute;
  top: 6px;
  height: 40px;
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 8px;
  min-width: 2px;
  user-select: none;
}
.tl-block:hover { filter: brightness(1.2); transform: scaleY(1.04); z-index: 10; }

.tl-block.show {
  background: linear-gradient(135deg, #2a3a8a 0%, #1e2d7a 100%);
  border: 1px solid rgba(100, 130, 220, 0.35);
}
.tl-block.show-default {
  background: var(--bg-raised);
  border: 1px dashed var(--border-mid);
  cursor: default;
}
.tl-block.show-default:hover { filter: none; transform: none; }

.tl-block.song {
  background: linear-gradient(135deg, rgba(244,123,32,0.25) 0%, rgba(180,80,10,0.25) 100%);
  border: 1px solid rgba(244,123,32,0.35);
}
.tl-block.song:hover { border-color: var(--accent); }

/* Highlight pro aktuálně hraný blok */
.tl-block.is-current {
  box-shadow: 0 0 0 2px var(--accent), inset 0 0 0 1px rgba(244,123,32,0.3);
}

.block-primary {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.block-secondary {
  font-size: 0.65rem;
  color: var(--text-mid);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Playhead – pozice přehrávání */
#playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  z-index: 20;
  pointer-events: none;
  transition: left 0.5s linear;
}
#playhead::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-glow);
}

/* Časová osa – spodní lišta */
.tl-time-axis {
  position: relative;
  height: 30px;
  padding: 0 16px;
  margin-left: 4px;
  display: flex;
  align-items: center;
}

.tl-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--text-dim);
  white-space: nowrap;
  top: 50%;
  transform: translateX(-50%) translateY(-50%);
}
.tl-tick::before {
  content: '';
  display: block;
  width: 1px;
  height: 4px;
  background: var(--border-mid);
  margin: 0 auto 3px;
}

.tl-tick.now-tick {
  color: var(--accent);
  font-weight: 600;
}

/* Svislé oddělovače hodin */
.tl-hour-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  pointer-events: none;
}

/* ── Status bar ──────────────────────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 0;
  font-size: 0.72rem;
  color: var(--text-dim);
}
.status-bar strong { color: var(--text-mid); }

/* ── Loading overlay ─────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  transition: opacity 0.4s;
}
#loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loader-logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 800;
  font-size: 2rem;
  color: var(--accent);
  letter-spacing: 1px;
}
.loader-spin {
  width: 32px; height: 32px;
  border: 3px solid var(--border-mid);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loader-msg {
  font-size: 0.8rem;
  color: var(--text-mid);
}

/* ── Error toast ─────────────────────────────────────────────────────── */
#error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #3a1010;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.82rem;
  z-index: 200;
  transition: transform 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
#error-toast.show { transform: translateX(-50%) translateY(0); }

/* ── Tooltip (kustom) ───────────────────────────────────────────────── */
.tl-tooltip {
  position: fixed;
  background: var(--bg-raised);
  border: 1px solid var(--border-mid);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 300;
  max-width: 240px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.15s;
}
.tl-tooltip.visible { opacity: 1; }
.tl-tooltip .tt-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tl-tooltip .tt-sub   { color: var(--text-mid); }
.tl-tooltip .tt-time  { color: var(--accent); font-size: 0.7rem; margin-top: 4px; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .player-card { flex-wrap: wrap; padding: 18px 16px; gap: 16px; }
  .player-art  { width: 56px; height: 56px; }
  .np-title    { font-size: 1.05rem; }

  .timelines-wrap { overflow-x: auto; }
  .tl-track       { min-width: 600px; }
  .tl-time-axis   { min-width: 600px; }

  .header-right   { gap: 8px; }
  .site-header    { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .logo-text .tagline { display: none; }
  .player-controls    { width: 100%; justify-content: center; }
}
