/**
 * wird.css — صفحة الورد القرآني اليومي
 * مكتبة ليبيا الطيبة · v33
 *
 * يستخدم متغيّرات design-system.css (parchment + gold + ink)
 * RTL — خطّ Aref Ruqaa للعناوين، Amiri للنصّ.
 */

/* ─── الصفحة ───────────────────────────────────────────────────── */
.wird-page {
  background: var(--bg, #FAF6EE);
  color: var(--text, #2C2418);
  min-height: 100vh;
  font-family: 'Amiri', 'Tajawal', serif;
  direction: rtl;
}

/* ─── البطل (Hero) ─────────────────────────────────────────────── */
.wird-hero {
  text-align: center;
  padding: 3.5rem 1.25rem 2rem;
  position: relative;
}
.wird-hero::after {
  content: '';
  display: block;
  margin: 1.5rem auto 0;
  width: 220px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, #B89968 50%, transparent 100%);
}
.wird-hero h1 {
  font-family: 'Aref Ruqaa', 'Amiri', serif;
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--text, #2C2418);
  margin: 0 0 .65rem;
  letter-spacing: -.01em;
}
.wird-subtitle {
  font-family: 'Amiri', serif;
  font-size: 1.1rem;
  color: var(--text-muted, #4A5878);
  margin: 0;
  font-style: italic;
}

/* ─── الحاوية ──────────────────────────────────────────────────── */
.wird-container {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ─── التهيئة الأولى (Onboarding) ──────────────────────────────── */
.wird-onboarding {
  background: var(--bg-elevated, #FFFEFA);
  border: 1px solid var(--border, #E8D9B5);
  border-radius: 24px;
  padding: 2.5rem 1.5rem;
  box-shadow: 0 12px 32px rgba(15,27,45,.06);
  margin-bottom: 2rem;
}
.wird-onboarding h2 {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.75rem;
  text-align: center;
  margin: 0 0 .5rem;
  color: var(--text, #2C2418);
}
.wird-onboarding-sub {
  text-align: center;
  color: var(--text-muted, #4A5878);
  font-family: 'Amiri', serif;
  font-size: 1.05rem;
  margin: 0 0 2rem;
  font-style: italic;
}

.wird-goals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.wird-goal-card {
  background: var(--bg, #FAF6EE);
  border: 1.5px solid var(--border, #E8D9B5);
  border-radius: 18px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 280ms cubic-bezier(.25,.8,.25,1);
  font-family: 'Amiri', serif;
  color: var(--text, #2C2418);
  position: relative;
}
.wird-goal-card:hover,
.wird-goal-card:focus-visible {
  border-color: #B89968;
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(184,153,104,.18);
  outline: none;
}
.wird-goal-card.selected {
  background: rgba(184,153,104,.08);
  border-color: #B89968;
  box-shadow: 0 0 0 3px rgba(184,153,104,.15);
}
.wird-goal-icon {
  font-size: 2.4rem;
  display: block;
  margin: 0 auto .65rem;
  line-height: 1;
}
.wird-goal-card h3 {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 .35rem;
  color: var(--text, #2C2418);
}
.wird-goal-card p {
  font-family: 'Amiri', serif;
  font-size: 1rem;
  color: var(--text-muted, #4A5878);
  margin: 0 0 .65rem;
}
.wird-goal-card small {
  font-family: 'Cairo', sans-serif;
  font-size: .75rem;
  color: #B89968;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

/* ─── إدخال المخصّص ───────────────────────────────────────────── */
.wird-custom-input {
  display: none;
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--bg, #FAF6EE);
  border: 1.5px dashed #B89968;
  border-radius: 14px;
  text-align: center;
}
.wird-custom-input.show { display: block; }
.wird-custom-input label {
  display: block;
  font-family: 'Aref Ruqaa', serif;
  font-size: 1.1rem;
  margin-bottom: .75rem;
  color: var(--text, #2C2418);
}
.wird-custom-input input {
  width: 120px;
  text-align: center;
  font-family: 'Aref Ruqaa', serif;
  font-size: 1.5rem;
  padding: .65rem .75rem;
  border: 1px solid #B89968;
  border-radius: 10px;
  background: var(--bg-elevated, #FFFEFA);
  color: var(--text, #2C2418);
}
.wird-custom-input .wird-custom-hint {
  margin-top: .75rem;
  font-size: .9rem;
  color: var(--text-muted, #4A5878);
  font-family: 'Amiri', serif;
  font-style: italic;
}

.wird-onboarding-actions {
  text-align: center;
  margin-top: 1.5rem;
}

/* ─── ورد اليوم (Today Card) ──────────────────────────────────── */
.wird-today-card {
  background: linear-gradient(180deg, #FFFEFA 0%, #FAF6EE 100%);
  border: 1px solid var(--border, #E8D9B5);
  border-radius: 24px;
  padding: 2.25rem 1.5rem;
  text-align: center;
  position: relative;
  margin-bottom: 2rem;
  box-shadow: 0 12px 32px rgba(15,27,45,.06);
  overflow: hidden;
}
.wird-today-card::before,
.wird-today-card::after {
  content: '✦';
  position: absolute;
  top: 1rem;
  color: #B89968;
  font-size: 1.1rem;
  opacity: .55;
}
.wird-today-card::before { right: 1.25rem; }
.wird-today-card::after { left: 1.25rem; }

.wird-today-card h2 {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.8rem;
  margin: 0 0 .35rem;
  color: var(--text, #2C2418);
}
.wird-today-date {
  font-family: 'Amiri', serif;
  font-size: .95rem;
  color: var(--text-muted, #4A5878);
  margin: 0 0 1.5rem;
  font-style: italic;
}

.wird-portion {
  background: rgba(184,153,104,.06);
  border: 1px solid rgba(184,153,104,.25);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  margin: 0 auto 1.5rem;
  max-width: 460px;
}
.wird-portion p {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  color: var(--text, #2C2418);
  margin: 0 0 .5rem;
  line-height: 1.6;
}
.wird-portion p:last-child { margin-bottom: 0; }
.wird-portion strong {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  color: #B89968;
  font-size: 1.2rem;
  padding: 0 .15rem;
}

.wird-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.wird-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 1.6rem;
  border-radius: 12px;
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 280ms cubic-bezier(.25,.8,.25,1);
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.wird-btn-gold {
  background: linear-gradient(135deg, #B89968 0%, #D4AF37 100%);
  color: #2C2418;
  border-color: #B89968;
  box-shadow: 0 4px 14px rgba(184,153,104,.35);
}
.wird-btn-gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(184,153,104,.45);
}
.wird-btn-outline {
  background: transparent;
  color: var(--text, #2C2418);
  border-color: var(--border-strong, #D4B888);
}
.wird-btn-outline:hover {
  background: rgba(184,153,104,.12);
  border-color: #B89968;
  color: #B89968;
}
.wird-btn-outline.done {
  background: rgba(74,107,58,.12);
  border-color: #4A6B3A;
  color: #4A6B3A;
  cursor: default;
}

/* ─── شريط التقدّم + الإحصاءات ───────────────────────────────── */
.wird-progress {
  background: var(--bg-elevated, #FFFEFA);
  border: 1px solid var(--border, #E8D9B5);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  margin-bottom: 2rem;
}
.wird-progress h3 {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.3rem;
  margin: 0 0 1rem;
  text-align: center;
  color: var(--text, #2C2418);
}
.wird-progress-bar {
  width: 100%;
  height: 14px;
  background: var(--bg-subtle, #F4ECD9);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border, #E8D9B5);
  margin-bottom: 1.5rem;
}
.wird-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #B89968 0%, #D4AF37 100%);
  border-radius: 999px;
  transition: width 600ms cubic-bezier(.25,.8,.25,1);
  position: relative;
}
.wird-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.3) 50%, transparent 100%);
  border-radius: inherit;
}

.wird-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}
.wird-stat {
  text-align: center;
  padding: 1rem .75rem;
  background: var(--bg, #FAF6EE);
  border-radius: 14px;
  border: 1px solid var(--border, #E8D9B5);
}
.wird-stat-value {
  display: block;
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 2rem;
  color: #B89968;
  line-height: 1.1;
  margin-bottom: .25rem;
}
.wird-stat-label {
  display: block;
  font-family: 'Amiri', serif;
  font-size: .92rem;
  color: var(--text-muted, #4A5878);
}

/* ─── التقويم ──────────────────────────────────────────────────── */
.wird-calendar-wrap {
  background: var(--bg-elevated, #FFFEFA);
  border: 1px solid var(--border, #E8D9B5);
  border-radius: 20px;
  padding: 1.75rem 1.5rem;
  margin-bottom: 2rem;
}
.wird-calendar-wrap h3 {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.3rem;
  margin: 0 0 1rem;
  text-align: center;
  color: var(--text, #2C2418);
}
.wird-calendar-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-family: 'Amiri', serif;
  font-size: .9rem;
  color: var(--text-muted, #4A5878);
}
.wird-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.wird-calendar-legend .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.wird-calendar {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: .35rem;
  max-width: 540px;
  margin: 0 auto;
}
@media (max-width: 540px) {
  .wird-calendar { grid-template-columns: repeat(10, 1fr); }
}
.wird-day {
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--bg-subtle, #F4ECD9);
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  display: grid;
  place-items: center;
  font-family: 'Cairo', sans-serif;
  font-size: .65rem;
  color: var(--text-muted, #4A5878);
  transition: all 200ms ease;
}
.wird-day:hover { transform: scale(1.08); z-index: 2; }
.wird-day.read { background: #4A6B3A; color: #FAF6EE; }
.wird-day.missed { background: rgba(177,55,63,.25); color: #B1373F; border-color: rgba(177,55,63,.4); }
.wird-day.today { background: rgba(184,153,104,.25); border: 2px solid #B89968; color: #2C2418; font-weight: 700; }
.wird-day.today.read { background: #4A6B3A; color: #FAF6EE; border-color: #4A6B3A; }
.wird-day.future { opacity: .35; cursor: default; }
.wird-day.before-start { opacity: .15; cursor: default; }
.wird-day-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text, #2C2418);
  color: var(--bg, #FAF6EE);
  padding: .35rem .6rem;
  border-radius: 8px;
  font-family: 'Amiri', serif;
  font-size: .8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  z-index: 10;
}
.wird-day:hover .wird-day-tip { opacity: 1; }

/* ─── الإعدادات ───────────────────────────────────────────────── */
.wird-settings {
  background: var(--bg-elevated, #FFFEFA);
  border: 1px solid var(--border, #E8D9B5);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.wird-settings summary {
  cursor: pointer;
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text, #2C2418);
  padding: .25rem 0;
  user-select: none;
}
.wird-settings summary:hover { color: #B89968; }
.wird-settings-body {
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.wird-settings-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  font-family: 'Amiri', serif;
}
.wird-settings button {
  background: transparent;
  border: 1px solid var(--border, #E8D9B5);
  border-radius: 10px;
  padding: .55rem 1rem;
  font-family: 'Aref Ruqaa', serif;
  font-size: .95rem;
  cursor: pointer;
  color: var(--text, #2C2418);
  transition: all 200ms ease;
}
.wird-settings button:hover {
  border-color: #B89968;
  color: #B89968;
  background: rgba(184,153,104,.08);
}
.wird-settings input[type="time"] {
  padding: .45rem .65rem;
  border: 1px solid var(--border, #E8D9B5);
  border-radius: 10px;
  background: var(--bg, #FAF6EE);
  color: var(--text, #2C2418);
  font-family: 'Cairo', sans-serif;
  font-size: 1rem;
}

/* ─── احتفاء الختمة ───────────────────────────────────────────── */
.wird-celebration {
  position: fixed;
  inset: 0;
  background: rgba(15,27,45,.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.wird-celebration.show { display: flex; }
.wird-celebration-card {
  background: linear-gradient(180deg, #FFFEFA 0%, #FAF6EE 100%);
  border: 2px solid #B89968;
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(15,27,45,.4), 0 0 64px rgba(212,175,55,.3);
  animation: wird-celebrate 600ms cubic-bezier(.25,.8,.25,1);
}
@keyframes wird-celebrate {
  from { opacity: 0; transform: scale(.85); }
  to { opacity: 1; transform: scale(1); }
}
.wird-celebration-icon {
  font-size: 4rem;
  margin-bottom: .75rem;
  display: block;
  animation: wird-spin 4s linear infinite;
}
@keyframes wird-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.wird-celebration h3 {
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.75rem;
  color: #2C2418;
  margin: 0 0 .5rem;
}
.wird-celebration p {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  color: #4A5878;
  margin: 0 0 1.5rem;
  font-style: italic;
  line-height: 1.6;
}
.wird-celebration button {
  background: linear-gradient(135deg, #B89968 0%, #D4AF37 100%);
  color: #2C2418;
  border: 0;
  padding: .85rem 2rem;
  border-radius: 12px;
  font-family: 'Aref Ruqaa', serif;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
}

/* ─── الإيشي (Toast) للرسائل القصيرة ───────────────────────────── */
.wird-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text, #2C2418);
  color: var(--bg, #FAF6EE);
  padding: .85rem 1.5rem;
  border-radius: 999px;
  font-family: 'Amiri', serif;
  font-size: 1rem;
  box-shadow: 0 12px 32px rgba(15,27,45,.3);
  opacity: 0;
  transition: all 300ms cubic-bezier(.25,.8,.25,1);
  z-index: 90;
  pointer-events: none;
}
.wird-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── الوضع الليلي ────────────────────────────────────────────── */
[data-theme="dark"] .wird-page { color: #F4EBD4; }
[data-theme="dark"] .wird-day { background: rgba(255,255,255,.06); }
[data-theme="dark"] .wird-day.read { background: #6B8B5A; color: #0F1B2D; }
[data-theme="dark"] .wird-portion { background: rgba(184,153,104,.12); }
[data-theme="dark"] .wird-goal-card { background: rgba(255,255,255,.03); }
[data-theme="dark"] .wird-goal-card.selected { background: rgba(184,153,104,.15); }

/* ─── الاستجابة للموبايل ──────────────────────────────────────── */
@media (max-width: 640px) {
  .wird-hero { padding: 2.5rem 1rem 1.5rem; }
  .wird-today-card { padding: 1.75rem 1rem; }
  .wird-portion { padding: 1rem .75rem; }
  .wird-portion p { font-size: 1.05rem; }
  .wird-portion strong { font-size: 1.1rem; }
  .wird-stat-value { font-size: 1.6rem; }
  .wird-actions { flex-direction: column; }
  .wird-actions .wird-btn { width: 100%; justify-content: center; }
}
