/* د. محمود المحلاوي — منصة تعليمية (بشكل منصة axnos) */
:root {
  --red: #e63946;
  --navy: #1d3557;
  --gray: #64748b;
  --bg: #f9fff7;
  --card: #ffffff;
  --ink: var(--navy);
  --muted: var(--gray);
  --line: #e7ebf0;
  --header-bg: linear-gradient(135deg, rgba(255,255,255,.95), rgba(248,250,252,.95));
  --grad: linear-gradient(135deg, var(--red), var(--navy));
  --shadow-card: 0 4px 15px rgba(0,0,0,.08);
  --shadow-header: 0 4px 30px rgba(0,0,0,.1);
  --grid-line: rgba(29,53,87,.05);
  --glow: rgba(230,57,70,.14);
}
[data-theme="dark"] {
  --bg: #0e1526;
  --card: #1a2440;
  --ink: #eef2f9;
  --muted: #94a3b8;
  --line: #2a3554;
  --header-bg: linear-gradient(135deg, rgba(14,21,38,.95), rgba(20,28,50,.95));
  --grid-line: rgba(255,255,255,.05);
  --glow: rgba(230,57,70,.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'IBM Plex Sans Arabic', 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.error { color: var(--red); font-weight: 600; margin: 8px 0; font-size: 14px; }

/* ---------- الهيدر ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-header);
}
.brand { font-weight: 900; font-size: 22px; }
.brand-red { color: var(--red); }
.brand-navy { color: var(--ink); }
.header-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.dropdown { position: relative; }
.dropbtn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 14px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.chev { color: var(--muted); font-size: 12px; }
.dropmenu {
  display: none; position: absolute; top: calc(100% + 6px); inset-inline-start: 0; min-width: 220px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-card);
  padding: 6px; z-index: 60;
}
.dropmenu.open { display: block; }
.dropmenu a { display: block; padding: 10px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.dropmenu a:hover { background: var(--bg); color: var(--red); }

.pill-toggle {
  display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.pill-toggle button {
  border: 0; background: none; padding: 6px 14px; border-radius: 999px; font: inherit; font-weight: 700; font-size: 13px;
  color: var(--muted); cursor: pointer;
}
.pill-toggle button.on { background: var(--grad); color: #fff; }

.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); color: var(--ink); cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.btn-grad {
  display: inline-block; background: var(--grad); color: #fff; font-weight: 600;
  border: 0; border-radius: 12px; padding: 11px 22px; font: inherit; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,.05); text-align: center;
}
.btn-grad.big { padding: 14px 28px; font-size: 17px; font-weight: 700; }
.btn-grad.full { width: 100%; }
.btn-grad.small { padding: 9px 16px; font-size: 14px; }
.btn-outline {
  display: inline-block; background: none; color: var(--red); border: 2px solid var(--red);
  border-radius: 12px; padding: 9px 20px; font: inherit; font-weight: 600; cursor: pointer; text-align: center;
}
.btn-outline.small { padding: 7px 14px; font-size: 14px; border-width: 1.5px; }
.btn-outline.center { text-align: center; }

/* ---------- الهيرو ---------- */
.hero {
  display: grid; grid-template-columns: 1fr minmax(300px, 470px); gap: 40px; align-items: center;
  padding: 60px 40px 70px;
  background-image:
    radial-gradient(600px 400px at 90% 0%, var(--glow), transparent 60%),
    radial-gradient(500px 380px at 0% 100%, var(--glow), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 90px 90px, 90px 90px;
}
.hero-photo img {
  width: 100%; border-radius: 20px; display: block;
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.hero-text { text-align: start; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 18px; font-weight: 600; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.hero-badge .dot { width: 9px; height: 9px; border-radius: 999px; background: var(--red); }
.hero-text h1 { font-size: 34px; font-weight: 800; margin: 22px 0 14px; line-height: 1.5; }
.hero-text p { color: var(--muted); font-size: 16px; margin-bottom: 28px; max-width: 520px; }

/* ---------- الأقسام والكروت ---------- */
.section { max-width: 1200px; margin: 0 auto; padding: 30px 28px 50px; }
.section-title { font-size: 24px; font-weight: 800; margin: 14px 0 22px; }
.section-title.small { font-size: 19px; margin-top: 30px; }
.crumb { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.crumb a { color: var(--red); font-weight: 600; }

.cards-grid { display: grid; gap: 22px; }
.cards-grid.years { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cards-grid.subjects { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

.year-card {
  position: relative; background: var(--card); border-radius: 16px; box-shadow: var(--shadow-card);
  padding: 32px 24px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 2px solid transparent; transition: transform .15s, border-color .15s;
}
.year-card:hover { transform: translateY(-3px); border-color: var(--red); }
.cap-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 74px; height: 74px; border-radius: 999px; background: rgba(230,57,70,.09);
}
.year-card b { font-size: 17px; }
.year-card .muted { font-size: 13px; }
.year-card .arrow { position: absolute; bottom: 14px; left: 20px; color: var(--muted); font-size: 20px; }

.subject-card {
  background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-card);
  border: 2px solid transparent; transition: transform .15s, border-color .15s; display: block;
}
.subject-card:hover { transform: translateY(-3px); border-color: var(--red); }
.subject-cover img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.subject-body { padding: 16px 18px 20px; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.subject-body b { font-size: 16px; }
.count-pill {
  display: inline-block; border: 1.5px dashed var(--line); border-radius: 10px; padding: 8px 16px;
  color: var(--muted); font-size: 13px; font-weight: 600;
}

/* ---------- العدادات والبوابات ---------- */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; margin: 16px 0 8px; }
.counter { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; }
.counter b { display: block; font-size: 24px; }
.counter span { color: var(--muted); font-size: 13px; }

.gate { border-radius: 14px; padding: 18px; font-weight: 600; margin: 14px 0; }
.gate.ok { background: #e9f8f0; color: #15803d; }
.gate.wait { background: #fdf6e3; color: #b45309; }
.gate.no { background: #fdeaea; color: #b91c1c; }
.gate.locked { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.gate.locked a { color: var(--red); font-weight: 800; }
[data-theme="dark"] .gate.ok { background: #123a26; color: #6ee7a8; }
[data-theme="dark"] .gate.wait { background: #3a2f10; color: #fbbf24; }
[data-theme="dark"] .gate.no { background: #3f1616; color: #f87171; }

.assets { display: grid; gap: 12px; margin-top: 14px; }
.asset {
  display: flex; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
}
.asset-icon {
  min-width: 52px; height: 52px; border-radius: 12px; background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}

/* ---------- صفحات الدخول والتسجيل ---------- */
.auth-wrap { display: flex; justify-content: center; padding: 56px 20px 70px; }
.auth-card {
  width: 100%; max-width: 560px; background: var(--card); border-radius: 24px; box-shadow: var(--shadow-card);
  padding: 36px 32px; display: flex; flex-direction: column; gap: 14px;
}
.auth-card h2 { text-align: center; font-size: 24px; font-weight: 800; margin-bottom: 2px; }
.auth-card > p { text-align: center; margin-bottom: 6px; }
.auth-card input, .auth-card select {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font: inherit; font-size: 15px;
  background: var(--bg); color: var(--ink); width: 100%;
}
.auth-card input:focus, .auth-card select:focus { outline: 2px solid rgba(230,57,70,.4); border-color: var(--red); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-alt { text-align: center; font-size: 14px; color: var(--muted); margin-top: 4px; }
.auth-alt a { color: var(--red); font-weight: 700; }

/* ---------- صفحة الطالب ---------- */
.student-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.student-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.orders { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.orders li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
}
.status { border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 700; }
.status.ok { background: #e9f8f0; color: #15803d; }
.status.wait { background: #fdf6e3; color: #b45309; }
.status.no { background: #fdeaea; color: #b91c1c; }

/* ---------- لوحة تحكم المالك ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 14px 0 22px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; text-align: center; box-shadow: var(--shadow-card); }
.card b { display: block; font-size: 26px; }
.card span { color: var(--muted); font-size: 13px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin: 10px 0 18px; font-size: 14px; }
.tbl th, .tbl td { padding: 11px 12px; text-align: start; border-bottom: 1px solid var(--line); }
.tbl th { background: var(--bg); font-size: 13px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .actions { white-space: nowrap; }
.lnk { background: none; border: 0; color: var(--red); font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; padding: 4px 6px; }
.lnk.danger { color: #b91c1c; }
.inlineform { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 26px; align-items: center; }
.inlineform input, .inlineform select {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 14px;
  background: var(--card); color: var(--ink);
}
.tbl select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; background: var(--card); color: var(--ink); }
.catalog-admin { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.cat-year { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.cat-year ul { margin: 8px 0 0; padding-inline-start: 18px; }
.cat-year li { margin: 4px 0; font-size: 14px; }

/* ---------- الفوتر ---------- */
.site-footer {
  margin-top: 40px; padding: 28px 28px 22px; color: #fff;
  background: linear-gradient(120deg, var(--red), var(--navy));
}
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1200px; margin: 0 auto; }
.footer-row .brand-navy { color: #fff; }
.footer-row.small { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.25); font-size: 13px; opacity: .92; }
.footer-pill {
  border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 7px 16px; font-size: 14px; font-weight: 600;
}
.footer-badge { border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 4px 12px; font-size: 12px; }

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; padding: 30px 20px 40px; }
  .hero-text h1 { font-size: 24px; }
  .site-header { padding: 12px 14px; }
  .brand { font-size: 18px; }
  .section { padding: 20px 14px 40px; }
  .two-col { grid-template-columns: 1fr; }
}

/* video embed + admin video rows */
.video-wrap{position:relative;width:100%;max-width:860px;margin:0 auto 18px;aspect-ratio:16/9;border-radius:16px;overflow:hidden;box-shadow:0 4px 15px rgba(0,0,0,.08);background:#000}
.video-wrap iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.video-row{display:flex;align-items:center;gap:8px;margin:6px 0;flex-wrap:wrap}
.video-row-name{min-width:140px;font-size:14px}
.video-input{flex:1;min-width:220px}
.cat-subject{font-weight:700;margin-top:10px;color:var(--navy,#1d3557)}

/* anti-sharing phone watermark over the video */
.watermark{position:absolute;z-index:5;pointer-events:none;color:rgba(255,255,255,.55);font:700 18px/1.4 "IBM Plex Sans Arabic",Cairo,sans-serif;text-shadow:0 1px 4px rgba(0,0,0,.6);background:rgba(0,0,0,.18);padding:4px 12px;border-radius:8px;transition:top 1.2s ease,left 1.2s ease;white-space:nowrap}

.adm-years{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:12px 0}
.adm-year{display:flex;flex-direction:column;gap:6px;align-items:flex-start;text-align:start;background:var(--card);border:2px solid var(--line);border-radius:18px;padding:18px 14px;font:inherit;color:inherit;cursor:pointer;min-height:110px}
.adm-year b{font-size:17px;color:var(--navy,#1d3557)}
.adm-year:hover,.adm-year:active{border-color:var(--red)}
.adm-back{margin:8px 0}
.adm-year-title{font-size:20px;margin:8px 0 12px}
.cat-subject-box{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin:10px 0}
.cat-subject-box summary{font-weight:700;cursor:pointer;color:var(--navy,#1d3557);list-style:none}
.cat-subject-box summary::before{content:"◂ ";color:var(--red)}
.cat-subject-box[open] summary::before{content:"▾ "}
.cat-subject-box .video-row{display:grid;grid-template-columns:1fr auto;gap:6px 8px;margin:12px 0;padding-top:10px;border-top:1px dashed var(--line)}
.cat-subject-box .video-row-name{grid-column:1 / -1;min-width:0;font-weight:600}
.cat-subject-box .video-input{min-width:0;width:100%;box-sizing:border-box}
@media (min-width:700px){.adm-years{grid-template-columns:repeat(4,1fr)}}
.tbl{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.inlineform,.order-form{max-width:100%}
.inlineform select,.order-form select,.order-form input{max-width:100%;min-width:0}
.item-actions{display:flex;gap:14px;margin:8px 0}
.video-row-name .lnk{font-size:12px;margin-inline-start:8px}
