/* ============================================
   ذو الفقار — motion layer (preview)
   Playful, light, physics-themed animations.
   Brand: navy #3D5A80, gold #F2C230, cream #FFFDF7
   All CSS-only except a tiny count-up in motion.js.
   Honors prefers-reduced-motion.
   ============================================ */

:root {
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-out: cubic-bezier(.22, .8, .3, 1);
}

/* ---------- floating physics background ---------- */
.bg-fx {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.bg-fx svg { position: absolute; opacity: .07; color: var(--navy); }
.bg-fx svg.gold { color: var(--gold); opacity: .12; }

.fx-atom   { top: 12%; inset-inline-start: 6%;  width: 90px;  animation: fxSpin 26s linear infinite; }
.fx-pend   { top: -2%; inset-inline-end: 10%;  width: 70px;  animation: fxSwing 4.2s ease-in-out infinite; transform-origin: 50% 0; }
.fx-wave   { bottom: 14%; inset-inline-start: -4%; width: 130px; animation: fxDrift 11s ease-in-out infinite alternate; }
.fx-bolt   { top: 42%; inset-inline-end: 4%;   width: 54px;  animation: fxFloat 7s ease-in-out infinite; }
.fx-magnet { bottom: 6%; inset-inline-end: 22%; width: 72px;  animation: fxFloat 9s ease-in-out 1.2s infinite; }

@keyframes fxSpin   { to { transform: rotate(360deg); } }
@keyframes fxSwing  { 0%,100% { transform: rotate(9deg); } 50% { transform: rotate(-9deg); } }
@keyframes fxDrift  { from { transform: translateX(0) translateY(0); } to { transform: translateX(46px) translateY(-14px); } }
@keyframes fxFloat  { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-16px) rotate(5deg); } }

/* keep app content above the background layer */
#app { position: relative; z-index: 1; }

/* ---------- login screen ---------- */
.login-wrap .card { animation: riseIn .6s var(--ease-out) .15s both; }
.login-wrap .brand-big .sword {
  display: inline-block;
  transform-origin: 50% -18px;              /* swings like a pendulum */
  animation: swordSwing 3.6s ease-in-out .4s infinite, fadeDown .6s var(--ease-out) both;
  text-shadow: 0 0 0 rgba(242, 194, 48, 0);
}
.login-wrap .brand-big h1 { animation: fadeDown .55s var(--ease-out) .25s both; }
.login-wrap .brand-big p  { animation: fadeDown .55s var(--ease-out) .4s both; }
.login-wrap > p.muted     { animation: fadeDown .55s var(--ease-out) .55s both; }

@keyframes swordSwing {
  0%, 100% { transform: rotate(10deg); text-shadow: 0 0 14px rgba(242,194,48,.25); }
  50%      { transform: rotate(-10deg); text-shadow: 0 0 22px rgba(242,194,48,.45); }
}
@keyframes riseIn  { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* ---------- header brand ---------- */
header.top .brand b { position: relative; display: inline-block; }
header.top .brand b::after {
  content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 3px;
  background: var(--gold); border-radius: 3px;
  transform: scaleX(0); transform-origin: inline-end;
  animation: sweepIn .8s var(--ease-out) .3s forwards;
}
@keyframes sweepIn { to { transform: scaleX(1); } }

/* ---------- tabs ---------- */
nav.tabs button { transition: transform .18s var(--spring), background .2s, color .2s; }
nav.tabs button:hover:not(.on) { transform: translateY(-2px); color: #fff; }
nav.tabs button.on { animation: tabPop .35s var(--spring); box-shadow: 0 2px 8px rgba(242,194,48,.35); }
@keyframes tabPop { 0% { transform: scale(.82); } 100% { transform: scale(1); } }

/* ---------- cards: staggered entrance ---------- */
main > .card { animation: cardIn .5s var(--ease-out) both; }
main > .card:nth-child(1) { animation-delay: .05s; }
main > .card:nth-child(2) { animation-delay: .15s; }
main > .card:nth-child(3) { animation-delay: .25s; }
main > .card:nth-child(4) { animation-delay: .35s; }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ---------- evaluation chips ---------- */
.eval-items label {
  transition: transform .18s var(--spring), background .18s, border-color .18s, box-shadow .18s;
  user-select: none;
}
.eval-items label:hover { transform: translateY(-2px); }
.eval-items label.sel {
  animation: chipPop .3s var(--spring);
  box-shadow: 0 2px 7px rgba(242,194,48,.4);
}
@keyframes chipPop { 0% { transform: scale(.8); } 60% { transform: scale(1.14); } 100% { transform: scale(1); } }

/* ---------- buttons ---------- */
button.primary, button.ghost, button.good, button.danger, header.top button.logout {
  transition: transform .15s var(--spring), box-shadow .2s, background .2s;
}
button.primary:hover  { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(61,90,128,.35); }
button.ghost:hover    { transform: translateY(-2px); box-shadow: 0 3px 9px rgba(61,90,128,.18); }
button.good:hover, button.danger:hover { transform: translateY(-2px); }
button.primary:active, button.ghost:active, button.good:active, button.danger:active { transform: scale(.94); }

/* ---------- inputs ---------- */
input[type=text], input[type=password], input[type=date], input[type=url], select, textarea {
  transition: border-color .2s, box-shadow .25s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(242,194,48,.28);
}

/* ---------- flash / error messages ---------- */
.flash { animation: flashIn .45s var(--spring); }
.flash::before { content: "✓ "; font-weight: 700; }
.err   { animation: shakeIn .4s var(--ease-out); }
@keyframes flashIn { 0% { opacity: 0; transform: translateY(-10px) scale(.96); } 100% { opacity: 1; transform: none; } }
@keyframes shakeIn { 0%,100% { transform: translateX(0); } 25% { transform: translateX(5px); } 55% { transform: translateX(-5px); } 80% { transform: translateX(2px); } }

/* ---------- list items ---------- */
.list-item { animation: itemIn .4s var(--ease-out) both; transition: background .2s, padding .2s; border-radius: 8px; }
.list-item:hover { background: #fbf7ea; }
#list .list-item:nth-child(1), #rsess .list-item:nth-child(1), #suglist .list-item:nth-child(1), #mine .list-item:nth-child(1) { animation-delay: .05s; }
#list .list-item:nth-child(2), #rsess .list-item:nth-child(2), #suglist .list-item:nth-child(2), #mine .list-item:nth-child(2) { animation-delay: .12s; }
#list .list-item:nth-child(3), #rsess .list-item:nth-child(3), #suglist .list-item:nth-child(3), #mine .list-item:nth-child(3) { animation-delay: .19s; }
#list .list-item:nth-child(4), #rsess .list-item:nth-child(4), #suglist .list-item:nth-child(4), #mine .list-item:nth-child(4) { animation-delay: .26s; }
#list .list-item:nth-child(n+5), #rsess .list-item:nth-child(n+5), #suglist .list-item:nth-child(n+5), #mine .list-item:nth-child(n+5) { animation-delay: .33s; }
@keyframes itemIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- stats (reports) ---------- */
.stat { animation: statPop .45s var(--spring) both; transition: transform .18s var(--spring); }
.stat:hover { transform: translateY(-3px) scale(1.05); }
.stat:nth-of-type(1) { animation-delay: .05s; } .stat:nth-of-type(2) { animation-delay: .12s; }
.stat:nth-of-type(3) { animation-delay: .19s; } .stat:nth-of-type(4) { animation-delay: .26s; }
.stat:nth-of-type(5) { animation-delay: .33s; } .stat:nth-of-type(6) { animation-delay: .4s; }
@keyframes statPop { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: scale(1); } }

/* ---------- unread pill pulse ---------- */
.pill.unread { animation: pillPulse 1.6s ease-in-out infinite; }
@keyframes pillPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(242,194,48,.55); } 50% { box-shadow: 0 0 0 6px rgba(242,194,48,0); } }

/* ---------- loading state ---------- */
.boot, p.muted:only-child { }
.boot::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
  .bg-fx { display: none; }
}

/* ============================================
   Card system — folded in from Saif's reference
   file (physics lesson page): wide/elevated cards,
   colored top border, heading accent bar, hover lift.
   Re-colored to navy/gold/cream.
   ============================================ */

body { font-family: "Cairo", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif; }

/* header + tabs get the rounded, shadowed treatment */
header.top { box-shadow: 0 4px 14px rgba(40,56,74,.25); border-radius: 0 0 18px 18px; }
nav.tabs { border-radius: 0 0 14px 14px; border-bottom: 3px solid var(--gold); box-shadow: 0 3px 10px rgba(40,56,74,.12); }

/* main cards: elevated, thick top accent, hover lift */
.card {
  border-radius: 16px;
  border: 1px solid #ECE8DC;
  border-top: 4px solid var(--navy);
  box-shadow: 0 8px 24px rgba(40,56,74,.10);
  transition: transform .3s ease, box-shadow .3s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(40,56,74,.14); }
main > .card:first-of-type, .login-wrap .card { border-top-color: var(--gold); }

/* heading accent bar (his border-right heading) */
.card h2 {
  border-inline-start: 4px solid var(--gold);
  padding-inline-start: .6rem;
  line-height: 1.5;
}

/* wide card rows instead of flat list lines */
.list-item {
  background: #fff;
  border: 1px solid #ECE8DC;
  border-inline-start: 4px solid var(--navy);
  border-radius: 12px;
  padding: .7rem .9rem;
  margin-bottom: .6rem;
  box-shadow: 0 2px 8px rgba(40,56,74,.06);
  transition: transform .2s ease, box-shadow .25s ease, background .2s;
}
.list-item:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(40,56,74,.12); background: #fff; }

/* student eval blocks as gold-topped mini cards */
.student-eval {
  background: #fff;
  border: 1px solid #ECE8DC;
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(40,56,74,.06);
  transition: transform .2s ease, box-shadow .25s ease;
}
.student-eval:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(40,56,74,.12); }

/* report stats as soft tiles (his stage-item tiles) */
.stat {
  background: #f2f5fa;
  border: 1px solid #dde5f0;
  border-radius: 10px;
}

/* primary buttons: subtle navy gradient + scale hover (his btn-primary) */
button.primary {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
}
button.primary:hover { transform: translateY(-2px) scale(1.02); }

/* keep the entrance animations winning over hover transform on load */
main > .card { animation: cardIn .5s var(--ease-out) both; }

/* ============================================
   عين العقل logo - an eye inside a clean brain
   outline. Iris follows the mouse on desktop,
   drifts idly on touch, blinks for everyone.
   Inline SVG, tiny. Reduced-motion: static.
   ============================================ */

.logo-mark { display: inline-block; vertical-align: middle; line-height: 0; }
.logo-mark svg { display: block; overflow: visible; }

header.top .logo-mark { margin-inline-end: .2rem; }

/* login: gentle float (breathe), not the old pendulum */
.brand-big .logo-mark {
  animation: logoFloat 3.4s ease-in-out infinite, fadeDown .6s var(--ease-out) both;
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.logo-blink { transform-box: fill-box; transform-origin: 50% 50%; animation: eyeBlink 4.6s ease-in-out infinite; }
@keyframes eyeBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  93.5% { transform: scaleY(.08); }
  97% { transform: scaleY(1); }
}

.logo-iris { transform-box: fill-box; transform-origin: 50% 50%; transition: transform .12s ease-out; }

/* touch devices: the eye looks around by itself */
@media (hover: none) {
  .logo-iris { animation: eyeLook 9s ease-in-out infinite; transition: none; }
}
@keyframes eyeLook {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(3.5px, 1px); }
  45% { transform: translate(-3.5px, -1px); }
  70% { transform: translate(2.5px, 1.6px); }
}

@media (prefers-reduced-motion: reduce) {
  .brand-big .logo-mark, .logo-blink, .logo-iris { animation: none !important; transition: none !important; }
}
