/* ==============================================================
   Mama Ruqia Girls' Qur'an Competition — Design System
   Palette: espresso / gold / cream · ceremonial Islamic-royal
   Motion: every transition ≤ 250ms
   ============================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400&family=Cormorant+Garamond:wght@500;600;700&family=Jost:wght@300;400;500;600&display=swap');

:root {
  /* Color tokens */
  --espresso:      #2B1B12;
  --espresso-deep: #1F1209;
  --espresso-soft: #3A281B;
  --gold:          #C9962E;
  --gold-bright:   #E8B84B;
  --gold-pale:     #F0D79A;
  --cream:         #F5EFE3;
  --cream-deep:    #EDE3CF;
  --ivory:         #FBF8F1;
  --green:         #2E6B4F;
  --green-soft:    #E4F0EA;
  --maroon:        #8C3A34;
  --maroon-soft:   #F5E4E2;
  --ink:           #2B2118;
  --ink-soft:      #6B5D4E;

  /* Type */
  --f-display: 'Cormorant Garamond', Georgia, serif;
  --f-body:    'Jost', 'Segoe UI', sans-serif;
  --f-arabic:  'Amiri', 'Traditional Arabic', serif;

  /* Motion — hard ceiling 250ms */
  --t-fast: 150ms cubic-bezier(.4,0,.2,1);
  --t-med:  250ms cubic-bezier(.4,0,.2,1);

  /* Elevation system */
  --el-1: 0 1px 3px rgba(43,27,18,.08), 0 1px 2px rgba(43,27,18,.06);
  --el-2: 0 4px 10px rgba(43,27,18,.10), 0 2px 4px rgba(43,27,18,.06);
  --el-3: 0 12px 28px rgba(43,27,18,.16), 0 4px 8px rgba(43,27,18,.08);
  --el-gold: 0 6px 20px rgba(201,150,46,.30);

  --radius: 14px;
  --radius-sm: 8px;
  --maxw: 1180px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: var(--f-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--ivory);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.ar, [lang="ar"] { font-family: var(--f-arabic); }

img { max-width: 100%; display: block; }
a { color: var(--gold); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--gold-bright); }

/* Focus visibility — accessibility */
:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 2px;
  border-radius: 4px;
}

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- Islamic geometric pattern (custom SVG, 8-point star) ---------- */
.pattern-dark {
  background-color: var(--espresso);
  background-image: url("data:image/svg+xml,%3Csvg width='96' height='96' viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23C9962E' stroke-opacity='0.10' stroke-width='1'%3E%3Cpath d='M48 8 L58 38 L88 48 L58 58 L48 88 L38 58 L8 48 L38 38 Z'/%3E%3Cpath d='M48 20 L55 41 L76 48 L55 55 L48 76 L41 55 L20 48 L41 41 Z'/%3E%3Ccircle cx='48' cy='48' r='6'/%3E%3Cpath d='M0 0 L12 0 M0 0 L0 12 M96 0 L84 0 M96 0 L96 12 M0 96 L12 96 M0 96 L0 84 M96 96 L84 96 M96 96 L96 84'/%3E%3C/g%3E%3C/svg%3E");
}
.pattern-light {
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg width='96' height='96' viewBox='0 0 96 96' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23C9962E' stroke-opacity='0.13' stroke-width='1'%3E%3Cpath d='M48 8 L58 38 L88 48 L58 58 L48 88 L38 58 L8 48 L38 38 Z'/%3E%3Ccircle cx='48' cy='48' r='6'/%3E%3C/g%3E%3C/svg%3E");
}

/* Gold divider flourish */
.divider {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin: 8px auto 28px; max-width: 420px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.divider::after { background: linear-gradient(90deg, var(--gold), transparent); }
.divider svg { flex-shrink: 0; }

/* ---------- Typography ---------- */
.h-display {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--espresso);
}
.h-section {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  text-align: center;
  color: var(--espresso);
}
.pattern-dark .h-section { color: var(--gold-pale); }

.verse {
  font-family: var(--f-arabic);
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  color: var(--gold-bright);
  direction: rtl;
  text-align: center;
  line-height: 2;
}
.verse-translation {
  font-style: italic;
  font-size: .95rem;
  color: var(--ink-soft);
  text-align: center;
  margin-top: 6px;
}
.pattern-dark .verse-translation { color: var(--gold-pale); opacity: .85; }
.verse-ref { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--f-body); font-weight: 600; font-size: 1rem;
  padding: 14px 34px; border-radius: 50px; border: none; cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.btn:active { transform: scale(.97); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-bright));
  color: var(--espresso-deep);
  box-shadow: var(--el-gold);
}
.btn-gold:hover { box-shadow: 0 8px 26px rgba(201,150,46,.45); transform: translateY(-2px); }
.btn-outline {
  background: transparent; color: var(--gold);
  border: 1.5px solid var(--gold);
}
.btn-outline:hover { background: rgba(201,150,46,.08); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #275C44; }
.btn-maroon { background: var(--maroon); color: #fff; }
.btn-maroon:hover { background: #7A322D; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--cream-deep); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* CTA pulse — subtle, respects 250ms transition, slow ambient loop */
.btn-cta { animation: ctaGlow 2.4s ease-in-out infinite; }
@keyframes ctaGlow {
  0%, 100% { box-shadow: 0 6px 20px rgba(201,150,46,.30); }
  50%      { box-shadow: 0 6px 30px rgba(232,184,75,.55); }
}

/* ---------- Cards ---------- */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--el-1);
  transition: box-shadow var(--t-med), transform var(--t-med);
}
.card:hover { box-shadow: var(--el-2); }
.card-gold { border: 1.5px solid var(--gold-pale); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 4px 14px; border-radius: 40px;
  font-size: .8rem; font-weight: 600; letter-spacing: .03em;
}
.badge-pending  { background: var(--gold-pale); color: #7A5A14; }
.badge-approved { background: var(--green-soft); color: var(--green); }
.badge-rejected { background: var(--maroon-soft); color: var(--maroon); }
.badge-info     { background: #E8EDF5; color: #3A5A8C; }
.badge-dup      { background: #F3E8FA; color: #6D3E93; }

/* ---------- Forms ---------- */
.field { margin-bottom: 20px; }
.field label {
  display: block; font-weight: 500; font-size: .92rem;
  margin-bottom: 6px; color: var(--espresso);
}
.field .req { color: var(--maroon); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 16px; font-family: var(--f-body); font-size: 1rem;
  border: 1.5px solid var(--cream-deep); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,150,46,.15);
}
.field input.invalid, .field select.invalid { border-color: var(--maroon); }
.field .error-msg {
  color: var(--maroon); font-size: .82rem; margin-top: 4px;
  display: none;
}
.field.show-error .error-msg { display: block; }
.field .hint { font-size: .82rem; color: var(--ink-soft); margin-top: 4px; }

.radio-row { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-pill {
  position: relative; cursor: pointer;
}
.radio-pill input { position: absolute; opacity: 0; }
.radio-pill span {
  display: inline-block; padding: 10px 24px; border-radius: 40px;
  border: 1.5px solid var(--cream-deep); font-weight: 500;
  transition: all var(--t-fast); background: #fff;
}
.radio-pill input:checked + span {
  background: var(--espresso); color: var(--gold-bright); border-color: var(--espresso);
}
.radio-pill input:focus-visible + span { outline: 3px solid var(--gold-bright); outline-offset: 2px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--espresso); color: var(--cream); padding: 14px 28px;
  border-radius: 50px; box-shadow: var(--el-3); z-index: 999;
  opacity: 0; pointer-events: none; transition: opacity var(--t-med), transform var(--t-med);
  border: 1px solid var(--gold);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(31,18,9,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 900; opacity: 0; pointer-events: none;
  transition: opacity var(--t-med); padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--ivory); border-radius: var(--radius);
  max-width: 720px; width: 100%; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--el-3); border-top: 4px solid var(--gold);
  transform: scale(.94); transition: transform var(--t-med);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px; border-bottom: 1px solid var(--cream-deep);
}
.modal-body { padding: 24px 28px; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; cursor: pointer;
  color: var(--ink-soft); line-height: 1; padding: 4px 10px; border-radius: 8px;
  transition: background var(--t-fast), color var(--t-fast);
}
.modal-close:hover { background: var(--cream); color: var(--maroon); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity var(--t-med), transform var(--t-med); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Tables (admin) ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--el-1); background: #fff; }
table.data { width: 100%; border-collapse: collapse; min-width: 760px; }
table.data th {
  text-align: left; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); padding: 14px 16px; background: var(--cream);
  border-bottom: 2px solid var(--gold-pale); white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid var(--cream-deep); vertical-align: middle; }
table.data tbody tr { transition: background var(--t-fast); cursor: pointer; animation: rowFade 250ms ease both; }
table.data tbody tr:hover { background: var(--cream); }
@keyframes rowFade { from { opacity: 0; } to { opacity: 1; } }
.thumb { width: 42px; height: 56px; object-fit: cover; border-radius: 6px; border: 1.5px solid var(--gold-pale); }

/* ---------- RTL ---------- */
[dir="rtl"] body, [dir="rtl"] { font-family: var(--f-arabic); }
[dir="rtl"] table.data th { text-align: right; }
[dir="rtl"] .field label { text-align: right; }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--ink-soft);
}
.empty-state svg { margin: 0 auto 16px; opacity: .5; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; } .mb-4 { margin-bottom: 40px; }
.grid { display: grid; gap: 24px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-4 { grid-template-columns: repeat(4, 1fr); } .grid-3 { grid-template-columns: repeat(3,1fr);} }
@media (min-width: 500px) and (max-width: 719px) { .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; } }
