/* تطبيق القرآن الكريم والأحاديث الشريفة — الهوية: أخضر داكن + ذهبي + عاجي */
:root {
  --green: #0f4c3a; --green-2: #0a3528; --green-3: #1d6b52;
  --gold: #b88a2c; --gold-soft: #f1e6c6; --gold-line: #d8bb73;
  --bg: #f6f2e8; --surface: #fffdf8; --surface-2: #efe9d9;
  --ink: #15231e; --muted: #5b6b64; --line: #ddd5bf;
  --on-green: #ffffff; --danger: #a33a2a; --ok: #2f7d5a;
  --qfs: 30px; --qfont: 'Amiri Quran', 'Scheherazade New', serif;
  --ui: 'Cairo', 'Segoe UI', Tahoma, sans-serif; --serif: 'Amiri', 'Scheherazade New', serif;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23d8bb73' stroke-opacity='.35' stroke-width='1'%3E%3Cpath d='M36 6l8 14 16-4-4 16 14 8-14 8 4 16-16-4-8 14-8-14-16 4 4-16-14-8 14-8-4-16 16 4z'/%3E%3C/g%3E%3C/svg%3E");
}
[data-theme='dark'] {
  --green: #1d6b52; --green-2: #0b2a21; --green-3: #2c8b6c; --gold: #e0b65a; --gold-soft: #2a2415; --gold-line: #6b5524;
  --bg: #0b1512; --surface: #12211c; --surface-2: #182b24; --ink: #e8efe9; --muted: #98aba2; --line: #26403a; --danger: #e07a68; --ok: #6cc1a3;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); line-height: 1.8; padding-bottom: 76px; }
a { color: var(--green-3); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.4; margin: 0 0 .4em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--gold); color: #000; padding: 8px 14px; z-index: 100; border-radius: 8px; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.hidden, [hidden] { display: none !important; }

/* الشريط العلوي */
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--green); color: var(--on-green); background-image: var(--pattern); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: 0 1 auto; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-family: var(--serif); font-size: .95rem; line-height: 1.3; } .brand-text small { opacity: .8; font-size: .7rem; letter-spacing: .08em; }
.search { position: relative; flex: 1 1 0; min-width: 0; max-width: 560px; margin-inline: auto; }
.brand img { flex: none; }
@media (max-width: 600px) { .topbar { gap: 8px; padding: 8px 10px; } .brand-text b { font-size: .8rem; } .search { flex-basis: 90px; } }
.search input { width: 100%; border: 0; border-radius: 999px; padding: 8px 40px 8px 14px; background: rgba(255,255,255,.95); color: #15231e; }
.search-icon { position: absolute; inset-inline-start: auto; right: 14px; top: 50%; transform: translateY(-50%); color: #4a5a53; display: flex; pointer-events: none; }
.top-actions { display: flex; gap: 4px; margin-inline-start: auto; }
.topbar .icon-btn { color: var(--on-green); }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); text-decoration: none; }
.icon-btn:hover { background: rgba(127,127,127,.15); }
.icon-btn.on { color: #c0392b; }
.icon-btn.on svg { fill: currentColor; }

/* التخطيط */
.layout { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 20px; padding: 16px 14px 24px; }
main { min-width: 0; outline: none; }
.side-nav { display: none; }
.bottom-nav { position: fixed; bottom: 0; inset-inline: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-link { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; color: var(--muted); text-decoration: none; font-size: .78rem; border-top: 3px solid transparent; }
.nav-link[aria-current='page'] { color: var(--green-3); border-top-color: var(--gold); font-weight: 700; }
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .layout { grid-template-columns: 230px 1fr; align-items: start; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 76px; }
  .side-nav .nav-link { flex-direction: row; gap: 12px; padding: 10px 14px; border-top: 0; border-inline-start: 4px solid transparent; border-radius: 8px; font-size: 1rem; }
  .side-nav .nav-link[aria-current='page'] { background: var(--surface); border-inline-start-color: var(--gold); }
  .bottom-nav { display: none; }
}

/* عناصر عامة */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; color: var(--green); } [data-theme='dark'] .page-head h1 { color: var(--gold); }
.page-head p { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; }
.card h2, .card h3 { color: var(--green); } [data-theme='dark'] .card h2, [data-theme='dark'] .card h3 { color: var(--gold); }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 16px; text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.row.between { justify-content: space-between; }
input[type='text'], input[type='search'], input[type='number'], select, textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 14px; font-size: .92rem; }
.chip[aria-pressed='true'] { background: var(--green); color: var(--on-green); border-color: var(--green); }
.scroll-x { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; } .scroll-x .chip { white-space: nowrap; }
.actions { display: flex; gap: 2px; }
.state { text-align: center; padding: 28px 12px; color: var(--muted); }
.state.error { color: var(--danger); } .state.unavailable { border: 1px dashed var(--gold-line); border-radius: 14px; background: var(--gold-soft); color: var(--ink); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; margin-inline-end: 8px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { display: flex; gap: 8px; align-items: flex-start; background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 10px; padding: 10px 12px; font-size: .9rem; margin: 0 0 12px; }
.notice svg { flex: none; margin-top: 4px; color: var(--gold); }
.source { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.badge { display: inline-block; background: var(--surface-2); border-radius: 999px; padding: 0 10px; font-size: .78rem; color: var(--muted); }
.badge.green { background: var(--green); color: var(--on-green); } .badge.gold { background: var(--gold); color: #1a1405; }
mark { background: #ffe58a; color: #000; border-radius: 3px; padding: 0 2px; }
.toast { position: fixed; bottom: 90px; inset-inline: 0; margin: auto; width: max-content; max-width: 90vw; background: var(--ink); color: var(--bg); padding: 8px 18px; border-radius: 999px; font-size: .9rem; z-index: 200; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

/* الرئيسية */
.hero { background: var(--green); color: var(--on-green); background-image: var(--pattern); border-radius: 18px; padding: 22px 18px; margin-bottom: 14px; }
.hero h1 { color: var(--on-green); margin: 0 0 6px; font-size: 1.7rem; }
.hero .dates { display: flex; flex-wrap: wrap; gap: 4px 18px; opacity: .92; font-size: .95rem; }
.verse, .ar-text { font-family: var(--qfont); font-size: 1.55rem; line-height: 2.2; text-align: justify; margin: 6px 0; }
.dua-text { font-family: var(--serif); font-size: 1.45rem; line-height: 2.1; white-space: pre-line; margin: 4px 0; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); text-align: center; font-weight: 600; }
.quick svg { color: var(--gold); width: 30px; height: 30px; }
.quick:hover { border-color: var(--gold); }
.prayer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.prayer-cell { text-align: center; background: var(--surface-2); border-radius: 10px; padding: 8px 4px; }
.prayer-cell.next { background: var(--green); color: var(--on-green); }
.prayer-cell b { display: block; font-size: 1.05rem; }
.countdown { font-size: 1.5rem; font-weight: 700; letter-spacing: .04em; }

/* القرآن */
.surah-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); }
.surah-item:hover { border-color: var(--gold); }
.surah-no { flex: none; width: 38px; height: 38px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); border: 1.5px solid var(--gold-line); border-radius: 10px; transform: rotate(45deg); }
.surah-no span { transform: rotate(-45deg); font-weight: 700; font-size: .9rem; }
.surah-name { font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; }
.reader { background: var(--surface); border: 2px solid var(--gold); outline: 1px solid var(--gold-line); outline-offset: 5px; border-radius: 4px; margin: 8px 6px 18px; padding: 22px 16px; }
.banner { margin: 8px 0 14px; border-block: 3px double var(--gold); background: var(--gold-soft); text-align: center; font-family: var(--qfont); font-size: calc(var(--qfs) * .95); color: var(--green); padding: 2px 8px; }
[data-theme='dark'] .banner { color: var(--gold); }
.banner span::before, .banner span::after { content: '۞'; color: var(--gold); margin-inline: .6em; font-size: .8em; }
.bsm { font-family: var(--qfont); text-align: center; font-size: calc(var(--qfs) * .9); margin: 4px 0 10px; }
.flow { font-family: var(--qfont); font-size: var(--qfs); line-height: 2.4; text-align: justify; text-justify: inter-word; margin: 0 0 8px; }
.ayah { cursor: pointer; border-radius: 6px; transition: background .15s; }
.ayah:hover, .ayah:focus-visible { background: var(--gold-soft); }
.ayah.playing { background: #ffe58a55; box-shadow: 0 0 0 2px var(--gold-line); }
.ayah.marked { text-decoration: underline wavy var(--gold); text-underline-offset: 8px; }
.num { display: inline-flex; align-items: center; justify-content: center; min-width: 1.9em; height: 1.9em; border: 1.5px solid var(--gold); border-radius: 50%; font-size: .5em; font-family: var(--ui); color: var(--gold); margin-inline: .35em; vertical-align: middle; padding-inline: 2px; }
.ayah-row { padding: 12px 6px; border-bottom: 1px solid var(--line); }
.ayah-row .flow { margin: 0; }
.trans { color: var(--muted); font-size: 1rem; line-height: 1.9; margin: 4px 0 0; direction: auto; text-align: start; }
.player { position: fixed; inset-inline: 8px; bottom: 82px; z-index: 60; background: var(--green-2); color: #fff; border-radius: 14px; padding: 8px 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.player .icon-btn { color: #fff; } .player select { background: #ffffff22; color: #fff; border-color: #ffffff33; padding: 4px 8px; }
.player select option { color: #000; }
@media (min-width: 900px) { .player { inset-inline: auto 24px; bottom: 20px; width: 460px; } }
.sheet { border: 0; border-radius: 18px 18px 0 0; padding: 0; width: min(640px, 100%); max-height: 86vh; margin: auto auto 0; background: var(--surface); color: var(--ink); }
@media (min-width: 900px) { .sheet { margin: auto; border-radius: 18px; } }
.sheet::backdrop { background: rgba(0,0,0,.5); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.sheet-head h2 { margin: 0; font-size: 1.15rem; } .sheet-body { padding: 14px 16px 20px; }
.progress { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-3), var(--gold)); }

/* الأذكار والأدعية */
.dhikr { background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--gold); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.dhikr.done { opacity: .6; border-inline-start-color: var(--ok); }
.dhikr-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.counter-btn { min-width: 76px; border: 0; background: var(--green); color: #fff; border-radius: 999px; padding: 6px 16px; font-weight: 700; }
.dhikr.done .counter-btn { background: var(--ok); }

/* المسبحة */
.counter { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 8px 0; }
.cur { font-family: var(--serif); font-size: 2rem; text-align: center; color: var(--green); min-height: 3.4rem; } [data-theme='dark'] .cur { color: var(--gold); }
.tapbtn { width: min(72vw, 270px); aspect-ratio: 1; border-radius: 50%; border: 0; position: relative; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 1%), var(--line) 0); touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; }
.tapbtn::before { content: ''; position: absolute; inset: 13px; border-radius: 50%; background: var(--surface); transition: background .1s; }
.tapbtn:active::before { background: var(--gold-soft); }
.tapbtn span { position: relative; font-size: 4.4rem; font-weight: 700; color: var(--green); } [data-theme='dark'] .tapbtn span { color: var(--gold); }
.stats { display: flex; gap: 26px; color: var(--muted); } .stats b { color: var(--ink); font-size: 1.2rem; }

/* جداول */
table.t { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: .92rem; }
.t th, .t td { padding: 8px 10px; text-align: center; border-bottom: 1px solid var(--line); } .t th { background: var(--surface-2); }
.t tr.today td { background: var(--gold-soft); font-weight: 700; }
.t-wrap { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dh { text-align: center; font-weight: 700; font-size: .85rem; color: var(--muted); }
.cal .cell { min-height: 62px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; background: var(--surface); font-size: .85rem; }
.cal .cell b { font-size: 1.1rem; } .cal .cell small { color: var(--muted); display: block; }
.cal .cell.today { border-color: var(--gold); background: var(--gold-soft); } .cal .cell.event { border-inline-start: 4px solid var(--green-3); }
.cal .cell em { display: block; font-style: normal; font-size: .7rem; color: var(--green-3); line-height: 1.3; }

/* البوصلة */
.compass { position: relative; width: min(78vw, 300px); aspect-ratio: 1; margin: 10px auto; border-radius: 50%; border: 6px double var(--gold); background: var(--surface); display: grid; place-items: center; }
.compass .dial { position: absolute; inset: 0; transition: transform .2s linear; }
.compass .needle { position: absolute; inset: 0; display: grid; place-items: start center; transition: transform .2s linear; }
.compass .needle::before { content: ''; width: 0; height: 0; margin-top: 14px; border-inline: 12px solid transparent; border-bottom: 120px solid var(--gold); }
.compass .north { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font-weight: 700; color: var(--danger); }
.compass .kaaba { font-size: 1.8rem; position: absolute; top: 44%; }

.footer { text-align: center; padding: 22px 14px 90px; color: var(--muted); font-size: .88rem; border-top: 1px solid var(--line); margin-top: 10px; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; }
@media (min-width: 900px) { .footer { padding-bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .topbar, .bottom-nav, .side-nav, .player, .footer { display: none; } }
