/* ============================================================
   DASHBOARD — تنسيقات اللوحة الرئيسية
   ============================================================ */

/* ---------- الخلفية الزخرفية الناعمة ---------- */
.bg-decor {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  overflow: hidden;
}
.bg-decor::before, .bg-decor::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: 0.55;
}
.bg-decor::before {
  width: 520px; height: 520px;
  background: var(--peach);
  top: -180px; right: -120px;
}
.bg-decor::after {
  width: 600px; height: 600px;
  background: var(--mint);
  bottom: -220px; left: -160px;
}

/* ---------- الحاوية ---------- */
.shell {
  position: relative; z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-6) var(--s-8) var(--s-16);
}

/* ============================================================
   شريط علوي (Top Bar)
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-5);
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s-10);
}
.brand {
  display: flex; align-items: center; gap: var(--s-3);
}
.brand-mark {
  width: 44px; height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--mint-ink) 100%);
  display: grid; place-items: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(106,142,127,0.35);
}
.brand-mark::before {
  content: ""; position: absolute; inset: 8px;
  border: 2px solid #fff; border-radius: 50%;
  border-top-color: transparent;
  transform: rotate(-20deg);
}
.brand-mark::after {
  content: ""; position: absolute; top: 9px; left: 50%;
  transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: #fff;
}
.brand-name {
  font-weight: 800; font-size: 18px; letter-spacing: -0.01em;
  display: flex; flex-direction: column; line-height: 1.1;
}
.brand-name small {
  font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0.02em;
}

.top-stats { display: flex; gap: var(--s-2); align-items: center; }
.stat-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-weight: 600; font-size: 13px;
}
.stat-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.stat-chip.gold .dot { background: var(--gold); }
.stat-chip.rose .dot { background: var(--rose); }
.profile-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 14px;
  background: var(--surface);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  font-weight: 700; font-size: 13px;
}
.profile-pill .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--butter), var(--peach));
  display: grid; place-items: center;
  font-weight: 800; color: var(--ink);
  border: 2px solid #fff;
}

/* ============================================================
   البطاقة الترحيبية (Hero)
   ============================================================ */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--s-6);
  margin-bottom: var(--s-10);
}

.hero-card {
  position: relative;
  background:
    radial-gradient(140% 90% at 100% 0%, rgba(255,217,194,0.55), transparent 60%),
    radial-gradient(120% 80% at 0% 100%, rgba(205,235,215,0.55), transparent 60%),
    var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  padding: var(--s-8);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.85);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; color: var(--brand-ink);
}
.hero-eyebrow .star {
  width: 12px; height: 12px;
  background: var(--brand-ink);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.hero h1 {
  font-size: clamp(28px, 3.4vw, 44px);
  margin: var(--s-4) 0 var(--s-3);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--brand) 0%, var(--lavender-ink) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--ink-2);
  font-size: 16px;
  max-width: 52ch;
  margin: 0 0 var(--s-6);
}
.hero-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 6px 16px rgba(31,37,64,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(31,37,64,0.3); }
.btn-primary .arrow { transition: transform 0.2s ease; }
.btn-primary:hover .arrow { transform: translateX(-4px); }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 14px;
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-soft); }

/* بطاقة التقدم */
.progress-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  padding: var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-5);
  box-shadow: var(--shadow-card);
}
.progress-head { display: flex; align-items: center; justify-content: space-between; }
.progress-head h3 { margin: 0; font-size: 16px; font-weight: 800; }
.progress-head .pct { font-weight: 800; font-size: 22px; color: var(--brand-ink); }

.ring-row { display: flex; align-items: center; gap: var(--s-5); }
.ring {
  --pct: 24;
  width: 96px; height: 96px; flex-shrink: 0;
  border-radius: 50%;
  background:
    conic-gradient(var(--brand) calc(var(--pct) * 1%), var(--brand-soft) 0);
  display: grid; place-items: center;
  position: relative;
}
.ring::after {
  content: ""; position: absolute; inset: 8px; border-radius: 50%;
  background: var(--surface);
}
.ring span {
  position: relative; z-index: 1; font-weight: 800; font-size: 20px; color: var(--brand-ink);
}
.ring-meta { font-size: 13px; color: var(--muted); }
.ring-meta strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 2px; }

.badges-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-2);
  padding-top: var(--s-4); border-top: 1px dashed var(--line);
}
.badge-mini {
  aspect-ratio: 1;
  border-radius: 14px;
  display: grid; place-items: center;
  position: relative;
  font-size: 11px; font-weight: 700; color: var(--ink-2);
}
.badge-mini.earned { background: var(--butter); color: var(--butter-ink); }
.badge-mini.earned::after {
  content: ""; position: absolute; top: 4px; left: 4px;
  width: 10px; height: 10px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 2px var(--butter-ink);
}
.badge-mini.locked { background: var(--bg-soft); color: var(--muted); }
.badge-mini.locked::before {
  content: ""; width: 14px; height: 14px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M6 10V8a6 6 0 1 1 12 0v2h1a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h1Zm2 0h8V8a4 4 0 1 0-8 0v2Z'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M6 10V8a6 6 0 1 1 12 0v2h1a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h1Zm2 0h8V8a4 4 0 1 0-8 0v2Z'/></svg>") center/contain no-repeat;
  opacity: 0.55;
}

/* ============================================================
   شريط التصفية (Filter)
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
  flex-wrap: wrap;
}
.filter-tabs {
  display: flex; gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.filter-tabs button {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-weight: 700; font-size: 13px;
  color: var(--ink-2);
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}
.filter-tabs button:hover { background: var(--bg-soft); }
.filter-tabs button.active {
  background: var(--ink); color: #fff;
}
.filter-tabs .count {
  font-size: 11px; padding: 1px 6px; border-radius: var(--r-pill);
  background: rgba(0,0,0,0.06); margin-right: 6px;
}
.filter-tabs button.active .count { background: rgba(255,255,255,0.18); color: #fff; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  min-width: 260px;
}
.search-box svg { flex-shrink: 0; color: var(--muted); }
.search-box input {
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 13px; width: 100%;
  color: var(--ink);
}
.search-box .kbd {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: var(--bg-soft); color: var(--muted); font-weight: 700;
  border: 1px solid var(--line);
}

/* ============================================================
   الأقسام (Sections)
   ============================================================ */
.section { margin-bottom: var(--s-10); }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: var(--s-5);
  gap: var(--s-4);
}
.section-title-block { display: flex; gap: var(--s-4); align-items: center; }
.section-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  display: grid; place-items: center;
  flex-shrink: 0;
  position: relative;
  font-weight: 800; font-size: 22px;
}

.section h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.section .sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.section-meta {
  display: flex; align-items: center; gap: var(--s-3);
  font-size: 13px; color: var(--muted); font-weight: 600;
}
.section-meta .bar {
  width: 140px; height: 6px;
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.section-meta .bar > span {
  display: block; height: 100%;
  border-radius: var(--r-pill);
}

/* ألوان أقسام مختلفة */
.section[data-color="peach"]    .section-icon { background: var(--peach);    color: var(--peach-ink); }
.section[data-color="mint"]     .section-icon { background: var(--mint);     color: var(--mint-ink); }
.section[data-color="lavender"] .section-icon { background: var(--lavender); color: var(--lavender-ink); }
.section[data-color="sky"]      .section-icon { background: var(--sky);      color: var(--sky-ink); }
.section[data-color="butter"]   .section-icon { background: var(--butter);   color: var(--butter-ink); }

.section[data-color="peach"]    .section-meta .bar > span { background: var(--peach-ink); }
.section[data-color="mint"]     .section-meta .bar > span { background: var(--mint-ink); }
.section[data-color="lavender"] .section-meta .bar > span { background: var(--lavender-ink); }
.section[data-color="sky"]      .section-meta .bar > span { background: var(--sky-ink); }
.section[data-color="butter"]   .section-meta .bar > span { background: var(--butter-ink); }

/* ============================================================
   شبكة الأنشطة (Activity Grid)
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-4);
}
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px)  { .grid { grid-template-columns: repeat(2, 1fr); } .hero { grid-template-columns: 1fr; } .shell { padding: var(--s-4); } }

/* ============================================================
   بطاقة النشاط (Activity Card)
   ============================================================ */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--s-4);
  display: flex; flex-direction: column;
  gap: var(--s-3);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  text-align: right;
  cursor: pointer;
  overflow: hidden;
}
.card::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid transparent;
  transition: border-color 0.22s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.card:hover::after {
  border-color: var(--ink);
}

/* رأس البطاقة: مساحة الأيقونة */
.card-thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  display: grid; place-items: center;
}
.card-thumb .num {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  font-weight: 800; font-size: 11px;
  padding: 4px 8px;
  border-radius: var(--r-pill);
  color: var(--ink);
  z-index: 2;
  font-family: var(--font-en);
  letter-spacing: 0.04em;
}
.card-thumb .glyph {
  width: 60%; height: 60%;
  display: grid; place-items: center;
  position: relative; z-index: 1;
}
.card-thumb .glyph svg { width: 100%; height: 100%; }

/* قفل وعلامة الإنجاز */
.card-thumb .lock,
.card-thumb .check {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  border: 2px solid #fff;
}
.card-thumb .lock { background: rgba(255,255,255,0.85); color: var(--muted); }
.card-thumb .check { background: var(--brand); color: #fff; }

/* ألوان خلفية الأيقونات حسب القسم */
.section[data-color="peach"]    .card-thumb { background: linear-gradient(135deg, #FFE4D0 0%, #FFCFB0 100%); }
.section[data-color="mint"]     .card-thumb { background: linear-gradient(135deg, #DEEFE2 0%, #BFE2CB 100%); }
.section[data-color="lavender"] .card-thumb { background: linear-gradient(135deg, #ECE3FA 0%, #D4C6EB 100%); }
.section[data-color="sky"]      .card-thumb { background: linear-gradient(135deg, #E0EEF7 0%, #C3DDEE 100%); }
.section[data-color="butter"]   .card-thumb { background: linear-gradient(135deg, #FFF3CD 0%, #FFDF95 100%); }

.section[data-color="peach"]    .card-thumb .glyph { color: var(--peach-ink); }
.section[data-color="mint"]     .card-thumb .glyph { color: var(--mint-ink); }
.section[data-color="lavender"] .card-thumb .glyph { color: var(--lavender-ink); }
.section[data-color="sky"]      .card-thumb .glyph { color: var(--sky-ink); }
.section[data-color="butter"]   .card-thumb .glyph { color: var(--butter-ink); }

/* جسم البطاقة */
.card-body { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.card-title {
  font-size: 14px; font-weight: 800; line-height: 1.3;
  color: var(--ink); margin: 0;
  text-wrap: balance;
}
.card-mech {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-en);
  letter-spacing: 0.02em;
}

/* ذيل البطاقة */
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--s-2);
  border-top: 1px dashed var(--line);
  font-size: 11px; font-weight: 700;
}
.card-foot .difficulty {
  display: inline-flex; align-items: center; gap: 2px;
  color: var(--muted);
}
.card-foot .difficulty .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line);
}
.card-foot .difficulty .dot.on { background: var(--gold); }
.card-foot .play {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--brand-ink);
}
.card[data-status="featured"] .card-foot .play { color: var(--ink); }

/* البطاقة المميزة (مفعّلة بالكامل) */
.card[data-status="featured"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #FBF6EC;
}
.card[data-status="featured"] .card-title { color: #FBF6EC; }
.card[data-status="featured"] .card-mech { color: rgba(251,246,236,0.6); }
.card[data-status="featured"] .card-foot { border-top-color: rgba(255,255,255,0.15); }
.card[data-status="featured"] .card-foot .difficulty { color: rgba(251,246,236,0.7); }
.card[data-status="featured"] .card-thumb { background: linear-gradient(135deg, var(--butter) 0%, var(--peach) 100%); }
.card[data-status="featured"] .card-thumb .glyph { color: var(--ink); }
.card[data-status="featured"] .card-thumb .num { background: var(--ink); color: var(--butter); }
.card[data-status="featured"]::before {
  content: "النموذج المُفعَّل";
  position: absolute; top: 12px; left: 12px; z-index: 3;
  font-size: 10px; font-weight: 800;
  padding: 4px 8px; border-radius: var(--r-pill);
  background: var(--butter); color: var(--ink);
  letter-spacing: 0.02em;
}

/* عند تمرير الفأرة على بطاقة مغلقة */
.card[data-locked="true"] { opacity: 0.78; }
.card[data-locked="true"]:hover { opacity: 1; }

/* ============================================================
   التذييل (Footer)
   ============================================================ */
.foot {
  margin-top: var(--s-16);
  padding-top: var(--s-6);
  border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted);
  flex-wrap: wrap; gap: var(--s-3);
}
.foot .links { display: flex; gap: var(--s-5); }
.foot .links a:hover { color: var(--ink); }

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.card { animation: fadeUp 0.5s ease backwards; }
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.06s; }
.card:nth-child(4) { animation-delay: 0.08s; }
.card:nth-child(5) { animation-delay: 0.10s; }
.card:nth-child(6) { animation-delay: 0.12s; }
.card:nth-child(7) { animation-delay: 0.14s; }
.card:nth-child(8) { animation-delay: 0.16s; }
.card:nth-child(9) { animation-delay: 0.18s; }
.card:nth-child(10){ animation-delay: 0.20s; }
