/* ============================================================================
   ISSA MASJID — PORTRAIT TV PRAYER DISPLAY
   Design System: Kiswah Obsidian & Antique Gold
   Typography: Plus Jakarta Sans (Exact match with Website Prayer Table)
   Strictly bounded within the Golden Arch frame with clean 3-column alignment.
   ============================================================================ */

:root {
  --tv-bg: #000000;
  --card-bg: #0b0b0c;
  --gold-primary: #b58524;
  --gold-bright: #d8b153;
  --gold-soft: #efe3c3;
  --gold-border: rgba(216, 177, 83, 0.4);
  --gold-gradient: linear-gradient(135deg, #dfba73 0%, #fef3c7 25%, #c59b4c 50%, #8b6827 75%, #d4af37 100%);
  
  --text-white: #ffffff;
  --text-cream: #faf7f0;
  --text-muted: #c9c1b0;
  --text-dim: #787163;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--tv-bg);
  color: var(--text-white);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 1. Viewport & 9:16 Portrait Card ---------- */
.tv-viewport {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000000;
  overflow: hidden;
  position: relative;
}

.tv-card {
  height: 100vh;
  height: 100dvh;
  aspect-ratio: 9 / 16;
  max-width: 100vw;
  position: relative;
  overflow: hidden;
  background-color: var(--card-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='88' viewBox='0 0 88 88'%3E%3Cg fill='none' stroke='%23d8b153' stroke-width='0.65' stroke-opacity='0.08'%3E%3Cpolygon points='44,6 54,28 76,18 66,40 86,44 66,48 76,70 54,60 44,82 34,60 12,70 22,48 2,44 22,40 12,18 34,28'/%3E%3Ccircle cx='44' cy='44' r='12'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 88px 88px;
  background-repeat: repeat;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* Extended horizontal layout with reduced side margins & lifted bottom arch clearance */
  padding: 1.5vh 4.5% 3.5vh 4.5%;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.95);
}

/* ---------- 2. Vector Arch Frame (Resolution-Independent) ---------- */
.arch-svg-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Corner Medallions (Top-Left Muhammad pbuh, Top-Right Allah swt - Scaled to not overlap arch) */
.corner-medallion {
  position: absolute;
  top: 1.2%;
  width: 12%;
  max-width: 122px;
  pointer-events: none;
  z-index: 5;
}

.corner-medallion.top-left {
  left: 1.8%;
}

.corner-medallion.top-right {
  right: 1.8%;
}

.corner-medallion img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.95));
}

/* ---------- 3. Top Digital Clock (Enlarged for High Prominence) ---------- */
.tv-header-clock {
  position: relative;
  z-index: 4;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 5.2vh;
  padding-bottom: 0.2vh;
}

.clock-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1.2vw;
}

.clock-time {
  display: inline-flex;
  align-items: baseline;
  font-size: 6.8vh; /* Enlarged from 5.2vh for commanding prominence */
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.45), 0 2px 12px rgba(0, 0, 0, 0.95);
}

.clock-time .t-h {
  display: inline-block;
  width: 1.3em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.clock-time .t-sep {
  display: inline-block;
  width: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.clock-time .t-m {
  display: inline-block;
  width: 1.45em;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.clock-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.3vh;
}

.clock-seconds {
  font-size: 2.7vh; /* Scaled with enlarged clock */
  font-weight: 700;
  color: var(--text-white);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.clock-ampm {
  font-size: 2.2vh; /* Scaled with enlarged clock */
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: 0.04em;
  line-height: 1;
}

/* ---------- 4. Subheader: Hijri, Mosque Crest & Gregorian ---------- */
.tv-subheader {
  position: relative;
  z-index: 4;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 0.95fr minmax(0, 1.15fr);
  align-items: center;
  padding: 0 1.5%;
  margin-top: 0.2vh;
  margin-bottom: 1.2vh;
}

.date-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 3%;
  gap: 0.5vh; /* Clean separation between the Arabic 2-line block and English 2-line block */
  overflow: hidden;
}

/* Arabic 2-line date block */
.date-block-ar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1vh;
}

.date-line-ar {
  font-family: "Amiri", serif;
  font-size: 1.8vh;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}

.date-line-ar-year {
  font-family: "Amiri", serif;
  font-size: 1.6vh;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
}

/* English 2-line date block */
.date-block-en {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1vh;
}

.date-line-en {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.6vh;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.15;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.date-line-en-year {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 1.5vh;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

/* Central Mosque Crest */
.masjid-center-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 11vh;
  padding: 0 4%;
}

.masjid-logo {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.9));
}

/* ---------- 5. 5 Daily Prayers Schedule Board (Clean 3-Column System) ---------- */
.prayer-schedule-area {
  position: relative;
  z-index: 4;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  flex: 1;
  gap: 0.8vh;
}

/* Column Header Labels: 3 Equal Columns (Strict minmax(0, 1fr) Grid) */
.prayer-header-labels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  padding: 0 1% 0.5vh 1%;
  border-bottom: 1px solid rgba(216, 177, 83, 0.25);
  margin-bottom: 0.2vh;
  width: 100%;
}

.prayer-header-labels span {
  font-size: 1.6vh;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-bright);
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

/* Individual Prayer Row: Strict minmax(0, 1fr) Grid */
.prayer-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  padding: 0.6vh 1%;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.35s ease;
}

/* Active or Upcoming Prayer Highlight */
.prayer-row.active {
  background: radial-gradient(ellipse at center, rgba(216, 177, 83, 0.22) 0%, rgba(216, 177, 83, 0.04) 75%, transparent 100%);
  border-color: rgba(216, 177, 83, 0.5);
  box-shadow: 0 0 24px rgba(216, 177, 83, 0.22);
  transform: scale(1.015);
}

.prayer-row.active .time-cell {
  color: var(--gold-bright);
  text-shadow: 0 0 16px rgba(216, 177, 83, 0.6);
}

.prayer-row.active .prayer-name-en {
  color: var(--gold-bright);
}

/* Column 1: Adhan Time (Strictly Centered in Left 1/3) */
.time-cell.cell-adhan {
  display: flex;
  justify-content: center;
  align-items: baseline;
  width: 100%;
  text-align: center;
}

/* Column 2: Prayer Name (Arabic above English, Strictly Centered in Middle 1/3) */
.name-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  text-align: center;
  overflow: hidden;
  gap: 0.15vh;
}

.prayer-name-ar {
  font-family: "Amiri", serif;
  font-size: 2.1vh;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.prayer-name-en {
  font-size: 2.5vh;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: 0.02em;
  line-height: 1.1;
  white-space: nowrap;
}

/* Active row Arabic styling */
.prayer-row.active .prayer-name-ar {
  color: #fff2c6;
  text-shadow: 0 0 12px rgba(216, 177, 83, 0.8);
}

/* Column 3: Iqamah Time (Strictly Centered in Right 1/3, matching Column 1) */
.time-cell.cell-iqamah {
  display: flex;
  justify-content: center;
  align-items: baseline;
  width: 100%;
  text-align: center;
}

/* Numbers: Tabular-nums with vertically-locked colon */
.time-cell {
  font-size: 4.6vh;
  font-weight: 800;
  color: var(--text-white);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

.time-cell .t-h {
  display: inline-block;
  width: 1.3em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.time-cell .t-sep {
  display: inline-block;
  width: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.time-cell .t-m {
  display: inline-block;
  width: 1.45em;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.time-cell .t-blank,
.aux-time .t-blank {
  display: inline-block;
  width: 3.1em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}

/* ---------- 5b. Flashing Red Countdown in Seconds (<60s before Iqamah) ---------- */
@keyframes iqamahCountdownFlash {
  0%, 100% {
    color: #ff3333;
    text-shadow: 0 0 22px rgba(255, 51, 51, 0.95), 0 0 40px rgba(255, 51, 51, 0.65), 0 2px 10px rgba(0, 0, 0, 0.9);
    opacity: 1;
    transform: scale(1.05);
  }
  50% {
    color: #ff6b6b;
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.4);
    opacity: 0.35;
    transform: scale(0.96);
  }
}

.time-cell.countdown-red,
.aux-time.countdown-red {
  color: #ff3333 !important;
  animation: iqamahCountdownFlash 1s infinite ease-in-out !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: baseline !important;
}

.countdown-badge {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.countdown-badge .cd-num {
  font-size: 5.2vh;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.countdown-badge .cd-unit {
  font-size: 2.5vh;
  font-weight: 700;
  text-transform: lowercase;
  margin-left: 0.15em;
  opacity: 0.92;
}

/* Row pulsing highlight during final 60 seconds */
.prayer-row.counting-down {
  border-color: rgba(255, 51, 51, 0.65) !important;
  background: radial-gradient(ellipse at center, rgba(255, 51, 51, 0.22) 0%, rgba(255, 51, 51, 0.04) 75%, transparent 100%) !important;
  box-shadow: 0 0 28px rgba(255, 51, 51, 0.32) !important;
}

/* ---------- 6. Bottom Auxiliary Times (Sunrise & Jumu'ah - Lifted to Avoid Bottom Arch) ---------- */
.auxiliary-times-footer {
  position: relative;
  z-index: 4;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  padding: 1.1vh 3% 0.3vh 3%;
  margin-top: 0.8vh;
  margin-bottom: 0.6vh;
  border-top: 2.5px solid;
  border-image: linear-gradient(90deg, transparent 0%, #8b6827 8%, #dfba73 25%, #fef3c7 50%, #dfba73 75%, #8b6827 92%, transparent 100%) 1;
}

.aux-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.aux-title-ar {
  font-family: var(--font-ar), "Amiri", "Traditional Arabic", serif;
  font-size: 1.9vh;
  font-weight: 700;
  color: #dfba73;
  line-height: 1.15;
  margin-bottom: 0.1vh;
  direction: rtl;
}

.aux-title,
.aux-title-en {
  font-size: 1.6vh;
  font-weight: 700;
  color: #f7eed7;
  letter-spacing: 0.04em;
  margin-bottom: 0.3vh;
  text-transform: capitalize;
  line-height: 1.1;
}

.aux-time {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  font-size: 3.4vh;
  font-weight: 800;
  color: #eedba5;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.aux-time .t-h {
  display: inline-block;
  width: 1.3em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.aux-time .t-sep {
  display: inline-block;
  width: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.aux-time .t-m {
  display: inline-block;
  width: 1.45em;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

/* ---------- 7. Bottom Website Branding ---------- */
.tv-bottom-branding {
  position: relative;
  z-index: 4;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0.4vh 2% 0.2vh 2%;
  margin-bottom: 1.6vh; /* Safely lifted above bottom golden arch border */
}

.tv-branding-text {
  font-size: 1.55vh;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #eedba5;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

/* ---------- 8. Floating TV Controls ---------- */
.tv-controls-bar {
  position: fixed;
  bottom: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  background: rgba(15, 14, 12, 0.92);
  backdrop-filter: blur(10px);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(216, 177, 83, 0.35);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.8);
}

.tv-viewport:hover .tv-controls-bar,
.tv-controls-bar.show {
  opacity: 1;
  pointer-events: auto;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.ctrl-btn:hover {
  background: rgba(216, 177, 83, 0.2);
  color: var(--gold-bright);
}

.sync-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  padding-left: 10px;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #2ed573;
  box-shadow: 0 0 8px #2ed573;
}

.sync-dot.syncing {
  background-color: #ffa502;
  box-shadow: 0 0 8px #ffa502;
  animation: pulseDot 1s infinite alternate;
}

@keyframes pulseDot {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Widescreen Scaling */
@media (min-aspect-ratio: 9/16) {
  .tv-card {
    height: 100vh;
    height: 100dvh;
    width: calc(100vh * 9 / 16);
    max-width: 100vw;
  }
}
