/* ==========================================================================
   AMANAH MASJID - Stylesheet Utama (Siap Offline & Hosting)
   Anda dapat mengedit warna, font, dan tata letak langsung dari Notepad.
   ========================================================================== */

:root {
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --accent: #047857;
  --accent-hover: #065f46;
  --accent-soft: #ecfdf5;
  --accent-text: #047857;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --sky: #0284c7;
  --sky-soft: #f0f9ff;
  --amber: #d97706;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.14);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

html.dark {
  --bg-canvas: #020617;
  --bg-surface: #0f172a;
  --bg-subtle: #1e293b;
  --border-color: #1e293b;
  --text-main: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-soft: #94a3b8;
  --accent: #059669;
  --accent-hover: #10b981;
  --accent-soft: rgba(5, 150, 105, 0.14);
  --accent-text: #34d399;
  --danger: #f87171;
  --danger-soft: rgba(220, 38, 38, 0.14);
  --sky: #38bdf8;
  --sky-soft: rgba(2, 132, 199, 0.14);
  --amber: #fbbf24;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.5);
}

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

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: 'DM Sans', 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.mono-num {
  font-family: 'JetBrains Mono', 'Consolas', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- Layout Shell (Desktop Sidebar + Topbar + Mobile Bottom Nav) ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-color);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-link {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-color);
}

.next-prayer-mini {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.main-area {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.mobile-brand {
  display: none;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ---------- Cards, Surfaces & Grid ---------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}

.card-flush {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-6-prayers {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.split-7-5 {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: 18px;
}

/* ---------- Hero Banner ---------- */
.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 260px;
  background: #0f172a;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px;
  color: #ffffff;
}

.hero-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.52;
  z-index: 0;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.35) 0%, rgba(2, 6, 23, 0.72) 55%, rgba(2, 6, 23, 0.92) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
}

.hero-top-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #e2e8f0;
}

.hero-bottom-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.hero-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  line-height: 1.25;
  max-width: 620px;
  color: #ffffff;
}

.hero-subtitle {
  font-size: 13px;
  color: #e2e8f0;
  margin-top: 6px;
  max-width: 580px;
}

/* ---------- Buttons & Inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-dark {
  background: #0f172a;
  color: #ffffff;
}

html.dark .btn-dark {
  background: var(--accent);
}

.btn-outline {
  background: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-outline:hover {
  background: var(--bg-subtle);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  backdrop-filter: blur(6px);
}

.btn-glass:hover { background: rgba(255, 255, 255, 0.26); }

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  min-height: 36px;
  padding: 6px 10px;
}

.btn-danger-ghost:hover { background: var(--danger-soft); }

.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.15);
}

.textarea {
  min-height: 86px;
  resize: vertical;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ---------- Typography Helpers ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.page-title {
  font-size: clamp(20px, 2.5vw, 25px);
  font-weight: 700;
}

.page-desc {
  font-size: 13.5px;
  color: var(--text-soft);
  margin-top: 4px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
}

.muted { color: var(--text-soft); font-size: 12.5px; }
.text-emerald { color: var(--accent-text); }
.text-danger { color: var(--danger); }
.text-sky { color: var(--sky); }

/* ---------- Prayer Cards ---------- */
.prayer-tile {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 13px 14px;
}

.prayer-tile.is-next {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.prayer-tile.is-next .prayer-label {
  color: #d1fae5;
}

.prayer-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.prayer-time {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
}

/* ---------- Progress Bars & Stepper ---------- */
.progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}

.progress-fill-emerald {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.progress-fill-sky {
  height: 100%;
  border-radius: 999px;
  background: var(--sky);
}

.stage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--border-color);
}

.stage-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-subtle);
  margin-bottom: 5px;
}

.stage-bar.done {
  background: var(--accent);
}

/* ---------- Tables & Lists ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.ledger {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

table.ledger th {
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.ledger td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

table.ledger tr:hover td {
  background: var(--bg-subtle);
}

.list-divided > * + * {
  border-top: 1px solid var(--border-color);
}

/* ---------- Segmented Filter Tabs ---------- */
.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  gap: 4px;
  flex-wrap: wrap;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

/* ---------- SVG Chart Bars ---------- */
.chart-bars-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 195px;
  padding-top: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.chart-col-btn {
  flex: 1;
  height: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
  padding: 6px 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.chart-col-btn.active,
.chart-col-btn:hover {
  background: var(--bg-subtle);
}

.chart-pair {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
  width: 100%;
  height: 155px;
}

.bar-in {
  width: 16px;
  border-radius: 5px 5px 0 0;
  background: var(--accent);
}

.bar-out {
  width: 16px;
  border-radius: 5px 5px 0 0;
  background: #e11d48;
}

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-lg);
}

/* ---------- Mobile Bottom Navigation Bar ---------- */
.mobile-bottom-nav {
  display: none;
}

.mobile-more-drawer {
  display: none;
}

.alert-box {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  border: 1px solid var(--border-color);
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.35);
}

.alert-success {
  background: var(--accent-soft);
  color: var(--accent-text);
  border-color: rgba(4, 120, 87, 0.35);
}

.avatar-img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.avatar-initials {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.program-cover {
  width: 100%;
  height: 185px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-color);
  display: block;
}

.code-tag {
  display: inline-block;
  font-family: 'JetBrains Mono', 'Consolas', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  white-space: nowrap;
}

.mobile-more-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(2, 6, 23, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.mobile-more-backdrop.open {
  display: flex;
}

.mobile-more-sheet {
  width: 100%;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  border-radius: 18px 18px 0 0;
  padding: 18px 18px 84px;
  box-shadow: var(--shadow-lg);
}

/* ---------- Responsive Mobile (< 960px) ---------- */
@media (max-width: 960px) {
  .sidebar { display: none; }
  .main-area {
    margin-left: 0;
    padding-bottom: 84px;
  }
  .topbar {
    height: 56px;
    padding: 0 16px;
  }
  .mobile-brand { display: flex; }
  .topbar-title { display: none; }
  .container { padding: 16px; gap: 16px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .split-7-5 { grid-template-columns: 1fr; }
  .grid-6-prayers { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    z-index: 45;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .mobile-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-soft);
    border: none;
    background: transparent;
    cursor: pointer;
    min-height: 44px;
  }

  .mobile-tab.active {
    color: var(--accent-text);
    font-weight: 700;
  }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .hide-sm { display: none !important; }
}

@media print {
  .sidebar, .topbar, .mobile-bottom-nav, .no-print { display: none !important; }
  .main-area { margin-left: 0; padding-bottom: 0; }
}
