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

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: #000000;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}

.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }

.nav-item:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-surface); color: var(--text-primary); }
.nav-item.active .nav-dot { background: var(--accent); }

.genre-list { display: flex; flex-direction: column; gap: 1px; max-height: 260px; overflow-y: auto; }

.admin-link { border-top: 1px solid var(--border); padding-top: 16px; }
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

/* ---------- Main content ---------- */
.main {
  overflow-y: auto;
  padding-bottom: calc(var(--player-height) + 24px);
  background: linear-gradient(180deg, #1a1a1d 0%, var(--bg-base) 320px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 32px;
  backdrop-filter: blur(12px);
  background: rgba(11,11,13,0.7);
}

.search-box {
  flex: 1;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 9px 16px;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
}

.search-box svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.page-heading { padding: 8px 32px 20px; }

.page-heading h1 {
  font-family: var(--font-display);
  font-size: 28px;
  margin: 0 0 4px;
  letter-spacing: -0.4px;
}

.page-heading p { margin: 0; color: var(--text-secondary); font-size: 14px; }

/* ---------- Station grid ---------- */
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px;
  padding: 0 32px 32px;
}

.station-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 14px;
  position: relative;
  transition: background 0.2s;
  border: 1px solid transparent;
}

.station-card:hover { background: var(--bg-surface-hover); }
.station-card.playing { border-color: var(--accent); }

.cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #2a2a2d, #1a1a1c);
}

.cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

.cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.cover-fallback svg { width: 40%; height: 40%; }

.play-fab {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s, transform 0.18s, background 0.15s;
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}
.station-card:hover .play-fab,
.station-card.playing .play-fab { opacity: 1; transform: translateY(0); }
.play-fab:hover { background: var(--accent-hover); }
.play-fab svg { width: 18px; height: 18px; margin-left: 2px; }

.station-name {
  font-weight: 600;
  font-size: 14.5px;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-genre {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0,0,0,0.5);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.station-card:hover .fav-btn, .fav-btn.active { opacity: 1; }
.fav-btn.active { color: var(--accent); }
.fav-btn svg { width: 14px; height: 14px; }

.eq-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  background: rgba(0,0,0,0.55);
  padding: 4px 6px;
  border-radius: 4px;
}
.eq-badge span { width: 3px; background: var(--accent); animation: eq 0.9s ease-in-out infinite; }
.eq-badge span:nth-child(1) { height: 40%; animation-delay: 0s; }
.eq-badge span:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.eq-badge span:nth-child(3) { height: 65%; animation-delay: 0.4s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

.empty-state {
  padding: 60px 32px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-state svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 12px; }

/* ---------- Player bar ---------- */
.player-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--player-height);
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
  z-index: 20;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.player-bar.visible { transform: translateY(0); }

.player-track { display: flex; align-items: center; gap: 12px; min-width: 0; }

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

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

.player-controls { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.control-row { display: flex; align-items: center; gap: 18px; }

.play-pause-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--text-primary);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}
.play-pause-btn:hover { transform: scale(1.06); }
.play-pause-btn svg { width: 16px; height: 16px; }

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

.player-extra { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  position: relative;
}
.icon-btn:hover { color: var(--text-primary); background: var(--bg-surface-hover); }
.icon-btn.active { color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

.volume-row { display: flex; align-items: center; gap: 8px; width: 120px; }

.sleep-menu {
  position: absolute;
  bottom: 44px;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  display: none;
  flex-direction: column;
  min-width: 140px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.5);
}
.sleep-menu.open { display: flex; }
.sleep-menu button {
  background: none;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 5px;
}
.sleep-menu button:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.sleep-menu button.active { color: var(--accent); }

.sleep-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  padding: 1px 4px;
  line-height: 1.4;
}

/* ---------- Tambah button (topbar) ---------- */
.btn-add {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: filter .15s;
}
.btn-add:hover { filter: brightness(1.1); }

/* ---------- Card action buttons (edit / delete) ---------- */
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity .15s;
}
.station-card:hover .card-actions { opacity: 1; }

.card-action-btn {
  flex: 1;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.card-action-btn svg { width: 13px; height: 13px; }
.card-action-btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); border-color: var(--text-muted); }
.card-action-btn.danger:hover { background: rgba(220,50,50,.15); color: #e5484d; border-color: #e5484d; }

/* ---------- CRUD Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 700; margin: 0; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-surface-hover); }

#stationForm {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
#stationForm label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
#stationForm label span { text-transform: none; font-weight: 400; letter-spacing: 0; }
#stationForm input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
#stationForm input:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}
.btn-primary {
  padding: 10px 22px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 20px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: filter .15s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary {
  padding: 10px 22px;
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--bg-surface-hover); }
