/* ============================================================
   AALIM (عالم) — Clean, Readable Light Design System
   Simple, calm, accessible Islamic research & reading UI
   ============================================================ */

:root {
  /* Palette */
  --bg-canvas: #fafaf8;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-emerald-soft: #ecfdf5;
  --bg-gold-soft: #fffbeb;

  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;

  --green-700: #047857;
  --green-600: #059669;
  --green-500: #10b981;
  --green-800: #065f46;
  --green-900: #064e3b;

  --gold-600: #92400e;
  --gold-500: #b45309;
  --gold-400: #d97706;
  --gold-200: #fde68a;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;

  /* Backward-compatible aliases (all light) */
  --dark-950: #fafaf8;
  --dark-900: #ffffff;
  --dark-800: #ffffff;
  --dark-700: #f1f5f9;
  --dark-600: #e2e8f0;
  --white: #0f172a;
  --green-400: #047857;
  --green-300: #065f46;
  --gold-300: #b45309;

  /* Typography */
  --font-en: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-ar: 'Amiri', 'Traditional Arabic', serif;
  --font-ur: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;

  /* Shape & Elevation */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);

  --max-width: 1160px;
  --reading-width: 820px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-en);
  background: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[dir="rtl"] body,
html[lang="ur"] body,
html[lang="fa"] body {
  font-family: var(--font-ur), var(--font-en);
}

main#main-content {
  flex: 1;
}

a {
  color: var(--green-700);
  text-decoration: none;
}

a:hover {
  color: var(--green-800);
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.reading-container {
  width: 100%;
  max-width: var(--reading-width);
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  width: auto;
  height: auto;
  clip: auto;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  background: var(--green-700);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

/* ============================================================
   SINGLE CLEAN HEADER & NAVIGATION
   ============================================================ */
.site-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-ar {
  font-family: var(--font-ar);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--green-700);
  line-height: 1;
}

.brand-en {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.nav-primary {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: var(--bg-emerald-soft);
  color: var(--green-700);
  font-weight: 600;
}

/* Tools dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}

.nav-dropdown summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown summary:hover,
.nav-dropdown[open] summary,
.nav-dropdown.is-active summary {
  background: var(--bg-emerald-soft);
  color: var(--green-700);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
}

[dir="rtl"] .nav-dropdown-menu {
  left: auto;
  right: 0;
}

.nav-dropdown-item {
  display: block;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.nav-dropdown-item:hover,
.nav-dropdown-item.active {
  background: var(--bg-emerald-soft);
  color: var(--green-700);
}

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

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.header-icon-btn:hover {
  border-color: var(--green-600);
  color: var(--green-700);
  background: var(--bg-emerald-soft);
}

/* Language switcher */
.lang-dropdown-wrapper {
  position: relative;
}

.lang-switch-btn {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  user-select: none;
}

.lang-switch-btn::-webkit-details-marker {
  display: none;
}

.lang-switch-btn:hover {
  border-color: var(--green-600);
  color: var(--green-700);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 250;
}

[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

.lang-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.lang-menu-item:hover,
.lang-menu-item.active {
  background: var(--bg-emerald-soft);
  color: var(--green-700);
  font-weight: 600;
}

.lang-item-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Mobile menu button & drawer */
.nav-mobile-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.mobile-nav-drawer {
  display: none;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 14px 20px 20px;
}

.mobile-nav-drawer.open {
  display: block;
}

.mobile-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.mobile-nav-grid a {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.mobile-nav-grid a.active {
  background: var(--bg-emerald-soft);
  border-color: var(--green-500);
  color: var(--green-700);
  font-weight: 600;
}

@media (max-width: 920px) {
  .nav-primary {
    display: none;
  }
  .nav-mobile-toggle {
    display: inline-flex;
  }
}

@media (max-width: 480px) {
  .header-search-label {
    display: none;
  }
  .mobile-nav-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb {
  padding: 14px 0 4px;
  font-size: 0.85rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.breadcrumb a {
  color: var(--green-700);
  font-weight: 500;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.bc-sep {
  color: var(--text-muted);
}

/* ============================================================
   COMMON BUTTONS, CARDS & TYPOGRAPHY HELPERS
   ============================================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--green-700);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--green-800);
  color: #ffffff;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-secondary:hover {
  border-color: var(--green-600);
  background: var(--bg-emerald-soft);
  color: var(--green-700);
}

.btn-outline-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-outline-pill:hover {
  border-color: var(--green-700);
  background: var(--bg-emerald-soft);
  color: var(--green-700);
}

.page-header-simple {
  padding: 28px 0 24px;
}

.page-header-simple h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.25rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 8px;
}

.page-header-simple p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 720px;
}

.simple-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.arabic-block {
  font-family: var(--font-ar);
  font-size: 1.65rem;
  line-height: 2.35;
  color: var(--green-900);
  direction: rtl;
  text-align: right;
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.urdu-block {
  font-family: var(--font-ur);
  font-size: 1.05rem;
  line-height: 2.15;
  color: var(--text-secondary);
  direction: rtl;
  text-align: right;
}

/* ============================================================
   HOMEPAGE — CALM, FOCUSED & EASY TO READ
   ============================================================ */
.hero-simple {
  padding: 44px 0 32px;
  background: linear-gradient(180deg, #ecfdf5 0%, #fafaf8 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.hero-top-center {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 28px;
}

.bismillah-line {
  font-family: var(--font-ar);
  font-size: 1.45rem;
  color: var(--green-700);
  margin-bottom: 10px;
  direction: rtl;
}

.hero-top-center h1 {
  font-size: clamp(1.85rem, 4vw, 2.65rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Chat Panel (Main Focus on Homepage) */
.aalim-chat-wrapper {
  max-width: 860px;
  margin: 0 auto;
}

.chat-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: #ffffff;
}

.chat-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green-500);
  display: inline-block;
}

.chat-title-group strong {
  font-size: 0.98rem;
  color: var(--text-primary);
}

.chat-title-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.chat-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-select-luxury {
  padding: 7px 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.custom-select-luxury:focus {
  border-color: var(--green-600);
}

.btn-chat-action {
  padding: 7px 13px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-chat-action:hover {
  border-color: var(--green-600);
  color: var(--green-700);
}

.chat-messages {
  padding: 20px;
  max-height: 460px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-empty-state {
  text-align: center;
  padding: 14px 8px;
}

.empty-state-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.empty-state-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.preset-chip {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover {
  background: var(--bg-emerald-soft);
  border-color: var(--green-500);
  color: var(--green-700);
}

.chat-input-area {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
}

.input-container-luxury {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 8px 10px 8px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-container-luxury:focus-within {
  border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.input-container-luxury textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.98rem;
  line-height: 1.5;
  padding: 6px 0;
  min-height: 36px;
}

.input-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-util-btn {
  padding: 7px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.input-util-btn.listening {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
}

.send-btn-luxury {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--green-700);
  color: #fff;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.send-btn-luxury:hover {
  background: var(--green-800);
}

.send-btn-luxury:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-footer-hints {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Chat messages */
.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.message.user-msg {
  flex-direction: row-reverse;
}

.msg-avatar-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-emerald-soft);
  color: var(--green-700);
  border: 1px solid #a7f3d0;
}

.user-msg .msg-avatar-icon {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.msg-bubble {
  max-width: 88%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.user-speech-bubble {
  background: var(--bg-emerald-soft);
  border-color: #a7f3d0;
}

.msg-header-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 0.78rem;
}

.bot-label {
  font-weight: 700;
  color: var(--green-700);
}

.bot-label.error-label {
  color: #b91c1c;
}

.user-label {
  font-weight: 700;
  color: var(--text-secondary);
}

.msg-time-badge {
  color: var(--text-muted);
}

.msg-content-body {
  font-size: 0.96rem;
  line-height: 1.75;
  color: var(--text-primary);
}

.msg-para {
  margin-bottom: 10px;
}

.msg-para:last-child {
  margin-bottom: 0;
}

.msg-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 8px;
}

.heading-num-badge {
  background: var(--bg-emerald-soft);
  color: var(--green-700);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 6px;
}

.heading-title-text {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.islamic-verse-callout {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--gold-400);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 10px 0;
}

.verse-callout-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-500);
}

.verse-callout-arabic {
  font-family: var(--font-ar);
  font-size: 1.35rem;
  line-height: 2.1;
  color: var(--green-900);
  direction: rtl;
  text-align: right;
  margin: 6px 0;
}

.verse-callout-translation {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.islamic-bullet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}

.msg-bullet-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.bullet-dot {
  color: var(--green-600);
  font-size: 0.75rem;
  margin-top: 4px;
}

.msg-sources-container {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.msg-sources-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.msg-sources-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.msg-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-emerald-soft);
  border: 1px solid #a7f3d0;
  color: var(--green-700);
  font-size: 0.78rem;
  font-weight: 600;
}

.msg-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.msg-action-btn {
  padding: 5px 11px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: var(--bg-canvas);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.msg-action-btn:hover {
  border-color: var(--green-600);
  color: var(--green-700);
}

.error-msg-box,
.error-msg {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-600);
  animation: pulseDot 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulseDot {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

.loading-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--green-700);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.7s linear infinite;
}

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

/* Prayer Times Strip on Homepage */
.prayer-times-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 0;
}

.prayer-bar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.prayer-bar-city {
  font-size: 0.92rem;
  color: var(--text-primary);
  display: block;
}

.prayer-bar-hijri {
  font-size: 0.8rem;
  color: var(--gold-500);
  font-weight: 600;
}

.prayer-bar-timings {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.prayer-time-box {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  text-align: center;
  min-width: 78px;
}

.pt-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.pt-val {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--green-700);
}

.prayer-bar-link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--green-700);
  white-space: nowrap;
}

/* Explore Grid */
.home-section {
  padding: 44px 0;
}

.home-section-alt {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

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

.section-head-row h2 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-primary);
}

.section-head-row p {
  font-size: 0.94rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.explore-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.explore-card:hover {
  border-color: var(--green-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.explore-card-meta {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--green-700);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.explore-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.explore-card p {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Simple Book Cards */
.books-simple-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.book-simple-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.book-simple-card:hover {
  border-color: var(--green-600);
  box-shadow: var(--shadow-md);
}

.book-simple-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.book-year-pill {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--gold-600);
  background: var(--bg-gold-soft);
  border: 1px solid var(--gold-200);
  padding: 2px 9px;
  border-radius: 999px;
}

.book-order-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.book-title-ar-sm {
  font-family: var(--font-ar);
  font-size: 1.35rem;
  color: var(--green-900);
  direction: rtl;
  text-align: right;
  margin-bottom: 4px;
}

.book-title-en-sm {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.book-author-sm {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.book-desc-sm {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.84rem;
}

.book-unit-muted {
  color: var(--text-muted);
}

.book-read-link {
  font-weight: 600;
  color: var(--green-700);
}

/* FAQ List */
.faq-simple-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.faq-simple-item {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.faq-simple-item:hover {
  border-color: var(--green-600);
  box-shadow: var(--shadow-sm);
}

.faq-simple-cat {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--green-700);
  background: var(--bg-emerald-soft);
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.faq-simple-q {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
}

/* ============================================================
   BOOKS CATALOG PAGE (/books)
   ============================================================ */
.books-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.search-inline-box {
  flex: 1 1 280px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0 12px;
}

.search-inline-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 10px 4px;
  font-family: inherit;
  font-size: 0.94rem;
  color: var(--text-primary);
  background: transparent;
}

.btn-clear-search {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px;
}

.books-view-switcher {
  display: inline-flex;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface);
}

.btn-view-toggle {
  border: none;
  background: transparent;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-view-toggle.active {
  background: var(--green-700);
  color: #fff;
}

.filter-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.cat-tab-btn {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--border-medium);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
}

.cat-tab-btn:hover,
.cat-tab-btn.active {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
  font-weight: 600;
}

.table-responsive {
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.books-canonical-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.books-canonical-table th,
.books-canonical-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: middle;
}

.books-canonical-table th {
  background: var(--bg-canvas);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.tbl-title-en {
  font-weight: 700;
  color: var(--text-primary);
}

.tbl-title-ar {
  font-family: var(--font-ar);
  font-size: 1.05rem;
  color: var(--green-700);
}

.btn-tbl-read {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--bg-emerald-soft);
  color: var(--green-700);
  font-weight: 600;
  font-size: 0.82rem;
}

/* ============================================================
   CLEAN FOOTER
   ============================================================ */
.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  margin-top: 40px;
  padding: 40px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 28px;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.footer-about {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 380px;
}

.footer-verse {
  font-family: var(--font-ar);
  font-size: 1.15rem;
  color: var(--green-700);
  margin: 10px 0 4px;
}

.footer-col h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--green-700);
}

.footer-disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .msg-bubble {
    max-width: 96%;
  }
}
