/* ============================================
   مدرسي الرقمية — ستايل مشترك
   ============================================ */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e8ee;
  --accent: #2563eb;
  --accent-dk: #1d4ed8;
  --accent-bg: #eff4ff;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 14px;
  --shadow:
    0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -12px rgba(15, 23, 42, 0.1);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    "Cairo",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
}

/* ---------- الشريط العلوي ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar .wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}

.brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  flex: none;
}

.topbar a.nav {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease);
  white-space: nowrap;
}
.topbar a.nav:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- الحاوية ---------- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 44px 20px 64px;
}

/* ---------- الهيرو ---------- */
.hero {
  margin-bottom: 28px;
}

.badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
}
.badge.danger {
  color: var(--danger);
  background: var(--danger-bg);
}

h1 {
  font-size: clamp(28px, 5.5vw, 40px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}

.lede {
  color: var(--muted);
  font-size: clamp(15px, 2.4vw, 17px);
  font-weight: 400;
  max-width: 54ch;
}

.updated {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.updated::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex: none;
}

/* ---------- البطاقة ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 36px);
}

.card + .card {
  margin-top: 18px;
}

/* ---------- الأقسام ---------- */
.section {
  padding: 26px 0;
  border-top: 1px solid var(--border);
}
.section:first-child {
  padding-top: 0;
  border-top: 0;
}
.section:last-child {
  padding-bottom: 0;
}

.section h2 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 10px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section h2 .n {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  min-width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  flex: none;
  align-self: center;
}

.section p {
  color: var(--muted);
  margin-bottom: 10px;
}
.section p:last-child {
  margin-bottom: 0;
}
.section strong {
  color: var(--text);
  font-weight: 600;
}

ul {
  list-style: none;
  margin: 8px 0 12px;
}
ul:last-child {
  margin-bottom: 0;
}

li {
  position: relative;
  padding-right: 20px;
  color: var(--muted);
  margin-bottom: 6px;
}
li::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0.82em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.45;
}

/* ---------- تنبيه ---------- */
.callout {
  background: var(--accent-bg);
  border-radius: 10px;
  padding: 16px 18px;
  margin-top: 14px;
}
.callout p {
  color: #334155;
  font-size: 14.5px;
  margin: 0;
}

/* ---------- الروابط والأزرار ---------- */
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-dk);
  text-decoration: underline;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--text);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 24px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background 0.2s var(--ease),
    transform 0.2s var(--ease),
    opacity 0.2s;
}
.btn:hover {
  background: #1e293b;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}
.btn:active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn.full {
  width: 100%;
}
.btn.danger {
  background: var(--danger);
}
.btn.danger:hover {
  background: #b91c1c;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- الحقول ---------- */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 13px 15px;
  font-family: inherit;
  font-size: 15.5px;
  color: var(--text);
  transition:
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
.field input::placeholder {
  color: #a5aebd;
}
.field input:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}
.field.invalid input {
  border-color: var(--danger);
}
.field.invalid input:focus {
  box-shadow: 0 0 0 4px var(--danger-bg);
}

.help {
  font-size: 13.5px;
  color: var(--muted);
  margin-top: 14px;
}

/* ---------- التذييل ---------- */
.footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- التوست ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 50%;
  z-index: 60;
  width: min(430px, calc(100vw - 32px));
  transform: translate(50%, 160%);
  opacity: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--text);
  color: #e2e8f0;
  padding: 15px 17px;
  border-radius: 12px;
  box-shadow: 0 18px 40px -16px rgba(15, 23, 42, 0.6);
  transition:
    transform 0.45s var(--ease),
    opacity 0.3s ease;
}
.toast.show {
  transform: translate(50%, 0);
  opacity: 1;
}

.toast .icon {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #16a34a;
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.toast.error .icon {
  background: var(--danger);
}
.toast .icon svg {
  width: 13px;
  height: 13px;
}

.toast b {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.6;
}
.toast .msg {
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- حركات الدخول ---------- */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeUp 0.55s var(--ease) forwards;
}
.reveal:nth-child(1) {
  animation-delay: 0.05s;
}
.reveal:nth-child(2) {
  animation-delay: 0.13s;
}
.reveal:nth-child(3) {
  animation-delay: 0.21s;
}
.reveal:nth-child(4) {
  animation-delay: 0.29s;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- الموبايل ---------- */
@media (max-width: 520px) {
  body {
    line-height: 1.85;
  }
  .container {
    padding: 32px 16px 48px;
  }
  .topbar .wrap {
    padding: 12px 16px;
  }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  .toast {
    transform: translate(50%, 0);
  }
  .toast:not(.show) {
    opacity: 0;
    pointer-events: none;
  }
  html {
    scroll-behavior: auto;
  }
}
