/* ═══════════════════════════════════════════════
   الختمة الإدارية — نسخة القراءة للويب
   ألوان وثيم مطابق لتطبيق Flutter (app_theme.dart)
   ═══════════════════════════════════════════════ */
:root {
  --primary:     #1A5C38;
  --primary-dk:  #0F3D26;
  --primary-lt:  #2E8B57;
  --gold:        #D4A017;
  --gold-light:  #FFF3CD;
  --bg:          #F8F5F0;
  --surface:     #FFFFFF;
  --surface-dim: #F0EDE8;
  --text-high:   #1A1A1A;
  --text-med:    #555555;
  --text-low:    #999999;
  --border:      #E8E4DF;
  --red:         #CC0000;
  --blue:        #1A73E8;
  --radius:      16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Cairo', -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-high);
  line-height: 1.7;
  direction: rtl;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ─────────── الشريط العلوي ─────────── */
header.appbar {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
header.appbar .title { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
header.appbar .actions { display: flex; gap: 4px; }
header.appbar .actions button {
  color: #fff; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-size: 20px; transition: background .15s;
}
header.appbar .actions button:hover { background: rgba(255,255,255,.15); }

/* ─────────── الحاوية ─────────── */
.wrap { max-width: 720px; margin: 0 auto; padding: 12px 16px 60px; }

/* ─────────── بطاقة التاريخ ─────────── */
.date-card {
  background: linear-gradient(135deg, var(--primary-dk), var(--primary), var(--primary-lt));
  border-radius: 20px; padding: 16px; color: #fff;
  box-shadow: 0 7px 16px rgba(26,92,56,.35);
}
.date-card .top { display: flex; align-items: center; justify-content: space-between; }
.date-card .top .label { color: rgba(255,255,255,.6); font-size: 12px; }
.date-card .top .chip {
  background: rgba(255,255,255,.22); color: #fff; font-size: 11px;
  padding: 5px 12px; border-radius: 20px;
}
.date-card .top .chip:hover { background: rgba(255,255,255,.32); }
.date-card .date-line { font-size: 20px; font-weight: 700; margin-top: 4px; }
.date-card .stats { display: flex; margin-top: 12px; }
.date-card .stat { display: flex; flex-direction: column; }
.date-card .stat .k { color: rgba(255,255,255,.55); font-size: 11px; }
.date-card .stat .v { color: #fff; font-size: 17px; font-weight: 700; }
.date-card .sep { width: 1px; align-self: stretch; background: rgba(255,255,255,.24); margin: 2px 16px; }

/* ─────────── بطاقتا المصحف / ليلة الختمة ─────────── */
.mini-row { display: flex; gap: 10px; margin-top: 10px; }
.mini-card {
  flex: 1; background: var(--surface); border-radius: 14px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0,0,0,.04);
  transition: transform .12s, box-shadow .12s;
}
.mini-card:hover { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(0,0,0,.08); }
.mini-card .ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; }
.mini-card .ic.green { background: rgba(26,92,56,.1); color: var(--primary); }
.mini-card .ic.gold  { background: rgba(212,160,23,.12); color: var(--gold); }
.mini-card .t { font-size: 13px; font-weight: 700; }

/* ─────────── بانر الجمعة ─────────── */
.friday {
  margin-top: 10px; background: var(--gold-light);
  border: 1px solid rgba(212,160,23,.45); border-radius: 14px; padding: 14px;
  display: flex; align-items: center; gap: 12px;
}
.friday .ic {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(212,160,23,.15); color: var(--gold);
  display: grid; place-items: center; font-size: 22px; flex-shrink: 0;
}
.friday .h { font-weight: 700; font-size: 14px; }
.friday .s { font-size: 12px; color: var(--text-med); }

/* ─────────── عنوان القسم ─────────── */
.section-title { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; }
.section-title .bar { width: 4px; height: 20px; background: var(--primary); border-radius: 2px; }
.section-title h2 { font-size: 18px; font-weight: 700; }
.section-title .sub { margin-inline-start: auto; color: var(--text-low); font-size: 12px; }

/* ─────────── بطاقة الحزب ─────────── */
.hizb-card {
  background: var(--surface); border-radius: 18px; margin-bottom: 12px;
  overflow: hidden; box-shadow: 0 5px 14px rgba(26,92,56,.12);
}
.hizb-top { display: flex; align-items: stretch; }
.hizb-card .badge {
  width: 78px; flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #fff; text-align: center;
}
.hizb-card .badge .lbl { font-size: 11px; opacity: .78; }
.hizb-card .badge .num { font-size: 36px; font-weight: 800; line-height: 1; }
.hizb-card .body { flex: 1; padding: 14px 14px 10px; min-width: 0; }
.hizb-card .opening {
  font-size: 15px; font-weight: 700; line-height: 1.65;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.range-pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(26,92,56,.07); color: var(--primary);
  padding: 4px 8px; border-radius: 8px; font-size: 11px; margin-top: 8px; max-width: 100%;
}
.range-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hizb-card .meta { display: flex; align-items: center; gap: 4px; margin-top: 10px; color: var(--text-low); font-size: 12px; }
.hizb-card .meta .expand { margin-inline-start: auto; color: var(--text-low); font-size: 18px; transition: transform .2s; }
.hizb-card.open .meta .expand { transform: rotate(180deg); }

/* ─────────── أزرار اقرأ / استمع ─────────── */
.actions-row { display: flex; gap: 12px; margin-top: 12px; }
.action-btn {
  flex: 1; border-radius: 14px; padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: #fff; font-weight: 700; transition: transform .12s, filter .12s;
}
.action-btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.action-btn .ic { font-size: 26px; line-height: 1; }
.action-btn .lbl { font-size: 14px; }
.action-btn .sub { font-size: 11px; opacity: .8; font-weight: 500; }
.action-btn.read   { background: var(--blue); box-shadow: 0 5px 10px rgba(26,115,232,.35); }
.action-btn.listen { background: var(--red);  box-shadow: 0 5px 10px rgba(204,0,0,.35); }
.action-btn.disabled { background: #E0E0E0; color: #9e9e9e; box-shadow: none; pointer-events: none; }

/* ─────────── تفاصيل الحزب (قابلة للطي) ─────────── */
.hizb-detail { padding: 0 14px 14px; display: none; }
.hizb-card.open .hizb-detail { display: block; }
.detail-inner { border-top: 1px solid var(--border); padding-top: 14px; }
.athman-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.athman-title .bar { width: 4px; height: 20px; background: var(--primary); border-radius: 2px; }
.athman-title h3 { font-size: 15px; font-weight: 700; }
.athman-title .cnt { margin-inline-start: auto; color: var(--text-low); font-size: 12px; }
.thumn { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 8px; display: flex; gap: 12px; align-items: flex-start; }
.thumn .n { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; background: rgba(26,92,56,.08); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.thumn .txt { flex: 1; min-width: 0; }
.thumn .head { display: flex; align-items: baseline; gap: 6px; }
.thumn .ord { font-weight: 700; font-size: 13px; }
.thumn .loc { color: var(--text-low); font-size: 11px; }
.thumn .verse { font-size: 14px; line-height: 1.9; color: var(--text-high); margin-top: 4px; }

/* ─────────── معاينة الأسبوع ─────────── */
.week { display: flex; gap: 6px; }
.week .day { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 2px; text-align: center; transition: background .18s, color .18s, transform .12s; }
.week .day:hover { transform: translateY(-2px); }
.week .day .wd { font-size: 11px; font-weight: 600; color: var(--text-low); }
.week .day .dn { font-size: 14px; font-weight: 700; margin: 4px 0; }
.week .day .hz { font-size: 10px; color: var(--text-low); }
.week .day.sel { background: var(--primary); border-color: var(--primary); }
.week .day.sel .wd { color: rgba(255,255,255,.7); }
.week .day.sel .dn { color: #fff; }
.week .day.sel .hz { color: rgba(255,255,255,.6); }

/* ═══════════════════════════════════════════════
   نافذة القارئ / المشغّل  (تملأ الشاشة — لا فراغ أسود)
   ═══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.78);
  display: none; align-items: center; justify-content: center; padding: 12px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #1b1b1b; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
/* القارئ (PDF) — شبه ملء الشاشة */
.modal.modal--pdf { width: min(1000px, 96vw); height: 94vh; }
.modal.modal--pdf .frame { flex: 1 1 auto; min-height: 0; background: #525659; }
/* المشغّل (فيديو) — نسبة 16:9 */
.modal.modal--video { width: min(900px, 96vw); }
.modal.modal--video .frame { aspect-ratio: 16 / 9; background: #000; min-height: 0; }

.modal .bar { background: var(--primary); color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.modal .bar .mt { font-size: 15px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal .bar a.newtab, .modal .bar button.close {
  color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 8px; background: rgba(255,255,255,.15); white-space: nowrap;
}
.modal .bar a.newtab:hover, .modal .bar button.close:hover { background: rgba(255,255,255,.3); }
.modal .frame { width: 100%; }
.modal .frame iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ─────────── حالات التحميل / الخطأ ─────────── */
.center-screen { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text-med); }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(26,92,56,.2); border-top-color: var(--primary); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────── قوائم المصحف الكامل / ليالي الختمة ─────────── */
.list-row { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.list-row .av { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: rgba(26,92,56,.1); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.list-row .info { flex: 1; min-width: 0; }
.list-row .info .h { font-weight: 700; font-size: 14px; }
.list-row .info .s { font-size: 12px; color: var(--text-med); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .ics { display: flex; gap: 6px; font-size: 16px; }
.list-row.gold { background: var(--gold-light); border-color: rgba(212,160,23,.5); }
.khatma-banner { background: linear-gradient(135deg, #7B5E2A, var(--gold), #D4A84B); border-radius: 18px; padding: 18px; color: #fff; box-shadow: 0 6px 14px rgba(212,160,23,.35); margin-bottom: 16px; }
.khatma-banner .lbl { color: rgba(255,255,255,.7); font-size: 12px; }
.khatma-banner .dt { font-size: 18px; font-weight: 800; margin-top: 6px; }
.khatma-banner .away { color: rgba(255,255,255,.7); font-size: 13px; margin-top: 6px; }
.khatma-banner .chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.khatma-banner .chips span { background: rgba(255,255,255,.24); padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.back-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.back-bar button { color: var(--primary); font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.datepick { color-scheme: light; }

@media (max-width: 480px) {
  header.appbar .title { font-size: 15px; }
  .thumn .verse { font-size: 13px; }
  .modal-overlay { padding: 0; }
  .modal.modal--pdf { width: 100vw; height: 100vh; border-radius: 0; }
}
