/* =====================================================
   تنسيقات الصفحات الإضافية: المصحف، الحفظ، المقالات، الكتابة، الدخول، الإدارة
   ===================================================== */

/* ---------- شريط الحساب ---------- */
.acct {
  position: absolute; top: .5rem; inset-inline-start: .8rem; z-index: 2;
  display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--muted);
}
.acct-btn {
  font: inherit; font-size: .85rem; cursor: pointer; text-decoration: none; padding: .1rem .7rem;
  border-radius: 999px; border: 1px solid var(--gold-line); background: var(--surface); color: var(--primary-strong);
}
.acct-btn:hover { background: var(--gold-soft); }
@media (max-width: 560px) { .acct { position: static; justify-content: center; margin-bottom: .4rem; } }

/* ---------- عناصر عامة ---------- */
.btn-primary {
  font: inherit; cursor: pointer; padding: .4rem 1.4rem; border-radius: 999px; border: 2px solid var(--primary);
  background: var(--primary); color: var(--on-primary); font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled, .btn-soft:disabled, .tb:disabled { opacity: .45; cursor: not-allowed; }
.btn-soft { font: inherit; cursor: pointer; }
.btn-soft.danger { border-color: #c0392b; color: #c0392b; }
.inp {
  width: 100%; font: inherit; padding: .6rem .9rem; border-radius: 12px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.inp:focus, .rich:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.inp.sm { padding: .25rem .5rem; width: auto; min-width: 0; }
label.field { display: grid; gap: .3rem; margin-bottom: .9rem; font-weight: 700; color: var(--primary-strong); }
.form-msg { color: var(--gold); min-height: 1.4em; margin: .4rem 0 0; }
.notice { background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 12px; padding: .6rem 1rem; color: var(--text); }
.hint { color: var(--muted); }
.empty { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; }
.honey { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.badge-inline { background: var(--primary-soft); color: var(--primary-strong); border-radius: 999px; padding: 0 .7rem; font-size: .8rem; }

/* ---------- المصحف ---------- */
.surah-list { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: .8rem; max-height: 420px; overflow: auto; padding: .2rem; }
.surah-tile {
  display: flex; align-items: center; gap: .6rem; text-align: start; font: inherit; cursor: pointer; color: var(--text);
  padding: .5rem .7rem; border-radius: 14px; background: var(--bg); border: 1px solid var(--border);
}
.surah-tile:hover, .surah-tile:focus-visible { border-color: var(--gold-line); box-shadow: var(--shadow); outline: none; }
.tile-no {
  flex: none; width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border-radius: 50%;
  background: var(--primary-soft); border: 1px solid var(--gold-line); color: var(--primary-strong); font-weight: 700;
}
.tile-info { display: grid; line-height: 1.4; }
.tile-info small { color: var(--muted); }
.reader-bar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between; margin-bottom: .8rem; }
.reader-bar h2 { margin: 0; }
.reader-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.reader-tools select { font: inherit; padding: .35rem .6rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); max-width: 100%; }
.basmala { text-align: center; font-size: 1.9rem; color: var(--gold); margin: .4rem 0; }
.basmala:empty { display: none; }
#surah-text .ayah { cursor: pointer; border-radius: 8px; }
#surah-text .ayah:hover { background: var(--gold-soft); }
#surah-text .ayah.bookmarked { background: var(--gold-soft); box-shadow: 0 0 0 2px var(--gold-line); }
.reader-nav { display: flex; justify-content: space-between; margin-top: 1rem; }
#resume { margin-top: .8rem; }

/* ---------- الحفظ ---------- */
.mem-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.mem-grid select, .mem-grid input[type=number], .mem-grid input[type=text] {
  width: 100%; font: inherit; padding: .5rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.mode-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0; }
.mode-row label { cursor: pointer; padding: .4rem 1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-soft); }
.mode-row input { position: absolute; opacity: 0; pointer-events: none; }
.mode-row label:has(input:checked) { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.mode-row label:has(input:focus-visible) { outline: 2px solid var(--gold-line); outline-offset: 2px; }
.progress { height: 14px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--primary)); transition: width .4s; }
.mem-info { color: var(--muted); margin: 0 0 .4rem; }
.mem-ayah { font-size: clamp(1.7rem, 1.3rem + 2vw, 2.4rem); line-height: 2.5; text-align: center; padding: .6rem; border: 4px double var(--gold-line); border-radius: 14px; margin: 0 0 .8rem; }
.hidden-word { background: var(--primary-soft); color: transparent; border-radius: 8px; cursor: pointer; user-select: none; box-shadow: inset 0 0 0 1px var(--border); }
.hidden-word:focus-visible { outline: 2px solid var(--gold-line); }
.rep-box { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; justify-content: center; }
.rep-num { font-size: 2rem; color: var(--primary-strong); min-width: 6ch; text-align: center; }
.mem-hint { color: var(--gold); text-align: center; font-size: 1.2rem; }
.mem-input { width: 100%; font: inherit; font-size: 1.4rem; padding: .6rem; border-radius: 12px; border: 1px solid var(--border); background: var(--bg); color: var(--text); margin-bottom: .6rem; }
.mem-result { margin-top: .8rem; font-size: 1.6rem; line-height: 2.2; }
.mem-result .ok { color: var(--green); }
.mem-result .bad { color: #c0392b; text-decoration: underline wavy; }
.mem-score { font-size: 1.1rem; font-weight: 700; margin: 0 0 .4rem; }
.mem-nav { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; margin-top: 1rem; }


/* إظهار جميع طرق الحفظ والتسميع بوضوح */
.mem-mode-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr)); gap:.65rem; margin:.8rem 0; }
.mem-mode-choice { min-height:3.25rem; padding:.7rem .8rem; border:1px solid var(--border); border-radius:13px; background:var(--bg); color:var(--text); font:inherit; font-weight:700; line-height:1.6; cursor:pointer; transition:background .15s,border-color .15s,transform .15s; }
.mem-mode-choice:hover { border-color:var(--gold-line); transform:translateY(-1px); }
.mem-mode-choice:focus-visible { outline:3px solid var(--gold-line); outline-offset:2px; }
.mem-mode-choice[aria-pressed="true"] { background:var(--primary); color:var(--on-primary); border-color:var(--gold-line); box-shadow:0 0 0 2px var(--gold-line); }
.mem-mode-mic { border-width:2px; border-color:var(--gold-line); }

/* ---------- المقالات ---------- */
.articles-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.article-card {
  display: grid; gap: .4rem; align-content: start; text-decoration: none; color: var(--text);
  padding: 1rem 1.1rem; border-radius: 16px; background: var(--bg); border: 1px solid var(--border);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.article-card:hover, .article-card:focus-visible { transform: translateY(-2px); border-color: var(--gold-line); box-shadow: var(--shadow); outline: none; }
.article-card h3 { margin: 0; color: var(--primary-strong); font-size: 1.35rem; line-height: 1.5; }
.ac-top, .ac-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; align-items: center; color: var(--muted); font-size: .9rem; }
.ac-author.official { color: var(--green); font-weight: 700; }
.ac-sum { margin: 0; color: var(--muted); }
.articles-head { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: space-between; align-items: center; }
.articles-head h2 { margin: 0; }
.btn-link { display: inline-block; text-decoration: none; font-weight: 700; padding: .4rem 1.2rem; border-radius: 999px; background: var(--primary); color: var(--on-primary); }

/* ---------- صفحة المقال ---------- */
.article-meta { display: flex; flex-wrap: wrap; gap: .4rem 1rem; color: var(--muted); margin-bottom: 1rem; }
.art-h { color: var(--gold); border-bottom: 1px solid var(--gold-line); padding-bottom: .2rem; margin: 1.6rem 0 .5rem; font-size: 1.5rem; }
.art-p { font-size: 1.2rem; line-height: 2.1; margin: .5rem 0; }
.align-right { text-align: right; } .align-center { text-align: center; } .align-left { text-align: left; }
.art-list li { margin-bottom: .4rem; font-size: 1.15rem; line-height: 1.9; }
.art-quran, .art-hadith, .art-quote { margin: 1rem 0; padding: 1rem 1.2rem; border-radius: 14px; }
.art-quran { background: var(--primary-soft); border: 2px solid var(--gold-line); text-align: center; }
.art-quran blockquote, .art-hadith blockquote, .art-quote blockquote { margin: 0; }
.quran-text { font-size: 1.9rem; line-height: 2.4; color: var(--primary-strong); }
.art-quran figcaption, .art-hadith figcaption, .art-quote figcaption { color: var(--muted); margin-top: .4rem; font-size: .95rem; }
.art-hadith { background: var(--gold-soft); border-inline-start: 5px solid var(--gold-line); }
.hadith-text { font-size: 1.5rem; line-height: 2.2; }
.grade { margin-inline-start: .6rem; background: var(--surface); border: 1px solid var(--gold-line); border-radius: 999px; padding: 0 .6rem; font-size: .85rem; color: var(--gold); }
.art-quote { border-inline-start: 4px solid var(--primary); background: var(--bg-soft); font-style: italic; }
.art-note { background: var(--bg-soft); border: 1px dashed var(--border); padding: .7rem 1rem; border-radius: 12px; color: var(--muted); font-size: .95rem; margin: 1.2rem 0; }
.art-tafsir { margin-top: .6rem; text-align: start; }
.art-tafsir summary { cursor: pointer; color: var(--primary-strong); font-weight: 700; }
.art-drawing { margin: 1rem 0; text-align: center; }
.art-drawing svg { width: 100%; max-width: 600px; height: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; }
.art-drawing figcaption { color: var(--muted); }
/* تلوين الكلمات */
.hl-1 { background: #fff3a0; color: #3b3000; } .hl-2 { background: #bff0cf; color: #0b3a1f; }
.hl-3 { background: #bfe0ff; color: #0a2f55; } .hl-4 { background: #ffc9de; color: #55102c; }
.hl-5 { background: #ffd9ae; color: #4d2600; } .hl-6 { background: #e0d1fb; color: #2c1458; }
.hl.hl-1, .hl.hl-2, .hl.hl-3, .hl.hl-4, .hl.hl-5, .hl.hl-6 { font-weight: inherit; padding: 0 .25em; border-radius: .35em; }

/* ---------- التعليقات ---------- */
.comments { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .7rem; }
.comment { background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: .7rem 1rem; }
.c-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.c-date { color: var(--muted); font-size: .85rem; }
.c-body { margin: .3rem 0 0; white-space: pre-wrap; }
.comment-form { display: grid; gap: .6rem; position: relative; }
.comment-form textarea { min-height: 5rem; }
.comment-tools { display: flex; gap: .6rem; align-items: center; position: relative; flex-wrap: wrap; }
.emoji-btn { font-size: 1.3rem; cursor: pointer; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 50%; width: 2.4rem; height: 2.4rem; }
.emoji-pop {
  position: absolute; z-index: 20; top: 100%; inset-inline-start: 0; margin-top: .4rem; width: min(330px, 90vw);
  background: var(--surface); border: 2px solid var(--gold-line); border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.25); padding: .6rem;
}
.emoji-cat { color: var(--muted); font-size: .8rem; margin: .3rem 0 .15rem; }
.emoji-row { display: flex; flex-wrap: wrap; gap: .15rem; }
.emoji-row button { font-size: 1.4rem; width: 2.2rem; height: 2.2rem; border: 0; background: transparent; cursor: pointer; border-radius: 8px; }
.emoji-row button:hover, .emoji-row button:focus-visible { background: var(--gold-soft); outline: none; }

/* ---------- الكتابة ---------- */
.add-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin: .8rem 0; }
.blk { border: 1px solid var(--border); border-radius: 14px; padding: .8rem; margin-bottom: .9rem; background: var(--bg); }
.blk-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; color: var(--primary-strong); }
.blk-ctl { display: flex; gap: .3rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin-bottom: .5rem; }
.tb { font: inherit; cursor: pointer; padding: .2rem .7rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 2.2rem; }
.tb:hover, .tb[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.tb.b { font-weight: 700; } .tb.i { font-style: italic; } .tb.u { text-decoration: underline; }
.tb.hl-swatch { font-weight: 700; }
.tb-sep { width: 1px; align-self: stretch; background: var(--border); margin-inline: .2rem; }
.tb-label { color: var(--muted); font-size: .9rem; }
.rich { min-height: 6rem; padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 1.15rem; line-height: 2; }
.draw-stage { display: grid; gap: .8rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .draw-stage { grid-template-columns: 1fr; } }
.draw-canvas { width: 100%; height: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; touch-action: none; direction: ltr; }
.draw-bg { fill: transparent; }
.sel-box { fill: none; stroke: var(--gold-line); stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.sel-handle { fill: var(--gold-line); stroke: var(--surface); stroke-width: 2; cursor: nwse-resize; }
.shape-props { display: grid; gap: .4rem; }
.prop { display: flex; align-items: center; justify-content: space-between; gap: .4rem; font-size: .9rem; }
.prop .inp.sm { max-width: 8.5rem; }
.color-pick { width: 2.2rem; height: 2rem; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
.prop-btns { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.preview-box { border: 2px dashed var(--gold-line); border-radius: 14px; padding: 1rem; margin-top: 1rem; }

/* ---------- الدخول والإدارة ---------- */
.auth-card { max-width: 480px; margin-inline: auto; }
.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.admin-item { border: 1px solid var(--border); border-radius: 14px; padding: .8rem 1rem; margin-bottom: .8rem; background: var(--bg); }
.admin-item h3 { margin: 0 0 .3rem; color: var(--primary-strong); }
.admin-preview { max-height: 320px; overflow: auto; border: 1px dashed var(--border); border-radius: 10px; padding: .6rem; margin: .5rem 0; }
.admin-row { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- لوحة الزخارف ---------- */
.orn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: .6rem; }
.orn-btn { font: inherit; cursor: pointer; padding: .3rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); display: grid; gap: .2rem; justify-items: center; font-size: .8rem; }
.orn-btn[aria-pressed="true"] { border-color: var(--gold-line); background: var(--gold-soft); }
.orn-prev { width: 38px; height: 38px; background: var(--primary); -webkit-mask-size: 19px; mask-size: 19px; border-radius: 6px; opacity: .85; }
.orn-range { display: grid; gap: .2rem; margin: .4rem 0; font-size: .9rem; }
.orn-range input { width: 100%; }

/* شرائح الاختيار (مشتركة) */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  font: inherit; cursor: pointer; padding: .35rem .9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
}
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }


html { scroll-padding-top: 4.5rem; }

/* ---------- مشغّل التلاوات والتنزيل ---------- */
.player-actions { display:flex; flex-wrap:wrap; align-items:center; gap:.55rem; flex-basis:100%; }
.player-download { display:inline-flex; align-items:center; gap:.35rem; padding:.35rem .85rem; border:1px solid var(--gold-line); border-radius:999px; text-decoration:none; color:var(--primary-strong); background:var(--bg-soft); font-weight:700; }
.player-download:hover { background:var(--gold-soft); }
.player-source-note { color:var(--muted); font-size:.85rem; }
#player audio { max-width:100%; }

/* ---------- طرق الحفظ المتقدمة ---------- */
.mem-order-picked, .mem-order-choices { display:flex; flex-wrap:wrap; gap:.45rem; justify-content:center; margin:.7rem 0; padding:.7rem; border:1px solid var(--border); border-radius:12px; min-height:3.4rem; background:var(--bg-soft); }
.mem-order-token { font:inherit; padding:.4rem .75rem; border:1px solid var(--gold-line); border-radius:10px; background:var(--surface); color:var(--text); cursor:pointer; }
.mem-order-token:disabled { opacity:.4; cursor:not-allowed; }
.mem-order-token.selected { background:var(--primary-soft); }
.mem-transcript { min-height:4rem; margin:.6rem 0; padding:.75rem; border:1px solid var(--gold-line); border-radius:12px; background:var(--bg-soft); line-height:2; white-space:pre-wrap; }
.mem-mic-compare { font-size:1.3rem; }
.mem-mic-compare .ok { color:var(--green); }
.mem-mic-compare .bad { color:#c0392b; text-decoration:underline wavy; }
#mem-mic-note { line-height:1.8; }


.quick-links-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr)); gap:.8rem; }
.quick-links-grid article { padding:1rem; border:1px solid var(--border); border-radius:14px; background:var(--surface); box-shadow:var(--shadow); }
.quick-links-grid h3 { margin:.1rem 0 .4rem; color:var(--primary-strong); }
.quick-links-grid p { color:var(--muted); }
