/* ═══════════════════════════════════════════
   PlayRadioStations — Minimal Design Tokens
   Branch: redesign/minimal-radio-ui
   ═══════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg: #C9C9C9;
  --bg2: #B8B8B8;
  --phone: #FFFFFF;
  --phone-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.10);
  --phone-border: rgba(0, 0, 0, 0.06);
  --black: #0B0B0C;
  --muted: #9A9A9A;
  --red: #F04438;
  --red-hover: #D9362B;
  --red-soft: rgba(240, 68, 56, 0.10);
  --grey-text: #555555;
  --grey-light: #AAAAAA;
  --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius-phone: 24px;
  --radius-sm: 12px;
  --radius-pill: 999px;
  --transition: 0.2s ease;
}

/* ── Light theme ── */
:root[data-theme="light"] {
  --bg: #E8E8E8;
  --bg2: #D5D5D5;
  --phone: #FFFFFF;
  --phone-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
  --phone-border: rgba(0, 0, 0, 0.08);
  --black: #1A1A1A;
  --muted: #777777;
  --red: #E84038;
  --red-hover: #C9342C;
  --red-soft: rgba(232, 64, 56, 0.08);
  --grey-text: #555555;
  --grey-light: #888888;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  font: 16px/1.55 var(--font);
  color: var(--black);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════
   Phone Frame (shared card shell)
   ═══════════════════════════════════════════ */
.phone-frame {
  width: 100%;
  max-width: 375px;
  background: var(--phone);
  border-radius: var(--radius-phone);
  border: 1px solid var(--phone-border);
  box-shadow: var(--phone-shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ═══════════════════════════════════════════
   Layout: Desktop 3-card row, mobile stack
   ═══════════════════════════════════════════ */
.phone-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 40px 20px;
  min-height: 100dvh;
}

@media (min-width: 1100px) {
  .phone-stage {
    flex-direction: row;
    padding: 60px 40px;
    gap: 28px;
  }
}

/* Mobile: snap carousel */
@media (max-width: 1099px) {
  .phone-stage {
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .phone-stage::-webkit-scrollbar { display: none; }
  .phone-stage > .phone-frame {
    scroll-snap-align: center;
    flex-shrink: 0;
  }
}

/* ═══════════════════════════════════════════
   Typography — huge grotesk
   ═══════════════════════════════════════════ */
.display-xl {
  font-family: var(--font-display);
  font-size: clamp(48px, 10vw, 80px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--black);
}

.display-lg {
  font-family: var(--font-display);
  font-size: clamp(36px, 7vw, 56px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--black);
}

.display-md {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--black);
}

.body-lg {
  font-size: 18px;
  font-weight: 500;
  color: var(--grey-text);
  line-height: 1.5;
}

.body-sm {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.5;
}

.label-sm {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ═══════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--black);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-pill);
  padding: 14px 28px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform 0.1s ease;
  min-height: 48px;
}

.btn-primary:hover {
  background: #333333;
}

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

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

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--phone-border);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
}

.btn-ghost:hover {
  border-color: var(--black);
  color: var(--black);
}

.btn-icon {
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  transition: background var(--transition);
  color: var(--muted);
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.06);
}

.btn-icon svg {
  width: 22px;
  height: 22px;
}

/* ═══════════════════════════════════════════
   Segmented pill toggle (Countries / Saved)
   ═══════════════════════════════════════════ */
.segmented {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}

.segmented button {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 36px;
}

.segmented button.active {
  background: var(--black);
  color: #FFFFFF;
}

.segmented button:hover:not(.active) {
  color: var(--black);
}

/* ═══════════════════════════════════════════
   Search input
   ═══════════════════════════════════════════ */
.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: var(--black);
  background: rgba(0, 0, 0, 0.04);
  border: 1.5px solid var(--phone-border);
  border-radius: var(--radius-pill);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 48px;
}

.search-input:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.search-input::placeholder {
  color: var(--grey-light);
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--grey-light);
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   Card header
   ═══════════════════════════════════════════ */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}

.card-header-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--black);
}

.card-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ═══════════════════════════════════════════
   Divider
   ═══════════════════════════════════════════ */
.divider {
  height: 1px;
  background: var(--phone-border);
  margin: 0 20px;
}

/* ═══════════════════════════════════════════
   List items
   ═══════════════════════════════════════════ */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--font);
  min-height: 56px;
}

.list-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.list-item.active {
  background: var(--red-soft);
}

.list-item .item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: #FFFFFF;
  flex-shrink: 0;
  overflow: hidden;
}

.list-item .item-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.list-item .item-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item .item-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item .item-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.list-item .item-count sup {
  font-size: 11px;
  color: var(--red);
  font-weight: 800;
}

/* ═══════════════════════════════════════════
   Star button (favorite)
   ═══════════════════════════════════════════ */
.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background var(--transition);
  color: var(--grey-light);
}

.star-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.star-btn svg {
  width: 22px;
  height: 22px;
}

.star-btn.saved {
  color: var(--black);
}

.star-btn.saved svg {
  fill: currentColor;
}

/* ═══════════════════════════════════════════
   Share button
   ═══════════════════════════════════════════ */
.share-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background var(--transition);
  color: var(--muted);
}

.share-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.share-btn svg {
  width: 20px;
  height: 20px;
}

/* ═══════════════════════════════════════════
   Transport bar (play/pause/prev/next)
   ═══════════════════════════════════════════ */
.transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
}

.transport-btn {
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  transition: all var(--transition);
  color: var(--black);
}

.transport-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.transport-btn:active {
  transform: scale(0.92);
}

.transport-btn svg {
  width: 24px;
  height: 24px;
}

.transport-btn.play {
  background: var(--black);
  color: #FFFFFF;
  width: 64px;
  height: 64px;
}

.transport-btn.play:hover {
  background: #333333;
}

.transport-btn.play svg {
  width: 26px;
  height: 26px;
}

/* ═══════════════════════════════════════════
   Tuner ruler (horizontal ticks)
   ═══════════════════════════════════════════ */
.tuner-ruler {
  position: relative;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  overflow: hidden;
  cursor: grab;
}

.tuner-ruler.dragging {
  cursor: grabbing;
}

.tuner-track {
  position: relative;
  width: 100%;
  height: 2px;
  background: var(--phone-border);
  border-radius: 1px;
}

.tuner-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 1px;
  background: var(--phone-border);
}

.tuner-tick.major {
  height: 12px;
  background: var(--grey-light);
}

.tuner-tick.minor {
  height: 6px;
}

.tuner-needle {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 24px;
  background: var(--red);
  border-radius: 2px;
  transition: left 0.3s ease;
  z-index: 2;
}

.tuner-needle::after {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
}

/* ═══════════════════════════════════════════
   Station number display
   ═══════════════════════════════════════════ */
.station-number {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.station-number .num-major {
  color: var(--grey-light);
  font-size: 48px;
}

.station-number .num-minor {
  color: var(--black);
  font-size: 56px;
}

.station-number .num-total {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 8px;
}

/* ═══════════════════════════════════════════
   Status bar (stream info)
   ═══════════════════════════════════════════ */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.status-bar .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grey-light);
  display: inline-block;
  margin-right: 6px;
}

.status-bar .status-dot.live {
  background: var(--red);
  box-shadow: 0 0 8px rgba(240, 68, 56, 0.4);
}

/* ═══════════════════════════════════════════
   Card footer
   ═══════════════════════════════════════════ */
.card-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--phone-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-footer .footer-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.card-footer .footer-links {
  display: flex;
  gap: 12px;
}

.card-footer .footer-links a {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}

.card-footer .footer-links a:hover {
  color: var(--black);
}

/* ═══════════════════════════════════════════
   Empty state
   ═══════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 8px;
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 8px;
}

.empty-state .empty-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

/* ═══════════════════════════════════════════
   Toast notification
   ═══════════════════════════════════════════ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: var(--black);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════
   Mini player bar (persistent bottom)
   ═══════════════════════════════════════════ */
.mini-player {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
  display: none;
  gap: 12px;
  align-items: center;
  background: var(--phone);
  border: 1px solid var(--phone-border);
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

@media (min-width: 900px) {
  .mini-player {
    left: auto;
    right: 20px;
    bottom: 20px;
    width: 360px;
  }
}

.mini-player[hidden] {
  display: none;
}

.mini-player .mini-play {
  display: grid;
  place-items: center;
  background: var(--black);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  color: #FFFFFF;
  flex-shrink: 0;
}

.mini-player .mini-play svg {
  width: 16px;
  height: 16px;
}

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

.mini-player .mini-info strong {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--black);
}

.mini-player .mini-info span {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.mini-player .mini-next {
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--phone-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
}

.mini-player .mini-next svg {
  width: 14px;
  height: 14px;
}

/* ═══════════════════════════════════════════
   Site footer (SEO links)
   ═══════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--phone-border);
  padding: 20px;
  text-align: center;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 8px;
  margin-bottom: 12px;
}

.site-footer nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  transition: all var(--transition);
}

.site-footer nav a:hover {
  color: var(--black);
  background: rgba(0, 0, 0, 0.04);
}

.site-footer p {
  font-size: 12px;
  color: var(--grey-light);
  line-height: 1.5;
}

.site-footer p a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ═══════════════════════════════════════════
   Theme toggle button
   ═══════════════════════════════════════════ */
.theme-btn {
  display: grid;
  place-items: center;
  background: transparent;
  border: 1.5px solid var(--phone-border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  color: var(--muted);
  transition: all var(--transition);
}

.theme-btn:hover {
  border-color: var(--black);
  color: var(--black);
}

.theme-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Icon paths ── */
.icon-play { display: inline-block; }
.icon-pause { display: inline-block; }
.icon-next { display: inline-block; }
.icon-prev { display: inline-block; }
.icon-star { display: inline-block; }
.icon-star-fill { display: inline-block; }
.icon-share { display: inline-block; }
.icon-search { display: inline-block; }
.icon-menu { display: inline-block; }
.icon-chevron-left { display: inline-block; }
.icon-vol { display: inline-block; }
.icon-vol-x { display: inline-block; }

/* SVG icon base */
svg.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
