/* =====================================================================
   أداة التشخيص الشرعي والمتابعة — app.alestinara.com
   نظام الألوان: تيل عميق + ذهبي + ورقي دافئ (استمرارية هوية alestinara.com)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Amiri:wght@400;700&display=swap');

:root {
  color-scheme: light;
  --teal-900: #0b3f3f;
  --teal-700: #0b5a5a;
  --teal-600: #0f7a7a;
  --teal-400: #14a8a8;
  --gold-600: #a9822f;
  --gold-500: #c9a24c;
  --gold-300: #e3cd8f;
  --paper: #faf7f0;
  --paper-raised: #ffffff;
  --ink: #2a2416;
  --ink-soft: #5c5646;
  --line: #e7ded0;
  --amber-bg: #fff7e6;
  --amber-line: #e7c477;
  --amber-ink: #6b4f10;

  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-card: 0 1px 2px rgba(20, 20, 10, 0.04), 0 10px 30px -12px rgba(20, 20, 10, 0.18);

  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: inherit; }

html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 15% -10%, rgba(15, 122, 122, 0.06), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(201, 162, 76, 0.08), transparent 55%);
  color: var(--ink);
  font-family: 'Tajawal', system-ui, sans-serif;
  direction: rtl;
  text-align: right;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14201d;
    --paper-raised: #1b2a26;
    --ink: #f2ede1;
    --ink-soft: #b9b09b;
    --line: #2c3b36;
    --amber-bg: #2a2413;
    --amber-line: #5c4a1c;
    --amber-ink: #e3c377;
  }
}
:root[data-theme="dark"] {
  --paper: #14201d;
  --paper-raised: #1b2a26;
  --ink: #f2ede1;
  --ink-soft: #b9b09b;
  --line: #2c3b36;
  --amber-bg: #2a2413;
  --amber-line: #5c4a1c;
  --amber-ink: #e3c377;
}

/* ---------- شريط علوي بسيط ---------- */
.site-bar {
  position: sticky;
  top: 0;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-bar__mark {
  width: 30px; height: 30px; flex-shrink: 0;
}
.site-bar__name {
  font-family: 'Amiri', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--teal-900);
}
.site-bar__spacer { flex: 1; }
.install-btn {
  display: none;
  align-items: center;
  gap: 6px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--teal-700);
  background: transparent;
  border: 1.5px solid var(--teal-600);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.install-btn.is-visible { display: inline-flex; }
.install-btn:active { transform: scale(0.97); }

/* ---------- الحاوية ---------- */
.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.ruqya-container {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 28px 22px 30px;
}

.ruqya-main-title {
  font-family: 'Amiri', serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--teal-900);
  text-align: center;
  margin: 4px 0 22px;
  line-height: 1.5;
}

/* ---------- مؤشر التقدّم (تسلسل فعلي من 3 مراحل) ---------- */
.ruqya-progress-container { margin-bottom: 26px; }

.ruqya-progress-bar {
  position: relative;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.ruqya-progress {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal-600), var(--teal-400));
  border-radius: 999px;
  transition: width 0.45s ease;
  color: transparent;
  font-size: 0;
}

.ruqya-progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}
.ruqya-step {
  position: relative;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  flex: 1;
  text-align: center;
}
.ruqya-step:first-child { text-align: right; }
.ruqya-step:last-child { text-align: left; }
.ruqya-step.active { color: var(--teal-700); }
.ruqya-step::before {
  content: attr(data-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--line);
  color: var(--paper-raised);
  font-size: 0.65rem;
}
.ruqya-step.active::before { background: var(--teal-600); }

/* ---------- تنبيه إخلاء المسؤولية ---------- */
.ruqya-disclaimer {
  background: var(--amber-bg);
  border: 1px solid var(--amber-line);
  border-right: 5px solid var(--gold-500);
  color: var(--amber-ink);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 0.86rem;
  line-height: 1.85;
}
.ruqya-disclaimer strong { display: block; margin-bottom: 4px; color: var(--gold-600); }

/* ---------- الصوت ---------- */
.ruqya-audio-wrapper { margin: 18px 0 10px; }
.ruqya-audio-wrapper audio {
  width: 100%;
  border-radius: 999px;
}

.ruqya-alert-note {
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--teal-600) 8%, transparent);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin: 12px 0 20px;
}

.ruqya-section-header {
  font-family: 'Amiri', serif;
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--teal-800, var(--teal-700));
  border-bottom: 2px solid var(--gold-300);
  padding-bottom: 8px;
  margin-bottom: 18px;
}

.ruqya-subgroup-note {
  font-size: 0.83rem;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.ruqya-divider {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 6px;
}

/* ---------- الأسئلة ---------- */
.ruqya-question-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.ruqya-question-text {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink);
  padding: 0;
  margin-bottom: 10px;
}
.ruqya-options {
  display: flex;
  gap: 10px;
}
.ruqya-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
}
.ruqya-option input { accent-color: var(--teal-600); }
.ruqya-option:has(input:checked) {
  border-color: var(--teal-600);
  background: color-mix(in srgb, var(--teal-600) 9%, transparent);
  color: var(--teal-700);
}

/* ---------- الأزرار ---------- */
.ruqya-button {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 15px 18px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-400));
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.12s, box-shadow 0.12s;
}
.ruqya-button:active { transform: scale(0.985); }
.ruqya-button-secondary {
  background: transparent;
  color: var(--teal-700);
  border: 1.5px solid var(--teal-600);
}

.ruqya-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.ruqya-form-actions .ruqya-button { margin-top: 0; }

/* ---------- النتائج ---------- */
.ruqya-result-box h3 {
  font-family: 'Amiri', serif;
  font-size: 1.2rem;
  color: var(--teal-900);
  margin: 0 0 12px;
}
.ruqya-result-box p { color: var(--ink-soft); font-size: 0.92rem; }

.ruqya-positive {
  background: color-mix(in srgb, var(--teal-600) 8%, transparent);
  border: 1px solid var(--teal-400);
  border-radius: var(--radius-md);
  padding: 18px;
}

.ruqya-scores { margin: 14px 0 18px; }
.ruqya-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}
.ruqya-score-label { width: 92px; flex-shrink: 0; }
.ruqya-score-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.ruqya-score-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.ruqya-score-pct { width: 40px; text-align: left; flex-shrink: 0; }

.ruqya-tracker-link {
  display: block;
  margin-top: 16px;
  padding: 15px;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-400));
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
}

.ruqya-mixed-note {
  background: var(--amber-bg);
  border: 1px dashed var(--amber-line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--amber-ink);
  line-height: 1.8;
}

.ruqya-empty-note {
  text-align: center;
  padding: 20px 6px;
  color: var(--ink-soft);
  line-height: 1.9;
}
.ruqya-empty-note .mark { font-size: 1.6rem; display: block; margin-bottom: 8px; }

/* ---------- تذييل بسيط ---------- */
.app-foot {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: 22px;
}
.app-foot a { color: var(--teal-700); text-decoration: none; font-weight: 700; }

/* ---------- شارة عدم الاتصال ---------- */
.offline-flag {
  display: none;
  text-align: center;
  font-size: 0.78rem;
  background: var(--amber-bg);
  color: var(--amber-ink);
  border: 1px solid var(--amber-line);
  border-radius: 999px;
  padding: 6px 14px;
  margin: 0 auto 16px;
  width: fit-content;
}
body.is-offline .offline-flag { display: block; }

@media print {
  .site-bar, .install-btn, .ruqya-progress-container, .ruqya-form-actions, .app-foot, .offline-flag { display: none !important; }
  body { background: #fff; }
  .ruqya-container { box-shadow: none; border: none; }
}

@keyframes ruqyaFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ruqya-fade-in { animation: ruqyaFadeIn 0.35s ease; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
