/* ═══ Islam Guide — Base Stylesheet ═══ */
:root {
  --primary: #1a6b4a;  --primary-light: #2d9d6f;  --primary-dark: #124a33;
  --accent: #c9963b;   --accent-light: #e0b96a;
  --bg: #fafaf8;       --surface: #ffffff;        --surface-alt: #f2f0ec;
  --text: #1e1e1e;     --text-muted: #5a5a5a;     --border: #ddd8d0;
  --error: #c0392b;    --success: #27ae60;
  --radius: 8px;       --shadow: 0 2px 8px rgba(0,0,0,.08);
  --max-w: 1140px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.65; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; }

/* ─── Header ─────────────────────────── */
.site-header { background: var(--primary); color: #fff; padding: .6rem 0; position: sticky; top: 0; z-index: 100; }
.header-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.25rem; display: flex; align-items: center; gap: .4rem; }
.logo-icon { font-size: 1.4rem; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }
.main-nav { display: flex; gap: .15rem; flex-wrap: wrap; }
.main-nav a, .link-btn { color: rgba(255,255,255,.88); text-decoration: none; padding: .3rem .55rem; border-radius: var(--radius);
                          font-size: .82rem; transition: background .15s; background: none; border: none; cursor: pointer; font: inherit; }
.main-nav a:hover, .link-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

@media (max-width: 768px) {
  .nav-toggle { display: block; margin-left: auto; }
  .main-nav { display: none; width: 100%; flex-direction: column; }
  body.nav-open .main-nav { display: flex; }
}

/* ─── Main ───────────────────────────── */
.main-content { padding: 1.5rem 1rem 3rem; min-height: 60vh; }

/* ─── Alerts ─────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-error { background: #fdecea; color: var(--error); border: 1px solid #f5c6cb; }
.alert-success { background: #e8f8ee; color: var(--success); border: 1px solid #b7e4c7; }

/* ─── Cards ──────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.dir-card, .book-card, .course-card, .feature-card, .surah-card { text-decoration: none; color: var(--text); transition: box-shadow .15s, transform .15s; }
.dir-card:hover, .book-card:hover, .course-card:hover, .feature-card:hover, .surah-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }

/* ─── Buttons ────────────────────────── */
.btn { display: inline-block; padding: .55rem 1.1rem; border-radius: var(--radius); font-weight: 600; text-decoration: none; border: 2px solid transparent; cursor: pointer; font-size: .9rem; transition: background .15s; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { font-size: .78rem; padding: .25rem .6rem; border-radius: 4px; background: var(--surface-alt); border: 1px solid var(--border); cursor: pointer; }
.btn-sm:hover { background: var(--border); }

/* ─── Forms ──────────────────────────── */
label { display: block; margin-bottom: .9rem; font-weight: 500; font-size: .9rem; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; border: 1px solid var(--border);
                           border-radius: var(--radius); font-size: .9rem; font-family: inherit; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,107,74,.12); }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-end; }
.inline { display: inline; }
.form-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 140px; }
.filter-bar { margin-bottom: 1rem; }

/* ─── Auth box ───────────────────────── */
.auth-box { max-width: 400px; margin: 2rem auto; }
.auth-alt { text-align: center; margin-top: 1rem; }

/* ─── Badges ─────────────────────────── */
.badge { display: inline-block; font-size: .72rem; padding: .15rem .5rem; border-radius: 20px; font-weight: 600; }
.badge-sunni { background: #dff0d8; color: #3c763d; }
.badge-shia { background: #d9edf7; color: #31708f; }
.badge-common { background: #fcf8e3; color: #8a6d3b; }
.badge-sahih { background: #dff0d8; color: #3c763d; }
.badge-hasan { background: #d9edf7; color: #31708f; }
.badge-daif { background: #f2dede; color: #a94442; }
.badge-mawdu { background: #f2dede; color: #c0392b; }
.badge-sajda { background: var(--accent-light); color: #fff; }

/* ─── Hero ───────────────────────────── */
.hero { text-align: center; padding: 3rem 1rem 2rem; }
.hero h1 { font-size: 2rem; color: var(--primary); font-family: 'Noto Sans Arabic', serif; }
.hero-sub { margin: .75rem 0 1.5rem; color: var(--text-muted); max-width: 600px; margin-inline: auto; }
.hero-actions { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

/* ─── Feature grid ───────────────────── */
.features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin: 2rem 0; }
.feature-icon { font-size: 2rem; display: block; margin-bottom: .3rem; }
.feature-card { text-align: center; padding: 1.25rem; }

/* ─── Qur'an ─────────────────────────── */
.surah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; }
.surah-card { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; }
.surah-num { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; border-radius: 50%; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.surah-card small { display: block; color: var(--text-muted); font-size: .78rem; }
.arabic-name { font-size: 1.1rem; margin-left: auto; }

.surah-header { text-align: center; margin-bottom: 1rem; }
.surah-nav { display: flex; gap: 1rem; justify-content: center; margin-top: .5rem; }
.surah-nav a { color: var(--primary); }
.bismillah { text-align: center; font-size: 1.5rem; color: var(--primary-dark); margin: 1rem 0; font-family: 'Noto Sans Arabic', serif; }

.ayat-list { max-width: 800px; margin: 0 auto; }
.ayah-block { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.arabic-text { font-size: 1.35rem; line-height: 2.2; font-family: 'Noto Sans Arabic', 'Traditional Arabic', serif; color: var(--primary-dark); }
.translation { margin-top: .4rem; color: var(--text-muted); }
.ayah-marker { color: var(--accent); font-size: .9em; }
.ayah-actions { display: flex; gap: .5rem; align-items: center; margin-top: .3rem; }
.ayah-ref { font-size: .78rem; color: var(--text-muted); }

/* ─── Hadith ─────────────────────────── */
.hadith-block { margin-bottom: .75rem; }
.hadith-header { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }

/* ─── Search ─────────────────────────── */
.search-form { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.search-form input[type="search"] { flex: 1; min-width: 200px; }
.search-result { margin-bottom: .5rem; }

/* ─── Prayer ─────────────────────────── */
.prayer-controls { margin-bottom: 1.5rem; }
.prayer-card, .qibla-card { text-align: center; }
.prayer-table { width: 100%; margin: 1rem 0; border-collapse: collapse; }
.prayer-table td { padding: .6rem 1rem; border-bottom: 1px solid var(--border); }
.prayer-name { font-weight: 600; text-align: left; }
.prayer-time { font-size: 1.2rem; font-weight: 700; color: var(--primary); text-align: right; }
.prayer-hijri { color: var(--accent); font-weight: 600; }
.calc-note { font-size: .8rem; color: var(--text-muted); }

.qibla-compass { max-width: 220px; margin: 1rem auto; }
.compass-rose { width: 200px; height: 200px; border-radius: 50%; border: 3px solid var(--primary); position: relative; margin: 0 auto; }
.compass-needle { width: 4px; height: 80px; background: var(--error); position: absolute; left: calc(50% - 2px); top: 20px; transform-origin: bottom center; border-radius: 2px; }
.compass-label { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-weight: 700; color: var(--primary); }
.qibla-deg { font-size: 1.4rem; font-weight: 700; color: var(--primary); margin-top: .5rem; }
.qibla-note { font-size: .8rem; color: var(--text-muted); }

/* ─── Calendar events ────────────────── */
.events-list { max-width: 700px; }
.event-row { display: flex; gap: 1rem; align-items: flex-start; }
.event-date { min-width: 55px; font-weight: 700; color: var(--primary); font-size: 1.1rem; }

/* ─── Classes ────────────────────────── */
.progress-bar { height: 8px; background: var(--surface-alt); border-radius: 4px; overflow: hidden; margin-top: .5rem; }
.progress-bar div { height: 100%; background: var(--primary); border-radius: 4px; }
.lessons-list { list-style: none; counter-reset: lesson; }
.lesson-item { display: flex; gap: .5rem; align-items: center; }
.lessons-list li::before { counter-increment: lesson; content: counter(lesson); width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; border-radius: 50%; font-size: .8rem; font-weight: 700; flex-shrink: 0; }

/* ─── Detail pages ───────────────────── */
.detail-page { max-width: 800px; }
.detail-meta { margin: 1rem 0; }
.detail-meta p { margin-bottom: .3rem; }
.prose { margin: 1rem 0; line-height: 1.75; }
.source-cite { font-size: .82rem; color: var(--text-muted); }
.content-note { margin-top: 2rem; }
.toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }

/* ─── Map ────────────────────────────── */
.map-embed { height: 350px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-alt); margin: 1rem 0; }

/* ─── Nearby ─────────────────────────── */
.nearby-controls { margin-bottom: 1rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ─── Grid ───────────────────────────── */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 640px) { .grid-2col { grid-template-columns: 1fr; } }

/* ─── Pagination ─────────────────────── */
.pagination { display: flex; gap: .3rem; margin-top: 1.5rem; flex-wrap: wrap; }
.pagination a, .page-current { padding: .35rem .65rem; border-radius: var(--radius); font-size: .85rem; text-decoration: none; }
.pagination a { background: var(--surface); border: 1px solid var(--border); color: var(--primary); }
.pagination a:hover { background: var(--primary); color: #fff; }
.page-current { background: var(--primary); color: #fff; font-weight: 700; }

/* ─── Error page ─────────────────────── */
.error-page { text-align: center; padding: 4rem 1rem; }
.error-page h1 { font-size: 4rem; color: var(--primary); }

/* ─── VOTD / HOTD cards ──────────────── */
.votd-card, .hotd-card { max-width: 700px; margin: 1.5rem auto; text-align: center; }
.votd-card .arabic-text { font-size: 1.6rem; }

/* ─── Footer ─────────────────────────── */
.site-footer { background: var(--primary-dark); color: rgba(255,255,255,.8); padding: 1.5rem 0; text-align: center; font-size: .85rem; }
.site-footer a { color: var(--accent-light); }
.footer-note { margin-top: .3rem; font-size: .78rem; }
