/* ═══════════════════════════════════════════════════════════════
   منصة أ. محمد خالد — أحياء وعلوم متكاملة
   نظام التصميم: أحمر دموي + أبيض
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --red: #8E0E20;
  --red-700: #6B0A18;
  --red-900: #4A0510;
  --red-500: #B3122A;
  --red-300: #E4A3AC;
  --red-100: #F7E3E6;
  --red-50:  #FDF6F7;

  --ink: #1B0609;
  --ink-2: #451C23;
  --ink-3: #7C5259;
  --line: rgba(27, 6, 9, 0.10);
  --line-2: rgba(142, 14, 32, 0.22);
  --surface: #FFFFFF;
  --surface-2: #FDF6F7;

  --sh-1: 0 1px 2px rgba(27, 6, 9, .05), 0 2px 6px rgba(27, 6, 9, .04);
  --sh-2: 0 2px 6px rgba(27, 6, 9, .05), 0 10px 26px rgba(92, 8, 20, .08);
  --sh-3: 0 8px 20px rgba(92, 8, 20, .10), 0 28px 60px rgba(92, 8, 20, .14);
  --sh-red: 0 10px 26px rgba(142, 14, 32, .28);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-2xl: 36px;
  --r-full: 999px;

  --ff: 'Cairo', 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);

  /* Legacy aliases so old account/lecture stylesheets stay consistent */
  --bio-red: #8E0E20;
  --bio-red-deep: #6B0A18;
  --bio-ink: #1B0609;
  --bio-muted: #7C5259;
  --bio-line: rgba(27, 6, 9, 0.10);
  --bio-mist: #FDF6F7;
  --vita-blood: #8E0E20;
  --vita-mist: #FDF6F7;
  --brand: #8E0E20;
  --brand-800: #8E0E20;
  --brand-900: #6B0A18;
  --accent: #8E0E20;
  --page-bg: #FFFFFF;
  --page-bg-alt: #FDF6F7;
  --card-bg: #FFFFFF;
  --card: #FFFFFF;
  --card-bg-strong: #FFFFFF;
  --text: #451C23;
  --text-strong: #1B0609;
  --muted: #7C5259;
  --muted-strong: #5C333A;
  --border: rgba(27, 6, 9, 0.10);
  --border-strong: rgba(142, 14, 32, 0.24);
  --shadow: var(--sh-2);
  --shadow-soft: var(--sh-1);
  --shadow-strong: var(--sh-3);
  --primary: #8E0E20;
  --primary-strong: #6B0A18;
  --field-bg: #FFFFFF;
  --field-text: #1B0609;
  --field-border: rgba(27, 6, 9, 0.16);
  --btn-solid-bg: #8E0E20;
  --btn-solid-text: #FFFFFF;
  --btn-gold-bg: #8E0E20;
  --btn-gold-text: #FFFFFF;
  --btn-success-bg: #6B0A18;
  --btn-success-text: #FFFFFF;
  --success: #6B0A18;
  --danger: #8E0E20;
  --warning: #B3122A;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --hdr-bg: #FFFFFF;
  --hdr-text: #1B0609;
  --sw-bg: #8E0E20;
  --sw-knob: #FFFFFF;
  --font-display: var(--ff);
  --font-body: var(--ff);
  --scroll-track: #FDF6F7;
  --scroll-thumb: #C98C96;

  color-scheme: light;
}

html[data-theme="dark"] {
  --red: #E2536A;
  --red-700: #C41E3A;
  --red-900: #8E0E20;
  --red-500: #FF7A8C;
  --red-100: rgba(226, 83, 106, .18);
  --red-50: rgba(226, 83, 106, .10);

  --ink: #FFF6F7;
  --ink-2: #F0D8DC;
  --ink-3: #BC969C;
  --line: rgba(255, 246, 247, 0.14);
  --line-2: rgba(226, 83, 106, 0.34);
  --surface: #1C0A0E;
  --surface-2: #250D12;

  --sh-1: 0 1px 2px rgba(0,0,0,.4);
  --sh-2: 0 10px 26px rgba(0,0,0,.45);
  --sh-3: 0 28px 60px rgba(0,0,0,.55);
  --sh-red: 0 10px 26px rgba(0,0,0,.5);

  --bio-red: #E2536A;
  --bio-red-deep: #C41E3A;
  --bio-ink: #FFF6F7;
  --bio-muted: #BC969C;
  --bio-line: rgba(255, 246, 247, 0.14);
  --bio-mist: #250D12;
  --vita-blood: #E2536A;
  --vita-mist: #250D12;
  --brand: #E2536A;
  --accent: #E2536A;
  --page-bg: #140609;
  --page-bg-alt: #1C0A0E;
  --card-bg: #1C0A0E;
  --card: #1C0A0E;
  --card-bg-strong: #250D12;
  --text: #F0D8DC;
  --text-strong: #FFF6F7;
  --muted: #BC969C;
  --muted-strong: #D8B4BA;
  --border: rgba(255, 246, 247, 0.14);
  --border-strong: rgba(226, 83, 106, 0.4);
  --primary: #E2536A;
  --field-bg: #140609;
  --field-text: #FFF6F7;
  --field-border: rgba(255, 246, 247, 0.2);
  --hdr-bg: #1C0A0E;
  --hdr-text: #FFF6F7;
  --scroll-track: #1C0A0E;
  --scroll-thumb: #6B0A18;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--ff);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.8;
  color: var(--text);
  background: var(--page-bg);
  overflow-x: hidden;
}

h1, h2, h3, h4, h5 {
  margin: 0;
  font-family: var(--ff);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: var(--text-strong);
}
p { margin: 0; }
img, svg { max-width: 100%; display: block; }
a { color: var(--red); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { margin: 0; padding: 0; }

::selection { background: var(--red); color: #fff; }

.container, .mp-container {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 22px;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ── Form controls ─────────────────────────────────────────── */
.ui-input, .ui-select, .input, .input2, .acc-input, textarea.acc-input, select.acc-input {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  border: 1.5px solid var(--field-border);
  border-radius: var(--r-md);
  background: var(--field-bg);
  color: var(--field-text);
  font-size: 15px;
  font-weight: 600;
  transition: border-color .18s, box-shadow .18s;
}
.ui-input::placeholder, .input::placeholder, .acc-input::placeholder { color: var(--muted); font-weight: 500; }
.ui-input:focus, .ui-select:focus, .input:focus, .input2:focus, .acc-input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px var(--red-50);
}

/* ── Theme switch ──────────────────────────────────────────── */
.theme-switch--pro, .acc-theme.theme-switch--pro {
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: var(--r-full);
}
.theme-switch--pro .theme-switch__knob,
.acc-theme.theme-switch--pro .theme-switch__knob,
.acc-theme.theme-switch--pro .acc-theme__knob {
  background: var(--red) !important;
  border-color: var(--red) !important;
  color: #fff;
}

/* ── Toast ─────────────────────────────────────────────────── */
.phy-toast {
  --toast-accent: var(--red);
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  bottom: max(20px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 14000 !important;
  width: min(440px, calc(100vw - 28px));
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--toast-accent);
  box-shadow: var(--sh-3);
  transform: translateX(-50%);
  overflow: hidden;
}
.phy-toast__icon {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--red); color: #fff; font-weight: 900;
}
.phy-toast__body { min-width: 0; flex: 1; }
.phy-toast__title { display: block; font-weight: 800; color: var(--text-strong); }
.phy-toast__msg, .phy-toast__list { margin: 4px 0 0; font-size: 14px; color: var(--muted-strong); }
.phy-toast__list { padding-inline-start: 18px; }
.phy-toast__close {
  width: 30px; height: 30px; flex: none;
  border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
}
.phy-toast__progress { position: absolute; inset-inline: 0; bottom: 0; height: 3px; }
.phy-toast__progress span {
  display: block; height: 100%; width: 100%;
  background: var(--red);
  transform-origin: right;
  animation: toastBar 6s linear forwards;
}
@keyframes toastBar { to { transform: scaleX(0); } }

/* ── Animated biology atmosphere ───────────────────────────── */
.bio-life {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  color: var(--red);
}
.bio-life__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: .22;
  background: radial-gradient(circle, var(--red-100), transparent 70%);
}
.bio-life__glow--a {
  width: min(52vw, 560px); height: min(52vw, 560px);
  top: -12%; inset-inline-end: -10%;
  animation: bioGlow 18s ease-in-out infinite;
}
.bio-life__glow--b {
  width: min(46vw, 480px); height: min(46vw, 480px);
  bottom: -16%; inset-inline-start: -12%;
  animation: bioGlow 22s ease-in-out infinite reverse;
}
.bio-life__mark {
  position: absolute;
  opacity: .11;
  color: var(--red);
  will-change: transform;
}
html[data-theme="dark"] .bio-life__mark { opacity: .18; }
html[data-theme="dark"] .bio-life__glow { opacity: .28; }

.bio-life__dna {
  width: clamp(52px, 8vw, 92px); height: auto;
  top: 8%; inset-inline-start: 2%;
  animation: bioSpin 42s linear infinite;
  transform-origin: 50% 50%;
}
.bio-life__cell {
  width: clamp(140px, 18vw, 220px); height: auto;
  top: 6%; inset-inline-end: -2%;
  animation: bioFloat 16s ease-in-out infinite;
}
.bio-life__mito {
  width: clamp(90px, 12vw, 140px); height: auto;
  bottom: 14%; inset-inline-start: 6%;
  animation: bioDrift 20s ease-in-out infinite;
}
.bio-life__mol {
  width: clamp(88px, 11vw, 130px); height: auto;
  bottom: 8%; inset-inline-end: 4%;
  animation: bioSpin 36s linear infinite reverse;
}
.bio-life__leaf {
  width: clamp(70px, 9vw, 110px); height: auto;
  top: 42%; inset-inline-start: -1%;
  animation: bioSway 14s ease-in-out infinite;
}
.bio-life__scope {
  width: clamp(64px, 8vw, 96px); height: auto;
  top: 58%; inset-inline-end: 3%;
  animation: bioFloat 18s ease-in-out infinite reverse;
}
.bio-life__heart {
  width: clamp(70px, 9vw, 100px); height: auto;
  bottom: 38%; inset-inline-start: 12%;
  animation: bioPulse 7s ease-in-out infinite;
}

@keyframes bioFloat {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-4deg); }
  50% { transform: translate3d(12px, -22px, 0) rotate(5deg); }
}
@keyframes bioDrift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(8deg); }
  50% { transform: translate3d(-18px, -16px, 0) rotate(-6deg); }
}
@keyframes bioSway {
  0%, 100% { transform: rotate(-12deg) translateY(0); }
  50% { transform: rotate(10deg) translateY(-14px); }
}
@keyframes bioSpin { to { transform: rotate(360deg); } }
@keyframes bioPulse {
  0%, 100% { transform: scale(1); opacity: .1; }
  50% { transform: scale(1.08); opacity: .16; }
}
@keyframes bioGlow {
  0%, 100% { transform: scale(1); opacity: .18; }
  50% { transform: scale(1.12); opacity: .3; }
}

.bio-hdr, .bio-appbar, .bio-tabs, .bio-drawer,
.bio-main, .bio-sheet, .bio-auth, .bio-ftr, .bio-ctaWrap,
.acc-coursePage, .acc-lecturePage, .ass-wrap {
  position: relative;
  z-index: 1;
}

/* الموبايل وتطبيق الأندرويد: نفس الرموز المتحركة كما على الكمبيوتر */
body.student-perf-lite .bio-life,
body.android-native-app .bio-life,
body.student-lite .bio-life {
  display: block !important;
  visibility: visible !important;
}
body.student-perf-lite .bio-life__glow,
body.android-native-app .bio-life__glow,
body.student-lite .bio-life__glow {
  display: block !important;
  visibility: visible !important;
}
body.student-perf-lite .bio-life__mark,
body.android-native-app .bio-life__mark,
body.student-lite .bio-life__mark {
  display: block !important;
  visibility: visible !important;
  animation-play-state: running !important;
}

@media (max-width: 720px) {
  .bio-life__mark { opacity: .13; }
  .bio-life__dna { width: 58px; top: 10%; inset-inline-start: 0; }
  .bio-life__cell { width: 150px; top: 4%; inset-inline-end: -8%; }
  .bio-life__mito { width: 92px; bottom: 18%; inset-inline-start: 0; }
  .bio-life__mol { width: 86px; bottom: 6%; inset-inline-end: 0; }
  .bio-life__leaf { width: 68px; top: 38%; inset-inline-start: -4%; }
  .bio-life__scope { width: 62px; top: 56%; inset-inline-end: 0; }
  .bio-life__heart { width: 68px; bottom: 34%; inset-inline-start: 10%; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) var(--scroll-track); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--scroll-track); }
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: padding-box;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
