/* ==========================================================================
   Radio Marina Live — live.radiomarina.net
   Dark theme in brand colors (logo blue #0909F1 / #359CD7 + red #EC1C1C).
   Uses CSS logical properties throughout so AR (RTL) and FR (LTR) both work.
   ========================================================================== */

:root {
  --bg: #070a16;
  --bg-2: #0a0f22;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --text: #f2f4fb;
  --muted: rgba(226, 232, 250, 0.62);
  --brand: #4353ff;          /* readable version of logo blue on dark */
  --brand-deep: #0909f1;
  --sky: #359cd7;
  --red: #ec1c1c;
  --red-soft: rgba(236, 28, 28, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --bar-h: 74px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Tajawal', 'Segoe UI', system-ui, Arial, sans-serif;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(9, 9, 241, 0.22), transparent 60%),
    radial-gradient(800px 420px at 0% 110%, rgba(53, 156, 215, 0.12), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 45%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  padding-block-end: calc(var(--bar-h) + 20px);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 10, 22, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-block-end: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 64px;
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand img { height: 44px; width: auto; }

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-inline-start: auto;
}

.main-nav a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.main-nav a:hover { color: var(--text); background: var(--surface-2); }

.main-nav a.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(9, 9, 241, 0.35), rgba(53, 156, 215, 0.25));
  border: 1px solid rgba(67, 83, 255, 0.45);
}

.lang-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.lang-toggle:hover { background: var(--surface-2); border-color: rgba(255, 255, 255, 0.25); }

/* --------------------------------------------------------------------------
   Layout grid
   -------------------------------------------------------------------------- */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 26px;
  padding-block: 26px;
}

.page.single { grid-template-columns: minmax(0, 1fr); }

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 900;
  margin-block-end: 16px;
}

/* Mosaique-style signature dash before section titles */
.section-title::before {
  content: "";
  width: 22px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red), var(--brand));
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Player card
   -------------------------------------------------------------------------- */
.player-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(600px 300px at 80% 0%, rgba(9, 9, 241, 0.28), transparent 65%),
    radial-gradient(420px 260px at 10% 100%, rgba(236, 28, 28, 0.10), transparent 60%),
    linear-gradient(180deg, #0c1228, #0a0e1f);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: clamp(24px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--red-soft);
  border: 1px solid rgba(236, 28, 28, 0.4);
  color: #ff6a6a;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 6px 16px;
  border-radius: 999px;
  text-transform: uppercase;
}

.live-badge .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

.live-badge.is-off { border-color: var(--line); color: var(--muted); background: var(--surface); }
.live-badge.is-off .dot { background: var(--muted); animation: none; }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 28, 28, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(236, 28, 28, 0); }
}

.player-logo { width: min(300px, 62%); height: auto; }

/* Visualizer — pure CSS, runs only while body[data-state="playing"] */
.visualizer {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  height: 46px;
}

.visualizer span {
  width: 6px;
  height: 12%;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--sky), var(--brand-deep));
  opacity: 0.35;
  animation: eq 1.1s ease-in-out infinite;
  animation-play-state: paused;
}

body[data-state="playing"] .visualizer span { opacity: 0.95; animation-play-state: running; }

@keyframes eq {
  0%, 100% { height: 14%; }
  50% { height: 100%; }
}

.visualizer span:nth-child(1)  { animation-delay: -0.9s; animation-duration: 1.3s; }
.visualizer span:nth-child(2)  { animation-delay: -0.5s; animation-duration: 0.9s; }
.visualizer span:nth-child(3)  { animation-delay: -1.1s; animation-duration: 1.15s; }
.visualizer span:nth-child(4)  { animation-delay: -0.2s; animation-duration: 0.85s; }
.visualizer span:nth-child(5)  { animation-delay: -0.7s; animation-duration: 1.25s; }
.visualizer span:nth-child(6)  { animation-delay: -0.4s; animation-duration: 0.95s; }
.visualizer span:nth-child(7)  { animation-delay: -1.0s; animation-duration: 1.2s; }
.visualizer span:nth-child(8)  { animation-delay: -0.6s; animation-duration: 0.9s; }
.visualizer span:nth-child(9)  { animation-delay: -0.3s; animation-duration: 1.05s; }
.visualizer span:nth-child(10) { animation-delay: -0.8s; animation-duration: 0.88s; }
.visualizer span:nth-child(11) { animation-delay: -0.15s; animation-duration: 1.18s; }
.visualizer span:nth-child(12) { animation-delay: -0.55s; animation-duration: 0.92s; }
.visualizer span:nth-child(13) { animation-delay: -0.95s; animation-duration: 1.28s; }
.visualizer span:nth-child(14) { animation-delay: -0.35s; animation-duration: 0.87s; }
.visualizer span:nth-child(15) { animation-delay: -0.75s; animation-duration: 1.1s; }
.visualizer span:nth-child(16) { animation-delay: -0.25s; animation-duration: 0.98s; }

/* Big play button */
.play-btn {
  --size: 92px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: none;
  position: relative;
  background: linear-gradient(140deg, var(--brand-deep), var(--sky));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 34px rgba(9, 9, 241, 0.45);
  transition: transform 0.15s ease, box-shadow 0.2s;
}

.play-btn:hover { transform: scale(1.05); box-shadow: 0 14px 40px rgba(9, 9, 241, 0.6); }
.play-btn:active { transform: scale(0.97); }

.play-btn svg { width: 38px; height: 38px; fill: currentColor; }
.play-btn .icon-pause, .play-btn .icon-spin { display: none; }

body[data-state="playing"] .play-btn .icon-play { display: none; }
body[data-state="playing"] .play-btn .icon-pause { display: block; }

body[data-state="loading"] .play-btn .icon-play { display: none; }
body[data-state="loading"] .play-btn .icon-spin { display: block; animation: spin 0.9s linear infinite; }

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

.now-title {
  font-size: clamp(18px, 2.6vw, 24px);
  font-weight: 700;
  max-width: 90%;
  overflow-wrap: anywhere;
  /* Song titles can be Latin or Arabic regardless of UI direction */
  unicode-bidi: plaintext;
}

.player-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 14px;
}

.chip svg { width: 15px; height: 15px; fill: currentColor; opacity: 0.8; }

/* Volume */
.volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(320px, 80%);
  color: var(--muted);
}

.volume-row svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-2);
  outline: none;
}

input[type="range"]:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--sky));
  border: 2px solid #fff;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid #fff;
  cursor: pointer;
}

/* Share row */
.share-row { display: flex; align-items: center; gap: 10px; }
.share-row .label { font-size: 13px; color: var(--muted); }

.share-row a {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.share-row a:hover { background: var(--surface-2); border-color: rgba(255, 255, 255, 0.3); transform: translateY(-2px); }
.share-row svg { width: 17px; height: 17px; fill: var(--text); }

/* --------------------------------------------------------------------------
   Webcam page
   -------------------------------------------------------------------------- */
.video-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}

.video-frame { position: relative; aspect-ratio: 16 / 9; }

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-offline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background:
    radial-gradient(500px 260px at 50% 0%, rgba(9, 9, 241, 0.25), transparent 65%),
    linear-gradient(180deg, #0c1228, #070a16);
}

.video-offline img { width: 180px; opacity: 0.9; }
.video-offline h2 { font-size: 22px; font-weight: 900; }
.video-offline p { color: var(--muted); max-width: 460px; font-size: 15px; }

.webcam-note { margin-block-start: 14px; color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   News sidebar (timeline like Mosaique)
   -------------------------------------------------------------------------- */
.news-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
}

.news-list { list-style: none; position: relative; }

.news-item {
  position: relative;
  padding-inline-start: 22px;
  padding-block-end: 18px;
  border-inline-start: 1px solid var(--line);
}

.news-item:last-child { padding-block-end: 4px; border-inline-start-color: transparent; }

.news-item::before {
  content: "";
  position: absolute;
  inset-inline-start: -5px;
  top: 7px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.news-item .news-time {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.news-item .news-cat {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--sky);
  margin-inline-start: 8px;
}

.news-item h3 { font-size: 15px; font-weight: 500; line-height: 1.55; margin-block-start: 2px; }
.news-item h3 a:hover { color: var(--sky); }

.news-empty { color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   Schedule
   -------------------------------------------------------------------------- */
.schedule-section { margin-block-start: 30px; }

.day-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-block-end: 16px;
}

.day-tabs button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.day-tabs button:hover { color: var(--text); background: var(--surface-2); }

.day-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-deep), var(--sky));
  border-color: transparent;
  font-weight: 700;
}

.schedule-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.schedule-item {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}

.schedule-item .time {
  font-weight: 700;
  font-size: 15px;
  color: var(--sky);
  white-space: nowrap;
  min-width: 118px;
  direction: ltr;
  text-align: center;
}

.schedule-item .show-name { font-weight: 700; font-size: 16px; }
.schedule-item .show-host { color: var(--muted); font-size: 13px; }

.schedule-item.on-air {
  border-color: rgba(236, 28, 28, 0.5);
  background: linear-gradient(90deg, rgba(236, 28, 28, 0.12), var(--surface) 55%);
}

.schedule-item .on-air-badge {
  display: none;
  margin-inline-start: auto;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 999px;
  padding: 4px 12px;
  text-transform: uppercase;
  animation: pulse-dot 1.6s ease-in-out infinite;
}

.schedule-item.on-air .on-air-badge { display: inline-block; }

.schedule-empty { color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   Persistent bottom bar (Mosaique signature: black bar, red top border)
   -------------------------------------------------------------------------- */
.bottom-bar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  height: var(--bar-h);
  background: rgba(5, 7, 14, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-block-start: 3px solid var(--red);
  display: flex;
  align-items: center;
}

.bottom-bar .container {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(1180px, 100% - 24px);
}

.bar-play {
  --size: 46px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: none;
  background: linear-gradient(140deg, var(--brand-deep), var(--sky));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.bar-play:hover { transform: scale(1.07); }
.bar-play svg { width: 20px; height: 20px; fill: currentColor; }
.bar-play .icon-pause, .bar-play .icon-spin { display: none; }

body[data-state="playing"] .bar-play .icon-play { display: none; }
body[data-state="playing"] .bar-play .icon-pause { display: block; }
body[data-state="loading"] .bar-play .icon-play { display: none; }
body[data-state="loading"] .bar-play .icon-spin { display: block; animation: spin 0.9s linear infinite; }

.bar-info { min-width: 0; display: flex; flex-direction: column; justify-content: center; }

.bar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ff6a6a;
  text-transform: uppercase;
}

.bar-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: plaintext;
}

/* Arabic is a joined script — never letter-space it */
html[lang="ar"] .live-badge,
html[lang="ar"] .bar-label,
html[lang="ar"] .on-air-badge,
html[lang="ar"] .bar-btn,
html[lang="ar"] .lang-toggle {
  letter-spacing: 0;
}

.bar-actions { margin-inline-start: auto; display: flex; gap: 10px; flex-shrink: 0; }

.bar-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 74px;
  padding: 6px 12px;
  border: 1px solid rgba(236, 28, 28, 0.55);
  border-radius: 10px;
  color: #ff6a6a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: background 0.2s, color 0.2s;
}

.bar-btn:hover { background: var(--red); color: #fff; }
.bar-btn svg { width: 18px; height: 18px; fill: currentColor; }
.bar-btn.active { background: var(--red); color: #fff; }

/* --------------------------------------------------------------------------
   Footer note
   -------------------------------------------------------------------------- */
.site-footer {
  margin-block-start: 34px;
  padding-block: 18px;
  border-block-start: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.site-footer a:hover { color: var(--sky); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .page { grid-template-columns: 1fr; }
  .main-nav a { padding: 8px 10px; font-size: 14px; }
}

@media (max-width: 640px) {
  .site-header .container { gap: 8px; }
  .brand img { height: 30px; }
  .main-nav { gap: 0; overflow-x: auto; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { padding: 8px 8px; font-size: 13px; }
  .main-nav a.hide-sm { display: none; }
  .lang-toggle { padding: 6px 12px; font-size: 13px; }
  .play-btn { --size: 78px; }
  .play-btn svg { width: 30px; height: 30px; }
  .bar-btn { min-width: 58px; padding: 5px 8px; font-size: 10px; }
  .bar-actions { gap: 6px; }
  .bar-label { display: none; }
  .schedule-item { flex-wrap: wrap; gap: 8px; }
  .schedule-item .time { min-width: 0; }
}
