/* Dua — clean light Islamic aesthetic */
:root {
  --bg: #faf7f0;          /* warm cream */
  --surface: #ffffff;
  --ink: #2b3328;
  --muted: #7a8273;
  --emerald: #0f6b4f;     /* primary green */
  --emerald-dark: #0a4f3a;
  --gold: #b98a2f;        /* accent */
  --gold-soft: #f3e8cf;
  --border: #e4ddcb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(43, 51, 40, 0.08), 0 4px 14px rgba(43, 51, 40, 0.05);
  --serif: 'Amiri', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

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

.container { width: min(960px, 92%); margin: 0 auto; }

/* header */
.site-header {
  background: linear-gradient(135deg, var(--emerald), var(--emerald-dark));
  color: #fff;
  box-shadow: 0 2px 10px rgba(10, 79, 58, 0.25);
  position: sticky; top: 0; z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark { font-family: var(--serif); font-size: 1.5rem; color: var(--gold-soft); }
.brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: 0.02em; }
.nav { display: flex; gap: 18px; }
.nav a { color: #e8f2ec; text-decoration: none; font-size: 0.95rem; padding: 6px 2px; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.active { color: #fff; border-bottom-color: var(--gold); }

/* main */
main { flex: 1; padding: 28px 0 48px; }

.loading { text-align: center; color: var(--muted); padding: 60px 0; }
.error { background: #fdecea; border: 1px solid #f5c6c0; color: #8a2f22; padding: 16px; border-radius: var(--radius); }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.muted { color: var(--muted); font-weight: 400; }

/* hero */
.hero { text-align: center; padding: 34px 0 10px; }
.hero-title { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 700; }
.hero-title em { font-family: var(--serif); color: var(--emerald); font-style: italic; }
.hero-sub { color: var(--muted); margin-top: 6px; }

/* search bar */
.search-bar { display: flex; gap: 8px; max-width: 480px; margin: 18px auto 0; }
.search-bar input {
  flex: 1; padding: 11px 16px; border: 1.5px solid var(--border); border-radius: 999px;
  font: inherit; background: var(--surface); outline: none;
}
.search-bar input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(15, 107, 79, 0.12); }
.search-bar button {
  padding: 11px 22px; border: 0; border-radius: 999px; background: var(--emerald); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer;
}
.search-bar button:hover { background: var(--emerald-dark); }

/* sections */
.cat-section, .grid-section { margin-top: 36px; }
.cat-section h2, .grid-section h2, .hadith-section h2 { font-size: 1.15rem; margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* all-categories wall: expanded by default, collapsible */
.chips-all { max-height: none; transition: max-height 0.25s ease; }
.chips-all.collapsed { max-height: 12.5em; overflow: hidden; }
.chips-toggle {
  margin-top: 10px; background: none; border: 1px solid var(--border); color: var(--emerald);
  border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 0.85rem; cursor: pointer;
}
.chips-toggle:hover { border-color: var(--emerald); background: var(--gold-soft); }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; color: var(--emerald); text-decoration: none; font-size: 0.9rem;
}
.chip:hover { border-color: var(--emerald); background: var(--gold-soft); }
.chip-more { color: var(--gold); }

/* doa grid */
.doa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.doa-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform 0.12s ease, box-shadow 0.12s ease; display: block;
}
.doa-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(43, 51, 40, 0.12); }
.doa-card-name { font-size: 1.05rem; color: var(--emerald-dark); }
.doa-card-en { font-size: 0.85rem; color: var(--muted); }
.doa-card-arabic {
  font-family: var(--serif); font-size: 1.15rem; line-height: 2; margin: 10px 0 8px;
  color: var(--ink); text-align: right;
}
.doa-card-cats { font-size: 0.78rem; color: var(--gold); }

/* pager */
.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 26px; align-items: center; }
.pg {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px;
  padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--emerald); text-decoration: none; font-size: 0.92rem;
}
.pg:hover { border-color: var(--emerald); background: var(--gold-soft); }
.pg-cur { background: var(--emerald); color: #fff; border-color: var(--emerald); font-weight: 600; }
.pg-nav { font-weight: 600; }
.pg-dis { color: var(--muted); opacity: 0.5; pointer-events: none; }

/* page head */
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; }
.back { color: var(--emerald); text-decoration: none; font-size: 0.9rem; display: inline-block; margin-bottom: 8px; }
.back:hover { text-decoration: underline; }
.page-head .search-bar { margin: 16px 0 4px; }

/* doa detail */
.doa-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.doa-name { font-size: 1.6rem; color: var(--emerald-dark); }
.doa-name-en { color: var(--muted); margin-bottom: 12px; }
.doa-detail .chips { margin-bottom: 20px; }
.doa-arabic {
  font-family: var(--serif); font-size: 1.7rem; line-height: 2.1; text-align: right;
  background: var(--gold-soft); border-radius: 12px; padding: 22px 24px; margin-bottom: 18px;
}
.doa-refs { list-style: none; margin-bottom: 18px; color: var(--muted); font-size: 0.95rem; }
.doa-refs li::before { content: '📖 '; }
.meaning, .desc { margin-bottom: 14px; }
.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--emerald); background: #e7f2ec; border-radius: 6px; padding: 3px 8px; margin-bottom: 4px;
}
.meaning p, .desc p { margin-top: 4px; }

/* hadith */
.hadith-section { margin-top: 26px; border-top: 1px dashed var(--border); padding-top: 18px; }
.hadith { border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
.hadith-ref { font-size: 0.82rem; font-weight: 600; color: var(--gold); }
.hadith-chapter { font-size: 0.88rem; color: var(--muted); margin: 4px 0; }
.hadith-arabic { font-family: var(--serif); font-size: 1.25rem; line-height: 2; text-align: right; margin: 8px 0; }
.hadith-en { font-size: 0.95rem; margin-bottom: 6px; }
.hadith a { color: var(--emerald); font-size: 0.85rem; }

/* lists */
.list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.list-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.list-card h3 { color: var(--emerald-dark); margin-bottom: 6px; }
.list-card p { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.list-meta { display: flex; gap: 12px; font-size: 0.8rem; color: var(--gold); flex-wrap: wrap; }

/* leaderboard */
.board { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.board th, .board td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.board th { background: var(--emerald); color: #fff; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.board td.rank { font-weight: 700; color: var(--gold); }
.board tr:last-child td { border-bottom: 0; }

/* footer */
.site-footer { background: var(--emerald-dark); color: #cfe0d6; text-align: center; padding: 16px 0; font-size: 0.85rem; }
.site-footer a { color: var(--gold-soft); }

/* random-dua landing */
.random-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.random-head h1 { font-size: 1.6rem; }
.btn-shuffle {
  padding: 10px 18px; border: 0; border-radius: 999px; background: var(--emerald); color: #fff;
  font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow);
}
.btn-shuffle:hover { background: var(--emerald-dark); }
.random-browse { text-align: center; margin-top: 22px; }
.random-browse a { color: var(--emerald); font-weight: 600; text-decoration: none; }
.random-browse a:hover { text-decoration: underline; }

/* floating browse button */
.fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--gold); color: #fff; font-size: 1.5rem; line-height: 1;
  box-shadow: 0 6px 18px rgba(185, 138, 47, 0.45); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease, background 0.12s ease;
}
.fab:hover { background: #a87a27; transform: translateY(-2px); }

/* browse bottom sheet */
.sheet {
  position: fixed; inset: 0; z-index: 50; visibility: hidden; opacity: 0;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.sheet.open { visibility: visible; opacity: 1; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(43, 51, 40, 0.45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 82vh; background: var(--surface); border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(43, 51, 40, 0.25);
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.28s ease;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.sheet.open .sheet-panel { transform: translateY(0); }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 8px; border-bottom: 1px solid var(--border);
}
.sheet-head h2 { font-size: 1.1rem; }
.sheet-close {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: none; color: var(--muted); font-size: 1rem; cursor: pointer;
}
.sheet-close:hover { border-color: var(--emerald); color: var(--emerald); }
.sheet-search {
  margin: 12px 20px 6px; padding: 10px 16px; border: 1.5px solid var(--border); border-radius: 999px;
  font: inherit; outline: none; background: var(--bg);
}
.sheet-search:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(15, 107, 79, 0.12); }
.sheet-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 20px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.sheet-chip {
  flex: 0 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 14px; color: var(--emerald); font: inherit; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}
.sheet-chip:hover { border-color: var(--emerald); background: var(--gold-soft); }
.sheet-chip.active { background: var(--emerald); color: #fff; border-color: var(--emerald); }
.sheet-list { overflow-y: auto; padding: 6px 12px 16px; flex: 1; }
.sheet-item {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 10px;
  padding: 12px 14px; cursor: pointer; font: inherit;
}
.sheet-item:hover { background: var(--gold-soft); }
.sheet-item-name { display: block; font-weight: 600; color: var(--emerald-dark); }
.sheet-item-en { display: block; font-size: 0.85rem; color: var(--muted); }
.sheet-item-cats { display: block; font-size: 0.75rem; color: var(--gold); margin-top: 2px; }
body.sheet-open { overflow: hidden; }

@media (max-width: 640px) {
  .nav { gap: 10px; }
  .brand-name { font-size: 1.1rem; }
  .doa-grid { grid-template-columns: 1fr; }
}
