/* ==========================================================================
   ثيم «Sakura» (تجريبي) — أبيض ووردي، بتطعيم ذهبي:
   إطارات ذهبية رفيعة، نقش نقاط ذهبية خفيف بالخلفية، ولمعة ذهبية على لوحة الترحيب.
   صفحة الدخول تبقى سودة وحمرة (auth-fx) مثل باقي الثيمات.
   ========================================================================== */

:root[data-theme="sakura"] {
  color-scheme: light;
  --bg: #FFF4F7; --surface: #FFFFFF; --surface-2: #FDEBF1;
  --border: rgba(194, 54, 111, .14); --border-strong: rgba(194, 54, 111, .32);
  --text: #3B2430; --muted: #7D5E6C;
  --primary: #C2366F; --primary-hover: #A82A5D; --primary-soft: rgba(194, 54, 111, .1); --on-primary: #FFFFFF;
  --gold: #B8892E; --gold-deep: #8F6518; --gold-light: #E9CF8F;
  --accent: var(--gold);
  --grad-a: #A82A5D; --grad-b: #D9578B; --orb: #E58AAE;
  --grad: linear-gradient(120deg, #B32D64, #D9578B);
  --grad-dark: linear-gradient(120deg, #A82A5D, #C2366F);
  --blob-1: rgba(233, 120, 165, .16); --blob-2: rgba(233, 207, 143, .22);
  --danger: #B3263A; --danger-soft: rgba(179, 38, 58, .1);
  --ok: #3F7A52; --ok-soft: rgba(63, 122, 82, .12);
  --warn: #8F6518; --warn-soft: rgba(184, 137, 46, .14);
  --star: #C9982F;
  --r-lg: 14px; --r-md: 10px; --r-sm: 6px;
  --font: "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(120, 40, 75, .05), 0 10px 26px rgba(120, 40, 75, .07);
  --shadow-lift: 0 2px 6px rgba(120, 40, 75, .08), 0 16px 34px rgba(120, 40, 75, .12), 0 0 0 1px rgba(184, 137, 46, .55);
  --icon-c: #C2366F;
}
:root[data-theme="sakura"] body { background: var(--bg); }

/* ---------- الخلفية: غيوم وردية ناعمة + نقش نقاط ذهبية ---------- */
:root[data-theme="sakura"] body::before {
  background:
    radial-gradient(rgba(184, 137, 46, .28) 1px, transparent 1.6px) 0 0 / 26px 26px,
    radial-gradient(900px 560px at 100% -10%, var(--blob-1), transparent 62%),
    radial-gradient(760px 560px at -10% 110%, var(--blob-2), transparent 62%),
    radial-gradient(600px 400px at 30% 40%, rgba(255, 255, 255, .7), transparent 70%);
}
:root[data-theme="sakura"] body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 45%, rgba(214, 90, 140, .09) 100%);
}

/* ---------- إطار ذهبي يلمع ويدور حول حواف الصفحة ----------
   خفيف على المعالج: الإطار مقصوص مرة وحدة، واللي يدور بداخله طبقة بـ transform بس
   (تشتغل على كرت الشاشة)، والتوهج ثابت. العناصر يخلقها sakura-sparkle.js. */
.sk-frame, .sk-glow { display: none; }
:root[data-theme="sakura"] .sk-frame {
  display: block; position: fixed; inset: 0; z-index: 9990; pointer-events: none;
  padding: 3px; overflow: hidden; contain: strict;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
:root[data-theme="sakura"] .sk-frame-spin {
  position: absolute; left: 50%; top: 50%;
  width: 160vmax; height: 160vmax;
  background: conic-gradient(
    #B8892E 0deg, #E9CF8F 30deg, #FFFBEA 48deg, #F6E3A8 62deg, #C9982F 100deg,
    #8F6518 160deg, #C9982F 200deg, #E9CF8F 250deg, #FFF6D8 268deg, #D4A843 290deg, #B8892E 360deg);
  transform: translate(-50%, -50%) rotate(0deg);
  will-change: transform;
  animation: sk-rot 7s linear infinite;
}
/* توهج ناعم ثابت على الحواف (ينرسم مرة وحدة) */
:root[data-theme="sakura"] .sk-glow {
  display: block; position: fixed; inset: 0; z-index: 9989; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(233, 207, 143, .5), inset 0 0 14px 2px rgba(233, 190, 90, .35);
}
@keyframes sk-rot { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ---------- الخط ---------- */
:root[data-theme="sakura"] :is(body, button, input, select, textarea, h1, h2, h3, h4, .brand, .auth-art-title) { font-family: var(--font); }
:root[data-theme="sakura"] :is(h1, h2, h3) { font-weight: 700; letter-spacing: 0; }
:root[data-theme="sakura"] :is(.stat-value, .hero-stat b) { font-variant-numeric: tabular-nums; }

/* ---------- الأسطح: بيضاء بحد وردي خفيف، والحد يصير ذهبي عند التأشير ---------- */
/* دوائر اللوحة تصير نجوم ذهبية صغيرة تلمع */
:root[data-theme="sakura"] .hero-orb {
  display: block; border: 0; border-radius: 0; opacity: 0; filter: drop-shadow(0 0 6px rgba(233, 190, 90, .8));
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 0C13 7 17 11 24 12C17 13 13 17 12 24C11 17 7 13 0 12C7 11 11 7 12 0Z' fill='%23D4A843'/%3E%3C/svg%3E") center / contain no-repeat;
  animation: sk-twinkle 3.4s ease-in-out infinite;
}
:root[data-theme="sakura"] .hero-orb.o1 { width: 22px; height: 22px; top: 22px; bottom: auto; inset-inline-start: auto; inset-inline-end: 28%; }
:root[data-theme="sakura"] .hero-orb.o2 { width: 14px; height: 14px; top: auto; bottom: 30px; inset-inline-end: 46%; animation-delay: -1.2s; animation-duration: 2.8s; }
:root[data-theme="sakura"] .hero-orb.o3 { width: 17px; height: 17px; top: 46%; inset-inline-end: 5%; animation-delay: -2.2s; animation-duration: 3.9s; }
@keyframes sk-twinkle {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); }
  45%      { opacity: 1; transform: scale(1) rotate(45deg); }
  60%      { opacity: .9; transform: scale(.85) rotate(60deg); }
}
:root[data-theme="sakura"] :is(.card, .tile, .mini-item, .modal, .palette, .account-menu, .stat, .profile-card, .row-card, .news, .subject) {
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
:root[data-theme="sakura"] :is(.tile, .subject, .stat, .profile-card, .row-card, .news, .mini-item) { background: var(--surface); }
:root[data-theme="sakura"] :is(.sidebar, .topbar-in, .bottomnav) {
  background: color-mix(in srgb, #FFFFFF 90%, transparent);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--border);
  border-radius: 16px;
}
:root[data-theme="sakura"] :is(.tile, .subject, .row-card, .mini-item, .publisher-card, .news) { transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
:root[data-theme="sakura"] :is(.tile, .subject, .row-card, .mini-item, .publisher-card, .news):hover {
  border-color: rgba(184, 137, 46, .6); box-shadow: var(--shadow-lift);
}
/* عنوان القسم: معيّن ذهبي صغير بداله النقطة */
:root[data-theme="sakura"] .section-title h2::before {
  width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 0 0 2px rgba(184, 137, 46, .15);
}
:root[data-theme="sakura"] .page-head:not(.subject-banner) h1 { color: var(--text); }

/* ---------- التنقل والأزرار ---------- */
:root[data-theme="sakura"] :is(.side-link, .menu-item, .user-card, .filter, .seg, .seg button, .input, .chip, .rate-btn) { border-radius: 10px; }
:root[data-theme="sakura"] .btn { border-radius: 999px; box-shadow: none; }
:root[data-theme="sakura"] .btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -10px rgba(194, 54, 111, .7), inset 0 0 0 1px rgba(233, 207, 143, .45); }
:root[data-theme="sakura"] .btn-ghost, :root[data-theme="sakura"] .btn-ghost:hover { background: #FFFFFF; box-shadow: inset 0 0 0 1px var(--border-strong); }
:root[data-theme="sakura"] .side-link.active,
:root[data-theme="sakura"] .bottomnav a.active {
  background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(194, 54, 111, .22);
}
:root[data-theme="sakura"] .side-link { position: relative; }
:root[data-theme="sakura"] .side-link.active::after {
  content: ""; position: absolute; inset-inline-start: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
}
:root[data-theme="sakura"] .side-link:hover:not(.active) { color: var(--text); background: rgba(194, 54, 111, .05); }
:root[data-theme="sakura"] .brand-mark {
  background: #FFFFFF; color: var(--primary); border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--gold), 0 0 0 3px #FFFFFF, 0 0 0 4px rgba(184, 137, 46, .35);
}
:root[data-theme="sakura"] :is(.fab, .bn-search-circle) { background: var(--grad); color: #fff; box-shadow: 0 0 0 1px rgba(233, 207, 143, .7), 0 12px 26px -8px rgba(194, 54, 111, .6); border-radius: 999px; }
:root[data-theme="sakura"] .bn-search-circle { box-shadow: 0 0 0 5px var(--bg), 0 0 0 6px rgba(184, 137, 46, .5), 0 10px 22px -6px rgba(194, 54, 111, .6); }
:root[data-theme="sakura"] :is(.tile-meta, .tile-chips .chip) { background: var(--surface-2); color: var(--muted); }
:root[data-theme="sakura"] :is(.input, input, select, textarea):focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ==========================================================================
   لوحة الترحيب: بطاقة بيضاء بإطار ذهبي مزدوج ولمعة ذهبية تمر عليها مرة وحدة
   ========================================================================== */
:root[data-theme="sakura"] .hero {
  background:
    radial-gradient(560px 240px at 100% 0%, rgba(233, 120, 165, .2), transparent 70%),
    radial-gradient(420px 220px at 0% 100%, rgba(233, 207, 143, .25), transparent 70%),
    #FFFFFF;
  color: var(--text);
  border: 1px solid rgba(184, 137, 46, .55); border-radius: 18px;
  box-shadow: 0 22px 44px -28px rgba(194, 54, 111, .45), var(--shadow);
  overflow: hidden;
}
:root[data-theme="sakura"] .hero { padding-top: 34px; }
/* الإطار الداخلي الرفيع */
:root[data-theme="sakura"] .hero::before {
  content: ""; position: absolute; inset: 7px; z-index: -1; pointer-events: none;
  border: 1px solid rgba(184, 137, 46, .35); border-radius: 12px;
}
/* لمعة ذهبية تعبر اللوحة عند فتح الصفحة */
:root[data-theme="sakura"] .hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(233, 207, 143, .45) 48%, rgba(255, 255, 255, .6) 50%, transparent 62%);
  transform: translateX(120%);
  animation: sk-shine 2.2s .5s cubic-bezier(.4, 0, .2, 1) 1 both;
}
@keyframes sk-shine { from { transform: translateX(120%); } to { transform: translateX(-120%); } }
:root[data-theme="sakura"] .hero h1 { color: var(--text); }
:root[data-theme="sakura"] .hero-name { color: var(--primary); }
:root[data-theme="sakura"] .hero-tip { color: var(--muted); }
:root[data-theme="sakura"] .hero-tip b { color: var(--gold-deep); }
:root[data-theme="sakura"] .hero .avatar { box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 3.5px var(--gold), 0 8px 20px -6px rgba(194, 54, 111, .5); }
:root[data-theme="sakura"] .hero-hello { flex: 1; }
:root[data-theme="sakura"] .hero-date {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: 4px;
}
:root[data-theme="sakura"] .hero-date::before {
  content: ""; width: 7px; height: 7px; border-radius: 1px; transform: rotate(45deg);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}
:root[data-theme="sakura"] .hero-stat {
  background: #FFF7FA; color: var(--text); border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(184, 137, 46, .4);
}
:root[data-theme="sakura"] .hero-stat b { color: var(--primary); }
:root[data-theme="sakura"] .hero-stat .icon { color: var(--gold); }
:root[data-theme="sakura"] .hero-search {
  background: #FFFFFF; color: var(--muted); border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(194, 54, 111, .18);
  transition: box-shadow .25s ease, color .25s ease;
}
:root[data-theme="sakura"] .hero-search:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--gold), 0 0 0 4px rgba(233, 207, 143, .3); transform: none; }
:root[data-theme="sakura"] .hero-search .icon { color: var(--primary); }

/* ==========================================================================
   الأيقونات: وردي على أبيض، وعند التأشير تمتلي وردي بحلقة ذهبية
   ========================================================================== */
:root[data-theme="sakura"] .subject[data-icon="cpu"]      { --icon-c: #C2366F; }
:root[data-theme="sakura"] .subject[data-icon="tree"]     { --icon-c: #D1497F; }
:root[data-theme="sakura"] .subject[data-icon="math"]     { --icon-c: #A8305F; }
:root[data-theme="sakura"] .subject[data-icon="terminal"] { --icon-c: #B8892E; }
:root[data-theme="sakura"] .subject[data-icon="circuit"]  { --icon-c: #C2366F; }
:root[data-theme="sakura"] .subject[data-icon="history"]  { --icon-c: #9E7424; }
:root[data-theme="sakura"] .subject[data-icon="book"]     { --icon-c: #C2366F; }
:root[data-theme="sakura"] [class^="c-"],
:root[data-theme="sakura"] [class*=" c-"] { --tint: rgba(194, 54, 111, .1); --tint-fg: #A82A5D; }
:root[data-theme="sakura"] .subject-count { color: var(--muted); }
:root[data-theme="sakura"] .subject-mark { color: var(--icon-c); opacity: .07; }

:root[data-theme="sakura"][data-mode] :is(.tile-icon, .mini-icon) {
  border-radius: 12px;
  background: color-mix(in srgb, var(--icon-c) 11%, #FFFFFF);
  color: var(--icon-c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--icon-c) 28%, transparent);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1.2), background .25s ease, color .25s ease, box-shadow .3s ease;
}
:root[data-theme="sakura"][data-mode] :is(.tile, .subject, .row-card, .mini-item, .stat):hover :is(.tile-icon, .mini-icon),
:root[data-theme="sakura"][data-mode] .ic-play :is(.tile-icon, .mini-icon) {
  background: var(--icon-c); color: #FFFFFF;
  box-shadow: 0 0 0 3px #FFFFFF, 0 0 0 4px var(--gold), 0 10px 22px -6px color-mix(in srgb, var(--icon-c) 60%, transparent);
  transform: scale(1.06);
}
@media (hover: hover) {
  :root[data-theme="sakura"] :is(.side-link, .bottomnav a, .menu-item):hover .icon { color: var(--primary); }
}

/* ---------- معاينة الثيم في نافذة الاختيار ---------- */
.theme-option[data-value="sakura"] { --sw-main: #C2366F; --sw-soft: #E9CF8F; --sw-bg: #FFF4F7; }

@media (prefers-reduced-motion: reduce) {
  :root[data-theme="sakura"] .hero::after { animation: none; display: none; }
  :root[data-theme="sakura"] .sk-frame-spin { animation: none; }
  :root[data-theme="sakura"] .hero-orb { animation: none; opacity: .85; transform: none; }
  :root[data-theme="sakura"] :is(.tile-icon, .mini-icon) { transition: none !important; }
}

/* ==========================================================================
   شعار العين بثيم Sakura: سداسي أبيض بإطار ذهبي، عين وردية وبؤبؤ ذهبي
   (لمن العين «تزعل» ترجع حمرة مثل كل الثيمات — لذلك :not(.eye-rage))
   ========================================================================== */
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo { filter: drop-shadow(0 2px 6px rgba(194, 54, 111, .25)); }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-hex { stroke: #C9982F; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-hex-fill { fill: #FFF6F9; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-white { fill: #FFE1EC; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-lid { stroke: #C2366F; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-iris-c { fill: #C2366F; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-ring { stroke: #F2D98D; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-pupil { fill: #3B2430; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-glint { fill: #FFFFFF; }
:root[data-theme="sakura"]:not(.eye-rage) .eye-logo .el-scan { fill: #D4A843; }
