/* ============================================================
   Sacred Time — Izhaki Nation | Tribal Design System
   Colors: Red #C0152A | Yellow #F0B429 | Blue #1A4B8C
   ============================================================ */

:root {
  --red:     #C0152A;
  --yellow:  #F0B429;
  --blue:    #1A4B8C;
  --red-dim: rgba(192,21,42,0.15);
  --yel-dim: rgba(240,180,41,0.12);
  --blu-dim: rgba(26,75,140,0.15);

  /* Dark theme (default) */
  --bg:        #08080F;
  --surface:   #12121C;
  --card:      #1A1A28;
  --card-alt:  #1E1E30;
  --border:    #2A2A40;
  --text:      #E8E8F4;
  --text-sub:  #7878A0;
  --text-dim:  #4A4A68;
  --input-bg:  #0F0F1E;

  --header-h: 56px;
  --nav-h:    64px;
  --radius:   12px;
  --radius-sm: 8px;
  --shadow:   0 4px 24px rgba(0,0,0,0.5);

  --font: -apple-system, 'Segoe UI', system-ui, sans-serif;
}

[data-theme="light"] {
  --bg:       #F5F0E6;
  --surface:  #EDE8DD;
  --card:     #FFFFFF;
  --card-alt: #F9F6F0;
  --border:   #D8D0C0;
  --text:     #1A1420;
  --text-sub: #5A5270;
  --text-dim: #9A92A8;
  --input-bg: #F0EDE6;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
}

[dir="rtl"] { font-family: 'Segoe UI', 'Arial', system-ui, sans-serif; }

/* ── Layout Shell ─────────────────────────────────────────── */
#auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: var(--bg);
  padding: 24px;
}

#app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

#app-shell.hidden, .hidden { display: none !important; }

/* ── Header ───────────────────────────────────────────────── */
header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.header-brand {
  flex: 1;
  min-width: 0;
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--yellow);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-subtitle {
  font-size: 10px;
  color: var(--text-sub);
  letter-spacing: 0.3px;
}

#header-role {
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
  white-space: nowrap;
}

.header-controls { display: flex; gap: 6px; align-items: center; }

.icon-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--border); }

/* ── Main content area ────────────────────────────────────── */
main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: var(--nav-h);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* ── Views ────────────────────────────────────────────────── */
.view { display: none; padding: 16px; min-height: calc(100vh - var(--header-h) - var(--nav-h)); }
.view.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Bottom Navigation ────────────────────────────────────── */
nav.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 10;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 10px;
  padding: 4px 2px;
  transition: color 0.2s;
  position: relative;
}

.nav-btn .nav-icon { font-size: 20px; }
.nav-btn.active { color: var(--yellow); }
.nav-btn.active::after {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--yellow);
  border-radius: 0 0 2px 2px;
}

/* ── Auth Screen ──────────────────────────────────────────── */
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 20px;
}

.auth-logo img, .auth-logo svg { width: 72px; height: 72px; }

.auth-logo-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--yellow);
  margin-top: 10px;
  letter-spacing: 1px;
}

.auth-logo-subtitle {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 4px;
}

.tribe-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--text-dim);
  font-size: 11px;
}
.tribe-line::before, .tribe-line::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.tribe-line span { white-space: nowrap; color: var(--red); }

/* Auth tabs */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 0;
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}
.auth-tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }

.auth-form { display: block; }
.auth-form.hidden { display: none !important; }

.btn-full { width: 100%; }
.btn-spinner { animation: spin 0.8s linear infinite; display: inline-block; }
.btn-spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-links {
  text-align: center;
  margin-top: 10px;
}
.auth-link {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 5px; }

input[type="email"],
input[type="password"],
input[type="text"],
textarea,
select {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--yellow); }
textarea { resize: vertical; min-height: 80px; }

.error-msg { color: var(--red); font-size: 13px; margin-top: 6px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--red);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { opacity: 0.88; }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
}
.btn-sm:hover { opacity: 0.85; }

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

/* ── Home View ────────────────────────────────────────────── */
.home-hero {
  background: linear-gradient(135deg, var(--card) 0%, #0E0E1E 100%);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.home-hero::before {
  content: '🕯';
  position: absolute;
  right: -12px;
  top: -8px;
  font-size: 80px;
  opacity: 0.05;
  color: var(--yellow);
  pointer-events: none;
}

.home-sacred-date {
  font-size: 17px;
  font-weight: 700;
  color: var(--yellow);
  margin-bottom: 6px;
}

.home-season-feast {
  font-size: 13px;
  color: var(--text-sub);
}

.home-feast-name {
  color: var(--red);
  font-weight: 600;
}

.home-badges { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.home-year-info {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 6px;
  letter-spacing: 0.2px;
}
.home-nisan-count {
  font-size: 11px;
  color: var(--yellow);
  margin-top: 2px;
  opacity: 0.8;
}

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.badge-sabt  { background: var(--blu-dim); color: #6A9AEF; border: 1px solid var(--blue); }
.badge-feast { background: var(--yel-dim); color: var(--yellow); border: 1px solid var(--yellow); }
.badge-nm    { background: var(--red-dim); color: #EF6A7A; border: 1px solid var(--red); }

.home-clock-mini {
  text-align: center;
  font-size: 28px;
  font-weight: 300;
  letter-spacing: 3px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin: 8px 0;
}

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }

.moon-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.moon-glyph { font-size: 36px; display: block; text-align: center; margin-bottom: 6px; }
.moon-name { font-size: 13px; font-weight: 600; text-align: center; }
.moon-age { font-size: 11px; color: var(--text-sub); text-align: center; margin-top: 3px; }
.moon-illumination { font-size: 11px; color: var(--yellow); text-align: center; }

.moon-alert {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 8px;
  text-align: center;
}
.moon-alert-invisible { background: var(--red-dim); color: #EF6A7A; }
.moon-alert-crescent  { background: var(--yel-dim); color: var(--yellow); }

.jubilee-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.jubilee-row { margin-bottom: 10px; }
.jubilee-label { font-size: 11px; color: var(--text-sub); margin-bottom: 4px; }
.jubilee-num { font-size: 22px; font-weight: 700; color: var(--blue); }
.jubilee-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 4px; }
.jubilee-bar-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 0.5s; }

.upcoming-feasts { margin-bottom: 14px; }
.upcoming-feast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.feast-icon { font-size: 18px; }
.feast-name { flex: 1; font-size: 13px; font-weight: 600; }
.feast-days { font-size: 11px; color: var(--yellow); font-weight: 600; }

/* ── Trumpet SVG overlay ──────────────────────────────────── */
.clock-canvas-wrap {
  position: relative;
  overflow: visible;   /* let trumpet bells extend past canvas edges */
}

.trumpet-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;   /* pass clicks through to canvas */
  z-index: 0;
}

/* Canvas sits above SVG so clock face hides the mouthpiece ends */
#clock-canvas {
  position: relative;
  z-index: 1;
  display: block;
}

/* Make trumpets individually clickable */
.trumpet-group {
  pointer-events: all;
  transition: filter 0.4s ease;
}

/* ─── Normal state — subtle metallic gleam ─── */
.trumpet-group {
  filter: drop-shadow(0.25px 0.35px 0.45px rgba(0,0,0,0.55));
}

/* Sound waves — hidden in normal state */
.tr-waves { display: none; }
.tr-wave {
  fill: none;
  stroke-width: 0.8;
  stroke-linecap: round;
  opacity: 0;
}
/* State symbols hidden by default */
.tr-state-symbol { display: none; }

/* ─── ALERT state (Sabt approaching / feast within 24 h) ─── */
@keyframes trumpet-pulse-alert {
  0%, 100% { filter: drop-shadow(0 0 1.5px rgba(240,180,41,0.35)); }
  50%       { filter: drop-shadow(0 0 5px   rgba(240,180,41,0.95)); }
}

#trumpet-svg.state-alert .trumpet-group {
  animation: trumpet-pulse-alert 2s ease-in-out infinite;
}

/* Sound waves for alert */
@keyframes wave-fade {
  0%   { opacity: 0;   stroke-dashoffset: 12; }
  40%  { opacity: 0.9;                        }
  100% { opacity: 0;   stroke-dashoffset: 0;  }
}

#trumpet-svg.state-alert .tr-waves { display: block; }
#trumpet-svg.state-alert .tr-wave {
  stroke: #F0B429;
  stroke-dasharray: 12;
  animation: wave-fade 1.8s ease-out infinite;
}
#trumpet-svg.state-alert .tr-wave-2 { animation-delay: 0.5s; }
#trumpet-svg.state-alert .tr-wave-3 { animation-delay: 1.0s; }

/* ─── DECREE state ─── */
@keyframes trumpet-pulse-decree {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(192,21,42,0.40)); }
  50%       { filter: drop-shadow(0 0 7px rgba(192,21,42,1.00)); }
}

#trumpet-svg.state-decree .trumpet-group {
  animation: trumpet-pulse-decree 1.4s ease-in-out infinite;
}
#trumpet-svg.state-decree .tr-waves { display: block; }
#trumpet-svg.state-decree .tr-wave {
  stroke: #C0152A;
  stroke-dasharray: 12;
  animation: wave-fade 1.4s ease-out infinite;
}
#trumpet-svg.state-decree .tr-wave-2 { animation-delay: 0.4s; }
#trumpet-svg.state-decree .tr-wave-3 { animation-delay: 0.8s; }
#trumpet-svg.state-decree #tr-decree-glyph { display: block; }

/* ─── NEW MOON state ─── */
@keyframes trumpet-pulse-moon {
  0%, 100% { filter: drop-shadow(0 0 1.5px rgba(180,210,255,0.30)); }
  50%       { filter: drop-shadow(0 0 4.5px rgba(180,210,255,0.85)); }
}

#trumpet-svg.state-newmoon .trumpet-group {
  animation: trumpet-pulse-moon 3s ease-in-out infinite;
}
#trumpet-svg.state-newmoon #tr-moon-glyph { display: block; }

/* ─── Digital mode small trumpet icons ─── */
.digital-time-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trumpet-icon-sm {
  width: 32px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.75;
  transition: opacity 0.3s, filter 0.3s;
}

/* Alert / decree glow on small digital icons */
.clock-container.state-alert .trumpet-icon-sm {
  filter: drop-shadow(0 0 3px rgba(240,180,41,0.9));
  opacity: 1;
  animation: trumpet-pulse-alert 2s ease-in-out infinite;
}
.clock-container.state-decree .trumpet-icon-sm {
  filter: drop-shadow(0 0 3px rgba(192,21,42,0.9));
  opacity: 1;
  animation: trumpet-pulse-decree 1.4s ease-in-out infinite;
}
.clock-container.state-newmoon .trumpet-icon-sm {
  filter: drop-shadow(0 0 2px rgba(180,210,255,0.75));
  opacity: 1;
}

/* ─── Trumpet info popup ─── */
.trumpet-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.trumpet-popup-inner {
  background: var(--surface);
  border: 1px solid #B0B0B0;
  border-radius: var(--radius);
  padding: 24px 20px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  animation: fadeIn 0.2s ease;
}

.trumpet-popup-icon {
  font-size: 36px;
  margin-bottom: 10px;
  color: var(--yellow);
  letter-spacing: 8px;
}

.trumpet-popup-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--yellow);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.trumpet-popup-ref {
  font-size: 12px;
  color: #A0A0A0;
  letter-spacing: 1px;
  margin-bottom: 14px;
  font-style: italic;
}

.trumpet-popup-desc {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text);
  font-style: italic;
}

/* ── Clock View ───────────────────────────────────────────── */
.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
}

.clock-canvas-wrap {
  width: 100%;
  max-width: 360px;
  display: flex;
  justify-content: center;
}

#clock-canvas { display: block; }

.clock-mode-bar {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: 100%;
  max-width: 300px;
}

.clock-mode-btn {
  flex: 1;
  padding: 8px 4px;
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  border-right: 1px solid var(--border);
}
.clock-mode-btn:last-child { border-right: none; }
.clock-mode-btn.active { background: var(--red); color: #fff; }

#clock-digital-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

#clock-digital-time {
  font-size: 46px;
  font-weight: 200;
  letter-spacing: 3px;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.clock-digital-label { font-size: 11px; color: var(--text-sub); letter-spacing: 2px; text-transform: uppercase; }

#clock-real-time { font-size: 16px; color: var(--text-sub); font-variant-numeric: tabular-nums; }

.prayer-times-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.prayer-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}
.prayer-row:last-child { border-bottom: none; }
.prayer-label { color: var(--text); font-weight: 500; }
.prayer-sacred { color: var(--yellow); font-variant-numeric: tabular-nums; font-weight: 600; }
.prayer-real   { color: var(--text-sub); font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }

/* ── Calendar View ────────────────────────────────────────── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}

.cal-nav-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-nav-btn:hover { background: var(--border); }

#cal-month-name {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--yellow);
}

/* Calendar grid — sequential layout */
#cal-grid { display: flex; flex-direction: column; gap: 6px; }

.cal-info-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 2px;
  font-size: 11px;
}

.cal-nm-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
}
.cal-nm-status.confirmed  { background: rgba(240,180,41,0.18); color: var(--yellow); }
.cal-nm-status.predicted  { background: rgba(192,21,42,0.12);  color: var(--text-sub); font-style: italic; }

.cal-seq-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.cal-cell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 2px;
  min-height: 50px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 10px;
  cursor: default;
}

/* New Moon feast cells */
.cal-cell.nm-feast {
  background: rgba(240,180,41,0.14);
  border-color: var(--yellow);
}
.cal-cell.nm-feast .cal-day-num { color: var(--yellow); }

/* Predicted NM — dimmer */
.cal-cell.nm-predicted {
  background: rgba(240,180,41,0.06);
  border-color: rgba(240,180,41,0.35);
  border-style: dashed;
}
.cal-cell.nm-predicted .cal-day-num { color: rgba(240,180,41,0.6); }

.cal-cell.nm-confirmed {
  background: rgba(240,180,41,0.16);
  border-color: var(--yellow);
}

.cal-cell.sabt { background: var(--blu-dim); border-color: var(--blue); }
.cal-cell.feast { background: var(--yel-dim); border-color: var(--yellow); }
.cal-cell.today { box-shadow: 0 0 0 2px var(--red) !important; border-color: var(--red); }
.cal-cell.empty { background: none; border: 1px dashed var(--border); opacity: 0.2; min-height: 50px; }

.cal-day-num  { font-size: 14px; font-weight: 700; color: var(--text); line-height: 1; }
.cal-day-greg { font-size: 9px;  color: var(--text-dim); }
.cal-sabt-tag { font-size: 9px;  color: #6A9AEF; font-weight: 700; }
.cal-feast-tag  { font-size: 11px; }
.cal-predicted-tag { font-size: 8px; color: rgba(240,180,41,0.6); }

/* Calendar legend */
.cal-legend {
  display: flex;
  gap: 12px;
  padding: 6px 0 0;
  font-size: 10px;
  color: var(--text-sub);
}
.leg-nm     { color: var(--yellow); font-weight: 700; }
.leg-sabt   { color: #6A9AEF; font-weight: 700; }
.leg-today  { color: var(--red); font-weight: 700; }

/* NM Declaration panel */
.nm-decl-wrap { margin-top: 16px; }
.nm-decl-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.nm-decl-btns { display: flex; flex-direction: column; gap: 10px; }

.btn-nm-begin {
  background: linear-gradient(135deg, #1A1A30 0%, #2a1a00 100%);
  color: var(--yellow);
  border: 1px solid rgba(240,180,41,0.4);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-nm-begin:hover {
  background: linear-gradient(135deg, #22223a 0%, #3a2200 100%);
  box-shadow: 0 0 16px rgba(240,180,41,0.2);
}

.btn-nm-end {
  background: linear-gradient(135deg, #0d1a2a 0%, #0a2a1a 100%);
  color: #8ED4B0;
  border: 1px solid rgba(100,200,150,0.35);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 700;
  width: 100%;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-nm-end:hover {
  background: linear-gradient(135deg, #0f2035 0%, #0c3520 100%);
  box-shadow: 0 0 16px rgba(100,200,150,0.15);
}

/* Jubilee/Remission bars */
.jubilee-bars { margin-top: 16px; }
.jubilee-bar-row { margin-bottom: 12px; }
#jubilee-label, #remission-label { font-size: 12px; color: var(--text-sub); margin-bottom: 4px; display: block; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; }
#jubilee-bar-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.5s; }
#remission-bar-fill { height: 100%; background: var(--red); border-radius: 3px; transition: width 0.5s; }

/* ── Broadcasts View ──────────────────────────────────────── */
.broadcasts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title { font-size: 18px; font-weight: 700; color: var(--text); }

#broadcast-compose {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.broadcast-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}

.broadcast-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.broadcast-role {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.role-rabshakeh  { background: rgba(192,21,42,0.2);  color: #FF6677; border: 1px solid var(--red); }
.role-highpriest { background: rgba(240,180,41,0.15); color: #F0B429; border: 1px solid var(--yellow); }
.role-priest     { background: rgba(26,75,140,0.2);  color: #6A9AEF; border: 1px solid var(--blue); }
.role-judge      { background: rgba(100,180,100,0.15); color: #80C880; border: 1px solid #40A040; }
.role-sheikh     { background: rgba(180,120,240,0.15); color: #C080FF; border: 1px solid #9050C0; }
.role-sultan     { background: rgba(240,120,60,0.15);  color: #FF9060; border: 1px solid #C05020; }
.role-member     { background: var(--card); color: var(--text-sub); border: 1px solid var(--border); }

.broadcast-author { font-size: 13px; font-weight: 600; flex: 1; }
.broadcast-time   { font-size: 11px; color: var(--text-sub); }
.broadcast-body   { font-size: 14px; line-height: 1.6; color: var(--text); white-space: pre-wrap; }

.btn-del-broadcast {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
}
.btn-del-broadcast:hover { color: var(--red); }

.empty-msg { color: var(--text-sub); text-align: center; padding: 32px; }

/* ── Profile View ─────────────────────────────────────────── */
.profile-header {
  text-align: center;
  padding: 24px 16px;
  margin-bottom: 14px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 12px;
  color: var(--yellow);
}

.profile-name { font-size: 20px; font-weight: 700; }
.profile-email { font-size: 13px; color: var(--text-sub); margin-top: 4px; }
.profile-role-badge {
  margin-top: 10px;
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
}

.app-version-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 8px 4px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
#app-version-label { font-weight: 600; color: var(--text-sub); }
#app-version-date  { font-style: italic; }

/* ── Admin View ───────────────────────────────────────────── */
.admin-user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.admin-role-badge { font-size: 18px; }
.admin-user-name  { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-email { font-size: 11px; color: var(--text-sub); width: 100%; }
.admin-user-region { font-size: 11px; color: var(--blue); }

.admin-user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.select-role {
  flex: 1;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 12px;
}

.input-region {
  flex: 1;
  min-width: 100px;
  padding: 6px 10px;
  font-size: 12px;
}

/* ── Toast Notifications ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  width: 90%;
  max-width: 340px;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  text-align: center;
}
.toast.visible { opacity: 1; transform: none; }
.toast-success { background: #1A3A20; color: #60D080; border: 1px solid #40A060; }
.toast-error   { background: #3A1A20; color: #FF6677; border: 1px solid var(--red); }
.toast-info    { background: var(--card); color: var(--text); border: 1px solid var(--border); }

/* ── Decree System ────────────────────────────────────────── */

/* Home page banner */
.decree-banner {
  background: linear-gradient(135deg, rgba(240,180,41,0.10) 0%, rgba(240,180,41,0.03) 100%);
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.decree-banner:hover { opacity: 0.88; }

.decree-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.decree-banner-icon { font-size: 22px; flex-shrink: 0; }

.decree-banner-text { flex: 1; min-width: 0; }

.decree-banner-title {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 2.5px;
  color: var(--yellow);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.decree-banner-summary {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.decree-banner-read {
  width: 28px;
  height: 28px;
  background: var(--yellow);
  color: #000;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

/* Broadcasts feed: pinned decree card */
.decree-feed-card {
  background: linear-gradient(135deg, rgba(240,180,41,0.08) 0%, var(--card) 100%);
  border: 2px solid var(--yellow);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.decree-feed-card:hover { opacity: 0.88; }

.decree-feed-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.decree-feed-icon { font-size: 18px; }

.decree-feed-type {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: var(--yellow);
  text-transform: uppercase;
  background: var(--yel-dim);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(240,180,41,0.3);
}

.decree-feed-issuer { font-size: 12px; font-weight: 600; flex: 1; }
.decree-feed-date   { font-size: 11px; color: var(--text-sub); }

.decree-feed-summary {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.decree-feed-read {
  margin-top: 8px;
  font-size: 11px;
  color: var(--yellow);
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Calendar decree indicator */
.cal-decree-tag {
  font-size: 10px;
  color: var(--yellow);
  font-weight: 700;
  letter-spacing: 0;
}

/* Admin tabs */
.admin-tabs {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.admin-tab-btn {
  flex: 1;
  padding: 10px 8px;
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
  border-right: 1px solid var(--border);
}
.admin-tab-btn:last-child { border-right: none; }
.admin-tab-btn.active { background: var(--red); color: #fff; font-weight: 700; }

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; animation: fadeIn 0.2s ease; }

/* Decree form */
.decree-form-actions {
  display: flex;
  gap: 10px;
  margin: 12px 0 8px;
}
.decree-form-actions .btn { flex: 1; }

.decree-preview-box {
  background: var(--yel-dim);
  border: 1px solid rgba(240,180,41,0.4);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  margin-top: 4px;
}

.decree-radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.decree-radio-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  font-family: var(--font);
}
.decree-radio-btn.selected {
  background: var(--yellow);
  color: #000;
  border-color: var(--yellow);
}

/* Admin decree list items */
.decree-item {
  background: var(--card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
}
.decree-item.active-decree {
  border-color: var(--yellow);
  background: linear-gradient(135deg, rgba(240,180,41,0.06) 0%, var(--card-alt) 100%);
}
.decree-item.superseded-decree { opacity: 0.45; }
.decree-item.superseded-decree .decree-item-title { text-decoration: line-through; }

.decree-item-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.decree-item-type {
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--yellow);
  text-transform: uppercase;
  background: var(--yel-dim);
  padding: 2px 8px;
  border-radius: 10px;
}

.decree-item-title { font-size: 13px; font-weight: 600; flex: 1; }
.decree-item-meta  { font-size: 11px; color: var(--text-sub); margin-top: 3px; }
.decree-item-text  { font-size: 12px; color: var(--text); margin-top: 6px; font-style: italic; line-height: 1.5; }

.decree-item-actions { margin-top: 8px; display: flex; gap: 8px; }

/* Decree modal (slide-up bottom sheet) */
.decree-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: flex-end;
}

.decree-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
}

.decree-modal-inner {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--yellow);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  padding: 20px 18px;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(32px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.decree-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 700;
  color: var(--yellow);
}

.decree-modal-content { font-size: 14px; line-height: 1.7; color: var(--text); }

.decree-modal-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 14px;
  font-size: 12px;
  margin-bottom: 14px;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.decree-modal-meta-label { font-weight: 700; color: var(--yellow); white-space: nowrap; }
.decree-modal-meta-value { color: var(--text); }

.decree-modal-section { margin: 12px 0; }
.decree-modal-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.decree-modal-proclamation {
  background: var(--card);
  border-left: 3px solid var(--yellow);
  padding: 12px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  line-height: 1.8;
  white-space: pre-wrap;
}

.decree-modal-proclamation-ar {
  background: var(--card);
  border-right: 3px solid var(--yellow);
  border-left: none;
  padding: 12px 14px;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-style: italic;
  line-height: 1.8;
  text-align: right;
  direction: rtl;
  white-space: pre-wrap;
}

.decree-modal-scripture {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 10px;
  font-style: italic;
}

/* ── Tribal decorative elements ───────────────────────────── */
.tribal-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--red);
  font-size: 12px;
  margin: 12px 0;
  opacity: 0.6;
}
.tribal-divider::before, .tribal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--red), transparent);
}

/* ── RTL Adjustments ──────────────────────────────────────── */
[dir="rtl"] .broadcast-header { direction: rtl; }
[dir="rtl"] .prayer-row { direction: rtl; }
[dir="rtl"] .prayer-real { text-align: left; }
[dir="rtl"] .admin-user-actions { direction: rtl; }
[dir="rtl"] .cal-week-row, [dir="rtl"] .cal-week-header { direction: rtl; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 600px) {
  .home-grid { grid-template-columns: repeat(3, 1fr); }
  .view { max-width: 640px; margin: 0 auto; }
  header { padding: 0 24px; }
  #app-shell { max-width: 640px; margin: 0 auto; position: relative; }
  nav.bottom-nav { max-width: 640px; margin: 0 auto; left: 50%; transform: translateX(-50%); right: auto; width: 640px; }
}

@media (max-width: 380px) {
  .cal-cell { min-height: 44px; padding: 4px 2px; }
  .cal-day-num { font-size: 13px; }
  #clock-digital-time { font-size: 36px; letter-spacing: 2px; }
  .trumpet-icon-sm { width: 24px; height: 10px; }
}
