/* =========================================================
   SalahScreen – Stylesheet
   Designed for large landscape displays (TV / monitor).
   Base grid: 1920 × 1080 target, fluid via vw/vh units.
   ========================================================= */

:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --border:       #30363d;
  --accent:       #2ea043;   /* green – mosque / Islamic feel */
  --accent2:      #f0a500;   /* gold – highlights */
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --next-prayer:  #f0a500;
  --font-head:    'Segoe UI', system-ui, sans-serif;
  --font-mono:    'Courier New', monospace;
  --radius:       0.75rem;
  --gutter:       1.5vw;
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-head);
  overflow: hidden;           /* full-screen kiosk – no scrollbars */
  user-select: none;
}

/* ── Layout grid ─────────────────────────────────────────── */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  gap: 0;
}

/* ── Header ──────────────────────────────────────────────── */

#header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 2px solid var(--accent);
  padding: 0.6vh var(--gutter);
  gap: 1rem;
}

#mosque-name {
  font-size: clamp(1.4rem, 2.8vw, 2.8rem);
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

#header-date {
  font-size: clamp(1rem, 1.8vw, 1.8rem);
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

/* ── Header right group (date + mini clock stacked) ─────── */

#header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3vh;
}

#header-mini-clock {
  font-size: clamp(1.2rem, 2.2vw, 2.2rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
  letter-spacing: 0.08em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

#header-mini-clock.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Main wrapper (owns the flex grow, positions overlay) ── */

#main-wrapper {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
}

/* ── Main content area ───────────────────────────────────── */

#main {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  gap: var(--gutter);
  padding: var(--gutter);
  overflow: hidden;
  align-items: center;
  transition: opacity 0.5s;
}

#main.notif-active {
  opacity: 0;
  pointer-events: none;
}

/* ── Jamaat notification overlay ─────────────────────────── */

#jamaat-notification {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5vh;
  background: var(--bg);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

#jamaat-notification.visible {
  opacity: 1;
  pointer-events: auto;
}

#notif-silence {
  font-size: clamp(1.8rem, 3.5vw, 4rem);
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.04em;
}

#notif-prayer {
  font-size: clamp(3rem, 8vw, 9rem);
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.06em;
  line-height: 1.1;
}

#clock-panel,
#prayers-panel {
  flex: 1 1 0;
  min-width: 0;
}

/* ── Left panel – clock ──────────────────────────────────── */

#clock-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5vh;
  height: 100%;
}

#clock-canvas {
  /* Sized via JS to fit available space */
  max-width: 42vh;
  max-height: 42vh;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

#digital-time {
  font-size: clamp(2rem, 4vw, 4.5rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

#countdowns {
  display: flex;
  flex-direction: column;
  gap: 0.4vh;
  width: 100%;
  max-width: 42vh;
}

.countdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5vh 1.2vw;
  font-size: clamp(0.85rem, 1.4vw, 1.4rem);
}

.countdown-item .label {
  color: var(--text-muted);
  font-size: 0.85em;
}

.countdown-item .value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
}

.countdown-item.next {
  border-color: var(--accent);
  background: rgba(46, 160, 67, 0.1);
}

/* ── Right panel – prayer times table ───────────────────── */

#prayers-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
}

#prayers-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 0.6vh;
  font-size: clamp(0.9rem, 1.5vw, 1.6rem);
}

#prayers-table thead th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.75em;
  padding-bottom: 0.8vh;
  border-bottom: 1px solid var(--border);
}

#prayers-table thead th:not(:first-child) { text-align: center; }

#prayers-table tbody tr {
  background: var(--surface);
  border-radius: var(--radius);
  transition: background 0.3s;
}

#prayers-table tbody tr.current-prayer {
  background: rgba(240, 165, 0, 0.12);
}

#prayers-table tbody tr.next-prayer {
  background: rgba(46, 160, 67, 0.12);
}

#prayers-table tbody td {
  padding: 1vh 1.2vw;
  vertical-align: middle;
}

#prayers-table tbody td:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

#prayers-table tbody td:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.prayer-name {
  font-weight: 700;
  font-size: 1.1em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.prayer-name .dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

tr.current-prayer .prayer-name .dot { background: var(--accent2); }
tr.next-prayer    .prayer-name .dot { background: var(--accent); }

.prayer-time {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.prayer-time.start   { color: var(--text); }
.prayer-time.jamaat  { color: var(--accent2); font-weight: 700; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.6em;
  font-weight: 700;
  padding: 0.1em 0.5em;
  border-radius: 99px;
  vertical-align: middle;
  letter-spacing: 0.05em;
}

/* ── Footer – scrolling text ─────────────────────────────── */

#footer {
  flex-shrink: 0;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  padding: 0.7vh var(--gutter);
  overflow: hidden;
  white-space: nowrap;
}

#ticker-wrap {
  display: inline-block;
  /* JS drives the animation so the duration matches text length */
}

#ticker-text {
  display: inline-block;
  font-size: clamp(0.9rem, 1.6vw, 1.6rem);
  color: var(--text-muted);
  animation: ticker linear infinite;
  animation-duration: var(--ticker-duration, 30s);
  padding-left: 100vw;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* ── Utility ─────────────────────────────────────────────── */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0);
}

/* ── Loading / error states ──────────────────────────────── */

#loading-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  font-size: 1.5rem;
  color: var(--text-muted);
  z-index: 100;
  transition: opacity 0.5s;
}

#loading-overlay.hidden { opacity: 0; pointer-events: none; }
