/* ==========================================================================
   Radio Playlist — Mobile layout
   ========================================================================== */
@import url('base.css');

:root {
  --m-player-height: 64px;
  --m-tabbar-height: 60px;
}

.m-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--m-player-height) + var(--m-tabbar-height) + 8px);
}

/* ---------- Top bar ---------- */
.m-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(11,11,13,0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.m-brand { display: flex; align-items: center; gap: 8px; }
.m-brand svg { width: 26px; height: 26px; }
.m-brand span { font-family: var(--font-display); font-weight: 700; font-size: 17px; }

.m-icon-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}
.m-icon-btn.active { color: var(--accent); background: rgba(29,185,84,0.15); }
.m-icon-btn svg { width: 17px; height: 17px; }

/* ---------- Search bar (collapsible) ---------- */
.m-search-bar {
  display: none;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}
.m-search-bar.open { display: block; }
.m-search-bar .search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 9px 14px;
}
.m-search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}
.m-search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

/* ---------- Genre chips ---------- */
.m-chips {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }

.m-chip {
  flex-shrink: 0;
  padding: 7px 15px;
  border-radius: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.m-chip.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }

/* ---------- Page heading ---------- */
.m-heading { padding: 4px 16px 8px; }
.m-heading h1 { font-family: var(--font-display); font-size: 21px; margin: 0 0 2px; }
.m-heading p { margin: 0; font-size: 13px; color: var(--text-secondary); }

/* ---------- Station list (rows, not grid) ---------- */
.m-list {
  display: flex;
  flex-direction: column;
  padding: 4px 12px 20px;
  gap: 4px;
  flex: 1;
}

.m-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 8px;
  border-radius: 10px;
  position: relative;
}
.m-row:active { background: var(--bg-surface-hover); }
.m-row.playing { background: var(--bg-surface); }

.m-row-cover {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #2a2a2d, #1a1a1c);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.m-row-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-row-cover svg { width: 40%; height: 40%; color: var(--text-muted); }

.m-row-eq {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding-bottom: 8px;
}
.m-row-eq span { width: 3px; height: 40%; background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.m-row-eq span:nth-child(1) { animation-delay: 0s; }
.m-row-eq span:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.m-row-eq span:nth-child(3) { height: 65%; animation-delay: 0.4s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

.m-row-meta { flex: 1; min-width: 0; }
.m-row-meta .name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-row-meta .genre { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.m-row-fav {
  background: none;
  border: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.m-row-fav.active { color: var(--accent); }
.m-row-fav svg { width: 19px; height: 19px; }

.m-row-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface-hover);
  border: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m-row-play.is-playing { background: var(--accent); color: #000; }
.m-row-play svg { width: 15px; height: 15px; margin-left: 1px; }

.m-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-secondary);
}
.m-empty svg { width: 40px; height: 40px; color: var(--text-muted); margin-bottom: 10px; }

/* ---------- Mini player bar ---------- */
.m-player {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--m-tabbar-height) + 8px);
  height: var(--m-player-height);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  z-index: 25;
  transform: translateY(140%);
  transition: transform 0.25s ease;
  box-shadow: 0 10px 24px rgba(0,0,0,0.4);
}
.m-player.visible { transform: translateY(0); }

.m-player-cover {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #2a2a2d, #1a1a1c);
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-player-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-player-cover svg { width: 40%; height: 40%; color: var(--text-muted); }

.m-player-meta { flex: 1; min-width: 0; }
.m-player-meta .name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-player-meta .genre { font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.m-player-playpause {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--text-primary);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m-player-playpause svg { width: 15px; height: 15px; }

.m-player-more {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.m-player-more svg { width: 18px; height: 18px; }

/* ---------- Bottom tab bar ---------- */
.m-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--m-tabbar-height);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.m-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
}
.m-tab svg { width: 20px; height: 20px; }
.m-tab.active { color: var(--accent); }

/* ---------- Bottom sheet (expanded controls) ---------- */
.m-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 35;
  display: none;
}
.m-sheet-overlay.open { display: block; }

.m-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  z-index: 36;
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0));
  transform: translateY(100%);
  transition: transform 0.28s ease;
}
.m-sheet.open { transform: translateY(0); }

.m-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 6px auto 18px;
}

.m-sheet-cover {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 1;
  margin: 0 auto 18px;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, #2a2a2d, #1a1a1c);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 32px rgba(0,0,0,0.4);
}
.m-sheet-cover img { width: 100%; height: 100%; object-fit: cover; }
.m-sheet-cover svg { width: 30%; height: 30%; color: var(--text-muted); }

.m-sheet-meta { text-align: center; margin-bottom: 18px; }
.m-sheet-meta .name { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.m-sheet-meta .genre { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.m-sheet-live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}
.m-sheet-live .live-dot { width: 7px; height: 7px; border-radius: 50%; background: #e5484d; }
.m-sheet-live .live-dot.buffering { background: var(--text-muted); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

.m-sheet-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}
.m-sheet-playpause {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.m-sheet-playpause svg { width: 26px; height: 26px; }

.m-sheet-volume {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.m-sheet-volume svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; }

.m-sheet-section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 10px;
}

.m-sheet-sleep-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.m-sheet-sleep-options button {
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.m-sheet-sleep-options button.active { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 700; }

.device-switch { text-align: center; padding: 10px 16px 4px; }
