/* ===== المصري أكاديمي — الثيم العصري المشترك ===== */
:root {
  --navy: #312e81; --navy2: #4338ca; --brand: #6366f1; --violet: #8b5cf6; --cyan: #06b6d4;
  --gold: #fbbf24; --gold2: #f59e0b; --bg: #f3f4ff; --ink: #1e1b4b; --mut: #6b7194;
  --ok: #10b981; --bad: #ef4444; --warn: #f59e0b; --line: #e6e8ff;
  --r: 18px; --shadow: 0 12px 32px -14px rgba(49, 46, 129, .35); --shadow-s: 0 4px 14px -6px rgba(49, 46, 129, .25);
  --grad: linear-gradient(135deg, #4338ca 0%, #7c3aed 58%, #06b6d4 135%);
  --grad-gold: linear-gradient(135deg, #fde68a 0%, #fbbf24 45%, #f59e0b 100%);
}
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body {
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 100% -5%, #e0e7ff 0, transparent 60%),
    radial-gradient(800px 460px at -10% 8%, #fae8ff 0, transparent 55%),
    radial-gradient(700px 400px at 50% 110%, #cffafe 0, transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
::selection { background: #c7d2fe; color: #1e1b4b; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #a5b4fc; }

/* ----- الشريط العلوي ----- */
header {
  background: linear-gradient(115deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%) !important;
  box-shadow: 0 6px 24px -10px rgba(30, 27, 75, .7) !important;
  transition: box-shadow .3s, padding .3s;
}
header.scrolled { box-shadow: 0 10px 30px -8px rgba(30, 27, 75, .85) !important; }
header nav a { transition: background .2s, transform .2s, color .2s; color: #e0e7ff !important; }
header nav a:hover { background: #ffffff26 !important; transform: translateY(-1px); color: #fff !important; }
#logo, header img { box-shadow: 0 0 0 2px #ffffff40; transition: transform .3s; }
#logo:hover, header img:hover { transform: rotate(-3deg) scale(1.04); }
#fxbar { position: fixed; top: 0; inset-inline: 0; height: 3px; width: 0; background: var(--grad-gold); z-index: 90; transition: width .1s; box-shadow: 0 0 10px #fbbf24aa; }

/* ----- الواجهة الرئيسية (Hero) ----- */
.hero {
  background:
    radial-gradient(circle at 82% 18%, #7c3aed99 0, transparent 45%),
    radial-gradient(circle at 12% 85%, #06b6d466 0, transparent 40%),
    linear-gradient(140deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%) !important;
  padding-bottom: 60px !important;
}
.hero::after {
  content: ""; position: absolute; z-index: 0; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, #fbbf2440, transparent 68%); bottom: -170px; right: -90px;
  animation: float 9s ease-in-out infinite;
}
.hero > * { z-index: 1; }
.hero h1 { letter-spacing: .5px; font-weight: 800; text-shadow: 0 4px 24px #0006; }
.hero h1 span { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: #e0e7ff !important; font-size: 17px; }
.photo {
  border: 0 !important; background: var(--grad-gold) !important; padding: 4px !important; border-radius: 22px !important;
  box-shadow: 0 0 0 7px #ffffff1c, 0 24px 50px -12px #000a; animation: pop .9s cubic-bezier(.2, .9, .3, 1.2) both, bob 6s ease-in-out 1s infinite;
}
.photo img { border-radius: 18px !important; }
.badge { background: var(--grad-gold) !important; box-shadow: 0 6px 18px -4px #f59e0b99; animation: pop .7s both; }

/* ----- الأزرار ----- */
.btn, .go, button.go { font-weight: 700; letter-spacing: .2px; transition: transform .18s, box-shadow .25s, filter .2s; position: relative; }
.btn:hover, .go:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active, .go:active { transform: translateY(0) scale(.98); }
.hero .btn:not(.o):not(.n):not(.l), .btn.gold, .go.gold { background: var(--grad-gold) !important; color: #3b2a00 !important; box-shadow: 0 8px 22px -8px #f59e0b; }
.btn.n, .go, button.go { background: var(--grad) !important; color: #fff !important; box-shadow: 0 8px 22px -10px #4338ca; }
.btn.gold, .go.gold { color: #3b2a00 !important; }
.btn.o { background: #ffffff1a !important; border: 1px solid #ffffff55 !important; color: #fff !important; backdrop-filter: blur(6px); }
.btn.o:hover { background: #ffffff33 !important; }
.btn.l { background: #fff !important; color: var(--navy) !important; }
.btn.red { background: linear-gradient(135deg, #ef4444, #f97316) !important; }
.btn.green { background: linear-gradient(135deg, #059669, #10b981) !important; }
.btn.ghost { background: #eef0ff !important; color: var(--navy2) !important; box-shadow: none !important; }
.btn.ghost:hover { background: #e0e4ff !important; }
.go.gray { background: #8a93ad !important; box-shadow: none; }
.btn { background-image: var(--grad); }
.rip { position: relative; overflow: hidden; }
.rip-w { position: absolute; border-radius: 50%; background: #ffffff66; transform: scale(0); animation: rip .6s ease-out; pointer-events: none; }

/* ----- البطاقات ----- */
.card, .stat {
  border: 1px solid var(--line); border-radius: var(--r) !important; box-shadow: var(--shadow-s) !important;
  background: rgba(255, 255, 255, .92);
  transition: transform .28s cubic-bezier(.2, .8, .3, 1), box-shadow .28s, border-color .28s;
}
.stat:hover, .hn:hover, .grid .card:hover { transform: translateY(-4px); box-shadow: var(--shadow) !important; border-color: #c7d2fe; }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad); }
.stat b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent !important; font-weight: 800; }
section .card:hover { box-shadow: var(--shadow) !important; }
h2.t { font-weight: 800; letter-spacing: .3px; }
h2.t::after { background: var(--grad) !important; width: 70px !important; height: 5px !important; }
h2, h3 { font-weight: 800; }
.info div { background: linear-gradient(135deg, #eef0ff, #f5f3ff) !important; border: 1px solid var(--line); transition: transform .2s; }
.info div:hover { transform: translateY(-2px); }
.car > * { border-radius: 18px !important; transition: transform .3s, box-shadow .3s; box-shadow: var(--shadow-s) !important; }
.car > *:hover { transform: scale(1.03); box-shadow: var(--shadow) !important; }
.car img { transition: transform .6s; } .car > *:hover img { transform: scale(1.08); }
.hn { border-top: 0 !important; position: relative; overflow: hidden; }
.hn::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--grad-gold); }
.av { background: var(--grad) !important; border: 3px solid var(--gold) !important; box-shadow: 0 6px 18px -6px #4338ca; }
.contact a { border: 1px solid var(--line); transition: transform .2s, box-shadow .2s, background .2s; }
.contact a:hover { transform: translateY(-3px); box-shadow: var(--shadow) !important; background: #f5f3ff; }

/* ----- النماذج ----- */
input, select, textarea { border: 1.5px solid #d9dcff !important; border-radius: 12px !important; transition: border-color .2s, box-shadow .2s, background .2s; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand) !important; box-shadow: 0 0 0 4px #6366f130; }
.hint { border-radius: 12px !important; }
.ok { border-radius: 14px !important; }

/* ----- لوحة الإدارة ----- */
#nav { background: rgba(255, 255, 255, .85) !important; backdrop-filter: blur(10px); border-bottom: 1px solid var(--line) !important; }
#nav button { background: #eef0ff !important; color: var(--navy2) !important; font-weight: 600; transition: transform .2s, background .2s, box-shadow .2s; }
#nav button:hover { transform: translateY(-1px); background: #e0e4ff !important; }
#nav button.on { background: var(--grad) !important; color: #fff !important; box-shadow: 0 8px 18px -8px #4338ca; }
th { background: linear-gradient(180deg, #f1f2ff, #eaecff) !important; color: var(--navy2) !important; font-weight: 700; }
tbody tr { transition: background .15s; } tbody tr:hover, tr:hover > td { background: #f7f7ff; }
.tag { font-weight: 600; } .tag.ok, .ok.tag { background: #d1fae5 !important; color: #047857 !important; }
.tag.bad { background: #fee2e2 !important; color: #b91c1c !important; } .tag.warn { background: #fef3c7 !important; color: #b45309 !important; }
.bar { background: #e6e8ff !important; } .bar i { background: var(--grad) !important; transition: width .8s ease; }
.pg.on { background: var(--grad) !important; border-color: transparent !important; }
.banner { background: linear-gradient(135deg, #ecfdf5, #f0fdfa) !important; border-color: #a7f3d0 !important; border-radius: 14px !important; }
.pre-warn { background: linear-gradient(135deg, #fffbeb, #fef3c7); border: 1px solid #fcd34d; border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; color: #92400e; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; animation: slide .4s both; }
.pre-warn b { color: #78350f; } .pre-warn .btn { margin: 0; }
#toast { background: #1e1b4b !important; border-radius: 14px !important; box-shadow: 0 14px 36px -10px #1e1b4b; }

/* ----- بوابة الطالب وولي الأمر ----- */
.tabs button { background: #eef0ff !important; color: var(--navy2) !important; font-weight: 600; transition: transform .2s; }
.tabs button.on { background: var(--grad) !important; color: #fff !important; }
.opt { border-radius: 14px !important; transition: transform .18s, border-color .2s, background .2s; }
.opt:hover { transform: translateX(-3px); border-color: #a5b4fc !important; }
.opt.sel { border-color: var(--brand) !important; background: #eef0ff !important; }
.row i { background: var(--grad-gold) !important; }
.big { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent !important; }
.timer { border-radius: 14px !important; border: 1px solid var(--line); }

/* ----- النوافذ المنبثقة ----- */
.ov { backdrop-filter: blur(6px); background: #1e1b4b99 !important; }
.ov.open .box, .box { border-radius: 22px !important; box-shadow: 0 30px 70px -20px #000a; animation: pop .35s cubic-bezier(.2, .9, .3, 1.2) both; }
.lb { background: #0b0a1f !important; }

/* ----- التذييل وزر المطور ----- */
footer { color: var(--mut); }
.dev-bar { text-align: center; padding: 18px 12px 34px; }
.dev-btn {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid #c7d2fe; background: rgba(255, 255, 255, .85); color: var(--navy2);
  padding: 9px 20px; border-radius: 40px; font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer; backdrop-filter: blur(6px);
  box-shadow: var(--shadow-s); transition: transform .2s, box-shadow .25s, background .2s, color .2s;
}
.dev-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); background: var(--grad); color: #fff; border-color: transparent; }
.dev-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 0 #10b98199; animation: pulse 2s infinite; }
#devOv { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 12, 50, .72); backdrop-filter: blur(8px); }
#devOv.open { display: flex; animation: fade .25s both; }
.dev-card { width: 100%; max-width: 390px; background: #fff; border-radius: 28px; overflow: hidden; box-shadow: 0 40px 90px -20px #000c; animation: pop .45s cubic-bezier(.2, .9, .3, 1.2) both; position: relative; direction: rtl; }
.dev-top { background: linear-gradient(140deg, #1e1b4b, #4338ca 55%, #7c3aed); padding: 34px 20px 54px; text-align: center; position: relative; overflow: hidden; color: #fff; }
.dev-top::before { content: ""; position: absolute; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, #06b6d466, transparent 65%); top: -90px; left: -60px; animation: float 8s ease-in-out infinite; }
.dev-top::after { content: ""; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, #fbbf2455, transparent 65%); bottom: -100px; right: -50px; animation: float 10s ease-in-out infinite reverse; }
.dev-x { position: absolute; top: 12px; left: 12px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #ffffff26; color: #fff; font-size: 18px; cursor: pointer; transition: background .2s, transform .2s; }
.dev-x:hover { background: #ffffff55; transform: rotate(90deg); }
.dev-ava { position: relative; z-index: 2; width: 92px; height: 92px; margin: 0 auto 12px; border-radius: 50%; background: var(--grad-gold); padding: 4px; box-shadow: 0 0 0 6px #ffffff22, 0 14px 30px -8px #000a; animation: bob 5s ease-in-out infinite; }
.dev-ava span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%; background: #1e1b4b; color: #fde68a; font-weight: 800; font-size: 25px; letter-spacing: 1px; font-family: 'Cairo', sans-serif; direction: ltr; }
.dev-name { position: relative; z-index: 2; margin: 0; font-size: 26px; font-weight: 800; direction: ltr; }
.dev-sub { position: relative; z-index: 2; margin: 2px 0 8px; color: #c7d2fe; font-size: 14px; direction: ltr; }
.dev-role { position: relative; z-index: 2; display: inline-block; background: #ffffff22; border: 1px solid #ffffff44; padding: 4px 14px; border-radius: 20px; font-size: 13px; }
.dev-body { margin-top: -30px; position: relative; z-index: 3; padding: 0 16px 20px; display: grid; gap: 10px; }
.dev-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid #e6e8ff; border-radius: 18px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-s); transition: transform .2s, box-shadow .2s, border-color .2s; animation: slide .5s both; }
.dev-item:nth-child(2) { animation-delay: .08s; } .dev-item:nth-child(3) { animation-delay: .16s; }
.dev-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #a5b4fc; }
.dev-ic { flex: 0 0 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 21px; background: linear-gradient(135deg, #eef0ff, #f5f3ff); }
.dev-item.wa .dev-ic { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.dev-tx { flex: 1; min-width: 0; } .dev-tx small { display: block; color: var(--mut); font-size: 12px; }
.dev-tx b { display: block; direction: ltr; text-align: right; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.dev-go { color: #a5b4fc; font-size: 20px; }
.dev-foot { text-align: center; color: var(--mut); font-size: 12px; padding: 0 16px 18px; }

/* ----- حركات ----- */
.fx { opacity: 0; transform: translateY(16px); }
.fx.in { opacity: 1; transform: none; transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .3, 1); transition-delay: var(--d, 0s); }
@keyframes pop { from { opacity: 0; transform: scale(.88) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(24px, -26px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes rip { to { transform: scale(4); opacity: 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #10b98199; } 70% { box-shadow: 0 0 0 9px #10b98100; } 100% { box-shadow: 0 0 0 0 #10b98100; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .fx { opacity: 1; transform: none; }
}
@media print { #fxbar, .dev-bar, #devOv, .wa { display: none !important; } }

section { scroll-margin-top: 76px; }
.codeform .btn { white-space: nowrap; }

/* ----- الدفع وإثبات التحويل ----- */
.pay-box { background: linear-gradient(135deg, #f5f3ff, #ecfeff); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-top: 14px; text-align: right; }
.pay-box h3 { margin: 0 0 10px; color: var(--navy); }
.pay-nums { display: grid; gap: 8px; margin-bottom: 8px; }
.pay-num { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.pay-ic { font-size: 24px; } .pay-tx { flex: 1; min-width: 0; } .pay-tx small { display: block; color: var(--mut); }
.pay-tx b { display: block; direction: ltr; text-align: right; font-size: 17px; letter-spacing: .5px; overflow: hidden; text-overflow: ellipsis; }
.pay-copy { border: 0; border-radius: 20px; padding: 7px 14px; font-family: inherit; font-weight: 700; cursor: pointer; background: var(--grad); color: #fff; }
.pay-note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px; padding: 8px 12px; font-size: 14px; white-space: pre-line; }
.pay-l { display: block; margin: 8px 0 3px; font-size: 13px; color: var(--mut); }
.pay-box input, .pay-box select { width: 100%; padding: 10px; margin-bottom: 6px; font-family: inherit; font-size: 15px; box-sizing: border-box; }
.pay-ok { color: #047857; font-weight: 700; margin: 6px 0; }
.pay-box .btn { width: 100%; margin: 8px 0 0; }

/* ----- شارة العدد على تبويب إثباتات الدفع ----- */
.nbadge { display: inline-block; min-width: 20px; padding: 0 6px; margin-inline-start: 6px; border-radius: 12px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 800; line-height: 20px; text-align: center; animation: pulse 2s infinite; box-shadow: 0 0 0 0 #ef444499; }

/* ----- المفكرة ----- */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.note-card { border-radius: 18px; padding: 14px; box-shadow: var(--shadow-s); border: 1px solid #0000000d; display: flex; flex-direction: column; gap: 8px; transition: transform .2s, box-shadow .2s; }
.note-card:hover { transform: translateY(-3px) rotate(-.3deg); box-shadow: var(--shadow); }
.note-card.done { opacity: .6; } .note-card.done .note-h b { text-decoration: line-through; }
.note-h { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; align-items: flex-start; } .note-h b { color: var(--ink); font-size: 16px; }
.note-b { white-space: pre-wrap; color: #374151; font-size: 14px; line-height: 1.7; word-break: break-word; }
.note-f { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; }

/* ----- أسئلة مولَّدة بالذكاء الاصطناعي ----- */
.qd { background: #f8f9ff; border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.qd textarea, .qd input:not([type=radio]):not([type=checkbox]) { width: 100%; box-sizing: border-box; margin-bottom: 4px; }
.qch { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; } .qch input[type=text], .qch input:not([type]) { flex: 1; min-width: 0; width: auto !important; } .qch input[type=radio] { flex: 0 0 auto; }
.qd { overflow: hidden; }

/* ----- الشريط العلوي لا يتجاوز عرض الشاشة ----- */
html, body { max-width: 100%; overflow-x: hidden; }
@media (max-width: 640px) {
  header { flex-wrap: wrap; row-gap: 6px; }
  header button { padding: 6px 10px !important; font-size: 13px !important; }
  header .sp { flex-basis: 100%; height: 0; order: 5; display: none; }
}

/* ----- زر وتعليمات الاستخدام لصفحتي الطالب وولي الأمر ----- */
header:has(> .guide-btn) { position: relative; }
.guide-btn { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); border: 1px solid #ffffff55; background: #ffffff1f; color: #fff; border-radius: 22px; padding: 7px 14px; font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; backdrop-filter: blur(6px); transition: background .2s; }
.guide-btn:hover { background: #ffffff40; }
.gd-ov { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 14px; background: rgba(15, 12, 50, .72); backdrop-filter: blur(6px); }
.gd-ov.open { display: flex; animation: fade .25s both; }
.gd-box { position: relative; width: 100%; max-width: 480px; max-height: 88vh; overflow: auto; background: #fff; border-radius: 22px; padding: 20px; box-shadow: 0 30px 70px -20px #000b; animation: pop .35s cubic-bezier(.2, .9, .3, 1.2) both; color: var(--ink); }
.gd-box h2 { margin: 0 0 10px; color: var(--navy); padding-inline-end: 34px; }
.gd-x { position: absolute; top: 12px; left: 12px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: #eef0ff; color: var(--navy2); font-size: 16px; cursor: pointer; }
.gd-item { margin-bottom: 14px; } .gd-item h3 { margin: 0 0 4px; color: var(--navy2); font-size: 16px; } .gd-item p { margin: 0; white-space: pre-line; line-height: 1.9; font-size: 15px; }
