@import url("https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #0b1220;
  --surface: #121c2f;
  --surface-2: #1a2742;
  --surface-3: #223354;
  --text: #f3f6fc;
  --muted: #93a4c3;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --gold: #f5b942;
  --green: #22c55e;
  --danger: #ef4444;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Segoe UI", Tahoma, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 20px);
}

body.has-player {
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 148px);
}

/* Top Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 35;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: calc(10px + var(--safe-top)) 14px 10px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  object-fit: cover;
  border: 1px solid rgba(245, 185, 66, 0.4);
  flex-shrink: 0;
  background: var(--surface-2);
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  margin: 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.badge-total {
  background: rgba(56, 189, 248, 0.14);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.icon-btn.spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Banners */
.notice-banner {
  margin: 10px 14px 0;
  padding: 10px 13px;
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(245, 185, 66, 0.16), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(245, 185, 66, 0.35);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.notice-banner.show {
  display: flex;
}

.notice-banner .btn-sm {
  background: var(--gold);
  color: #0b1220;
  border: 0;
  border-radius: 9px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

/* Views */
.view {
  display: none;
}

.view.active {
  display: block;
}

/* Search Box */
.search-section {
  padding: 10px 14px 4px;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 11px 40px 11px 36px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s;
}

.search-input::placeholder {
  color: var(--muted);
  font-size: 12.5px;
}

.search-input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 15px;
}

.clear-btn {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: none;
  padding: 4px 6px;
}

/* Live Radio Quick Strip */
.radio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(245, 185, 66, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius);
  padding: 11px 13px;
  margin: 10px 14px 0;
}

.radio-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}

.live-dot.on {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.92); }
}

.radio-title {
  font-weight: 800;
  font-size: 13px;
}

.radio-sub {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-btn {
  background: linear-gradient(135deg, var(--accent-strong), #2563eb);
  color: #fff;
  border: 0;
  border-radius: 11px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
}

.radio-btn.playing {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.radio-btn:disabled {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}

/* Continue Listening Strip */
.continue-card {
  margin: 10px 14px 0;
  padding: 10px 13px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid rgba(245, 185, 66, 0.28);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.continue-card.show {
  display: flex;
}

.continue-meta {
  min-width: 0;
}

.continue-label {
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
}

.continue-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Program Chips */
.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 11px 14px 4px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.chip .cnt {
  font-size: 11px;
  color: var(--muted);
}

.chip.active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  font-weight: 700;
}

.chip.active .cnt {
  color: rgba(255, 255, 255, 0.85);
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px 6px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

.mini-btn.active {
  background: rgba(56, 189, 248, 0.16);
  color: var(--text);
  border-color: var(--accent);
  font-weight: 700;
}

.result-info {
  font-size: 11.5px;
  color: var(--muted);
}

/* Episode Cards */
.list {
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  transition: border-color 0.18s, transform 0.12s;
}

.card.playing {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), var(--surface));
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 5px;
}

.prog-tag {
  background: var(--surface-2);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 7px;
  font-weight: 700;
}

.ep-num {
  background: rgba(245, 185, 66, 0.16);
  color: var(--gold);
  padding: 2px 8px;
  border-radius: 7px;
  font-weight: 700;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 10px;
  word-break: break-word;
}

.star-btn {
  background: transparent;
  border: 0;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 4px;
  flex-shrink: 0;
}

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

.actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn.primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}

.btn.video {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.38);
  color: #86efac;
}

.btn.yt {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.load-more {
  width: calc(100% - 28px);
  margin: 10px 14px 18px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

/* Dedicated Live Radio View */
.radio-studio {
  padding: 18px 14px;
}

.studio-hero {
  background: linear-gradient(160deg, #13223d 0%, #0d1629 60%, #1b1a2e 100%);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 22px;
  padding: 24px 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.studio-cover {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  margin: 0 auto 14px;
  display: block;
  object-fit: cover;
  border: 2px solid rgba(245, 185, 66, 0.45);
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.25);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(239, 68, 68, 0.16);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 10px;
}

.studio-title {
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 6px;
}

.studio-now {
  font-size: 13.5px;
  color: var(--accent);
  min-height: 22px;
  margin: 0 0 16px;
}

.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 4px;
  height: 24px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.eq-bars.active {
  opacity: 1;
}

.eq-bars span {
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(to top, var(--accent-strong), var(--gold));
  height: 6px;
}

.eq-bars.active span {
  animation: eq 0.9s ease-in-out infinite alternate;
}

.eq-bars.active span:nth-child(2) { animation-delay: 0.18s; }
.eq-bars.active span:nth-child(3) { animation-delay: 0.36s; }
.eq-bars.active span:nth-child(4) { animation-delay: 0.12s; }
.eq-bars.active span:nth-child(5) { animation-delay: 0.28s; }

@keyframes eq {
  from { height: 5px; }
  to { height: 24px; }
}

.studio-play-btn {
  width: 100%;
  max-width: 260px;
  padding: 13px 20px;
  border-radius: 14px;
  border: 0;
  background: linear-gradient(135deg, var(--accent-strong), #2563eb);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.32);
}

.studio-play-btn.playing {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.32);
}

.upcoming-box {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.section-heading {
  font-size: 14px;
  font-weight: 800;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upcoming-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.upcoming-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

/* Info / Install View */
.info-wrap {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
}

.info-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
}

.info-card p {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.status-row:last-child {
  border-bottom: 0;
}

.status-val {
  color: var(--accent);
  font-weight: 700;
}

/* Sticky Audio Player (sits neatly above Bottom Nav) */
.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  z-index: 50;
  background: rgba(18, 28, 47, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid rgba(56, 189, 248, 0.35);
  padding: 9px 14px 10px;
  display: none;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
}

.player.show {
  display: block;
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.player-title {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  padding: 2px 6px;
}

.seek-row {
  display: flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
  margin-bottom: 6px;
}

.seek-row span {
  font-size: 11px;
  color: var(--muted);
  min-width: 38px;
  text-align: center;
}

.seek-row input[type=range] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  direction: ltr;
  flex-wrap: wrap;
}

.ctrl-btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.ctrl-btn.active {
  border-color: var(--gold);
  color: var(--gold);
}

.ctrl-btn.play {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  padding: 7px 18px;
  font-size: 14px;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(11, 18, 32, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-item {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  transition: color 0.15s;
}

.nav-item .nav-ico {
  font-size: 19px;
  line-height: 1;
}

.nav-item.active {
  color: var(--accent);
  font-weight: 800;
}

/* Video Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal.show {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 13.5px;
  font-weight: 700;
}

.modal video {
  width: 100%;
  max-height: 68vh;
  background: #000;
  display: block;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: calc(74px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

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