/* منصة الدرجة النهائية مع مستر سعد */
:root {
  --navy: #10294a;
  --navy-2: #163a63;
  --navy-3: #0b1f3a;
  --turq: #15b5a2;
  --turq-2: #0ea393;
  --turq-light: #e3f7f4;
  --white: #ffffff;
  --gray-bg: #f3f6fa;
  --gray-100: #eef2f7;
  --gray-300: #d6dee8;
  --gray-500: #7c8aa0;
  --gray-700: #45536a;
  --red: #e05252;
  --red-light: #fdecec;
  --orange: #f0962b;
  --orange-light: #fdf1e2;
  --green: #22a565;
  --green-light: #e7f7ef;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(16, 41, 74, 0.08);
  --shadow-lg: 0 14px 44px rgba(16, 41, 74, 0.14);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { direction: rtl; }
body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background: var(--gray-bg);
  color: var(--navy-3);
  line-height: 1.7;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: var(--turq); text-decoration: none; }

/* ---------- landing ---------- */
.landing-hero {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--navy-3) 0%, var(--navy) 45%, var(--navy-2) 100%);
  color: var(--white);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px; position: relative; overflow: hidden;
}
.landing-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 85% 15%, rgba(21,181,162,.25), transparent 45%),
              radial-gradient(circle at 10% 90%, rgba(21,181,162,.15), transparent 40%);
}
.hero-content { position: relative; max-width: 760px; }
.hero-logo { width: 110px; height: 110px; margin-bottom: 18px; filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.hero-badge {
  display: inline-block; background: rgba(21,181,162,.15); border: 1px solid rgba(21,181,162,.45);
  color: #7de8da; padding: 6px 18px; border-radius: 999px; font-size: .9rem; margin-bottom: 18px;
}
.landing-hero h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 6px; }
.landing-hero h1 span { color: var(--turq); }
.hero-slogan { font-size: 1.35rem; color: #bcd0e8; margin-bottom: 10px; font-weight: 600; }
.hero-sub { color: #93a9c6; max-width: 560px; margin: 0 auto 28px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 42px; }
.btn-hero {
  padding: 14px 34px; border-radius: 999px; font-weight: 700; font-size: 1.05rem; border: none; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn-hero:hover { transform: translateY(-2px); }
.btn-hero.primary { background: var(--turq); color: var(--navy-3); box-shadow: 0 10px 30px rgba(21,181,162,.35); }
.btn-hero.ghost { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,.35); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; width: 100%; max-width: 900px; }
.feature-card {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius);
  padding: 22px 16px; backdrop-filter: blur(6px);
}
.feature-card .fi { font-size: 1.9rem; margin-bottom: 8px; }
.feature-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.feature-card p { font-size: .88rem; color: #a9bdd6; }
.grades-strip { display: flex; gap: 10px; justify-content: center; margin: 26px 0; flex-wrap: wrap; }
.grade-chip { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); padding: 8px 18px; border-radius: 12px; font-weight: 600; color: #cfe0f2; }
.contact-strip { margin-top: 36px; color: #8fa6c2; font-size: .92rem; }
.contact-strip strong { color: #cfe0f2; }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(160deg, var(--navy-3), var(--navy) 60%, var(--navy-2)); }
.auth-card { background: var(--white); border-radius: 22px; box-shadow: var(--shadow-lg); padding: 38px 34px; width: 100%; max-width: 420px; text-align: center; }
.auth-card img { width: 76px; margin-bottom: 10px; }
.auth-card h2 { font-size: 1.35rem; margin-bottom: 4px; }
.auth-card .sub { color: var(--gray-500); font-size: .92rem; margin-bottom: 22px; }

/* ---------- layout (dashboards) ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: linear-gradient(180deg, var(--navy), var(--navy-3)); color: var(--white);
  padding: 22px 14px; position: fixed; inset-block: 0; inset-inline-start: 0; overflow-y: auto; z-index: 40;
  transition: transform .25s ease; display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 16px; }
.sidebar .brand img { width: 42px; height: 42px; }
.sidebar .brand .t1 { font-weight: 800; font-size: .98rem; line-height: 1.3; }
.sidebar .brand .t2 { font-size: .72rem; color: #8fa6c2; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: #b9cade;
  cursor: pointer; margin-bottom: 4px; font-weight: 600; font-size: .95rem; transition: background .15s, color .15s;
  border: none; background: none; width: 100%; text-align: start;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: var(--white); }
.nav-item.active { background: var(--turq); color: var(--navy-3); }
.nav-item .ni { font-size: 1.15rem; }
.sidebar .foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.12); }
.main { flex: 1; margin-inline-start: 250px; padding: 26px 30px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 12px; }
.topbar h1 { font-size: 1.5rem; font-weight: 800; }
.topbar .who { color: var(--gray-500); font-size: .9rem; }
.menu-toggle { display: none; background: var(--navy); color: #fff; border: none; border-radius: 10px; padding: 8px 12px; font-size: 1.1rem; cursor: pointer; }

/* ---------- cards & stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; display: flex; align-items: center; gap: 14px; }
.stat-card .ic { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-card .ic.t { background: var(--turq-light); }
.stat-card .ic.g { background: var(--green-light); }
.stat-card .ic.r { background: var(--red-light); }
.stat-card .ic.o { background: var(--orange-light); }
.stat-card .ic.n { background: var(--gray-100); }
.stat-card .num { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.stat-card .lbl { color: var(--gray-500); font-size: .85rem; }
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.card h3 { font-size: 1.08rem; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--gray-100); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--white); }
th { background: var(--gray-100); color: var(--gray-700); font-weight: 700; padding: 11px 14px; text-align: start; white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid var(--gray-100); vertical-align: middle; }
tr:hover td { background: #fafcfe; }
.empty-state { text-align: center; color: var(--gray-500); padding: 34px 12px; }
.empty-state .ei { font-size: 2.2rem; display: block; margin-bottom: 8px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; text-align: start; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: 6px; color: var(--gray-700); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--gray-300); border-radius: 12px; background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--turq); box-shadow: 0 0 0 3px rgba(21,181,162,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ---------- buttons & badges ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 20px; border-radius: 12px; font-weight: 700; border: none; cursor: pointer; font-size: .94rem;
  transition: transform .12s, box-shadow .12s, opacity .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.turq { background: var(--turq); color: var(--navy-3); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: var(--gray-100); color: var(--gray-700); }
.btn.sm { padding: 7px 13px; font-size: .84rem; border-radius: 10px; }
.btn.block { width: 100%; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge.green { background: var(--green-light); color: var(--green); }
.badge.red { background: var(--red-light); color: var(--red); }
.badge.orange { background: var(--orange-light); color: var(--orange); }
.badge.gray { background: var(--gray-100); color: var(--gray-500); }
.badge.turq { background: var(--turq-light); color: var(--turq-2); }
.badge.navy { background: #e6edf6; color: var(--navy-2); }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(11,31,58,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 18px; }
.modal { background: var(--white); border-radius: 20px; padding: 26px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal h3 { margin-bottom: 16px; font-size: 1.15rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 18px; }

/* ---------- attendance ---------- */
.att-btn { border: 2px solid var(--gray-300); background: var(--white); border-radius: 10px; padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: .85rem; transition: all .12s; }
.att-btn.sel-p { border-color: var(--green); background: var(--green-light); color: var(--green); }
.att-btn.sel-a { border-color: var(--red); background: var(--red-light); color: var(--red); }
.att-btn.sel-l { border-color: var(--orange); background: var(--orange-light); color: var(--orange); }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--gray-100); flex-wrap: wrap; }
.att-row .nm { font-weight: 700; }
.att-row .grp { color: var(--gray-500); font-size: .82rem; }

/* ---------- calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { text-align: center; font-weight: 700; color: var(--gray-500); font-size: .8rem; padding: 6px 0; }
.cal-day { aspect-ratio: 1; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .88rem; font-weight: 700; background: var(--gray-100); color: var(--gray-700); }
.cal-day.p { background: var(--green-light); color: var(--green); border: 1.5px solid var(--green); }
.cal-day.a { background: var(--red-light); color: var(--red); border: 1.5px solid var(--red); }
.cal-day.l { background: var(--orange-light); color: var(--orange); border: 1.5px solid var(--orange); }
.cal-day.blank { background: transparent; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; font-size: .85rem; color: var(--gray-700); }
.cal-legend .dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; margin-inline-end: 6px; vertical-align: middle; }

/* ---------- notifications ---------- */
.notif-item { display: flex; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--gray-100); margin-bottom: 10px; background: var(--white); }
.notif-item.unread { border-inline-start: 4px solid var(--turq); background: #fbfefd; }
.notif-item .nico { font-size: 1.4rem; }
.notif-item .nt { font-weight: 700; }
.notif-item .nb { color: var(--gray-700); font-size: .9rem; }
.notif-item .nd { color: var(--gray-500); font-size: .78rem; margin-top: 4px; }

/* ---------- misc ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 10px 14px; border: 1.5px solid var(--gray-300); border-radius: 12px; background: var(--white); }
.toolbar .spacer { flex: 1; }
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; font-weight: 600; font-size: .92rem; }
.alert.error { background: var(--red-light); color: var(--red); }
.alert.success { background: var(--green-light); color: var(--green); }
.muted { color: var(--gray-500); font-size: .86rem; }
.hidden { display: none !important; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--gray-100); border-top-color: var(--turq); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.code-chip { font-family: 'Courier New', monospace; background: var(--navy); color: #7de8da; padding: 6px 14px; border-radius: 10px; font-weight: 700; letter-spacing: 1px; direction: ltr; display: inline-block; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--turq-light); color: var(--turq-2); display: flex; align-items: center; justify-content: center; font-weight: 800; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.8rem; }

/* ---------- report (print) ---------- */
.report-doc { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 34px; max-width: 800px; margin: 0 auto 20px; }
.report-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--navy); padding-bottom: 16px; margin-bottom: 18px; }
.report-head img { width: 62px; }
.report-head .rt { font-size: 1.25rem; font-weight: 800; }
.report-head .rs { color: var(--turq-2); font-weight: 700; font-size: .9rem; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .toolbar, .no-print, .btn, .menu-toggle { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .report-doc { box-shadow: none; border-radius: 0; padding: 10px; max-width: none; }
  .card { box-shadow: none; border: 1px solid #eee; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(100%); width: 260px; }
  html[dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-inline-start: 0; padding: 18px 14px; }
  .menu-toggle { display: block; }
  .form-row { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 1.2rem; }
  .landing-hero h1 { font-size: 1.9rem; }
  .hero-slogan { font-size: 1.1rem; }
  .stat-card .num { font-size: 1.3rem; }
}
