/* ═══════════════════════════════════════════════════════════════════════════
   Azu Emergency — نظام التصميم
   موروث من Azu Medicine: نفس اللوحة، نفس الطبقات، نفس الإيقاع الحركي.
   أسماء المتغيرات القديمة محفوظة كمرادفات، فتعمل كل الصفحات بلا تعديل.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;900&family=Tajawal:wght@300;400;500;700&display=swap');

:root {
  /* لوحة Azu Medicine */
  --navy:      #0A1628;
  --navy2:     #0F2044;
  --navy3:     #1a3a6b;
  --gold:      #C9A84C;
  --gold2:     #E8C96A;
  --gold3:     #F5E098;
  --teal:      #0D9488;
  --teal2:     #14B8A6;
  --white:     #F8F9FA;
  --border:    rgba(201,168,76,0.2);

  /* مرادفات للأسماء المستخدمة في الصفحات القائمة */
  --ink:       var(--navy);
  --ink-2:     var(--navy2);
  --surface:   rgba(15,32,68,0.72);
  --surface-2: #16324f;
  --line:      var(--border);
  --line-soft: rgba(201,168,76,0.12);
  --text:      #E2E8F0;
  --text-soft: #94A3B8;
  --text-dim:  #7C93AD;
  --gold-soft: var(--gold2);
  --gold-deep: #a8832a;
  --gold-hot:  var(--gold3);
  --teal-soft: var(--teal2);
  --alert:     #C8504A;

  --radius:    20px;
  --radius-sm: 12px;
  --shell:     1240px;
  --font:      'Cairo', 'Tajawal', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--navy);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.75;
}

/* ── طبقات الخلفية (يحقنها app.js) ───────────────────────────────────── */
.bg-layer {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(201,168,76,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(13,148,136,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 20% 90%, rgba(26,58,107,0.4) 0%, transparent 60%),
    linear-gradient(180deg, #0A1628 0%, #0D1E3D 50%, #0A1628 100%);
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(201,168,76,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,168,76,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
}

.shell {
  position: relative; z-index: 10;
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── الترويسة ─────────────────────────────────────────────────────────── */
.topbar {
  position: relative; z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

/* الانتماء الأكاديمي يميناً · الملاحة وسطاً · شعار الشركة يساراً */
.topbar .affiliation { order: 1; }
.topbar .topnav      { order: 2; }
.topbar .brand-mark  { order: 3; }

.affiliation .line-1 {
  font-size: 1.1rem; font-weight: 900;
  color: var(--gold2); letter-spacing: .02em;
}
.affiliation .line-2 { font-size: .72rem; color: var(--text-soft); font-weight: 400; }

/* شارة الشركة — نفس بنية header-badge في Azu Medicine */
.brand-mark {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 16px;
  background: rgba(13,148,136,0.10);
  border: 1px solid rgba(13,148,136,0.30);
  border-radius: 20px;
}
.brand-mark span:not(.dot) { display: none; }

.site-logo {
  display: block;
  width: 46px; height: 46px;
  background: url('logo.png') center / contain no-repeat;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.4));
  text-decoration: none;
  transition: filter .2s ease;
}
.site-logo:hover { filter: drop-shadow(0 2px 12px rgba(201,168,76,.35)) brightness(1.1); }

.brand-mark .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: .5; transform: scale(1.3); }
}

/* ── الملاحة ──────────────────────────────────────────────────────────── */
.topnav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.topnav a, .topnav button {
  padding: 7px 16px;
  font-family: var(--font); font-size: .78rem; font-weight: 600;
  color: var(--text-soft); background: rgba(15,32,68,.6);
  border: 1px solid var(--border); border-radius: 20px;
  text-decoration: none; cursor: pointer;
  backdrop-filter: blur(10px);
  transition: all .2s ease;
}
.topnav a:hover, .topnav button:hover {
  color: var(--navy); background: var(--gold2); border-color: var(--gold2);
}
.topnav .out { color: #f0a09b; }
.topnav .out:hover { background: var(--alert); color: #fff; border-color: var(--alert); }

/* ── المحتوى ──────────────────────────────────────────────────────────── */
main {
  position: relative; z-index: 10;
  flex: 1;
  display: flex; flex-direction: column;
  padding: clamp(14px, 3vh, 32px) 0;
  gap: clamp(16px, 3.2vh, 36px);
}
body.page-index main { align-items: stretch; justify-content: center; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── الواجهة الرئيسية ─────────────────────────────────────────────────── */
.hero { text-align: center; animation: fadeUp .8s ease both; }

.hero h1 {
  font-size: clamp(2rem, 6vh, 3.2rem); font-weight: 900;
  line-height: 1.2; letter-spacing: .02em;
  margin: 0 auto clamp(10px, 2vh, 20px);
  background: linear-gradient(135deg, var(--gold2), var(--white), var(--gold3));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-8px); }
}

.hero .subtitle {
  font-size: clamp(.85rem, 1.9vh, 1rem);
  color: var(--text-soft); font-weight: 400; line-height: 1.8;
  max-width: 560px; margin: 0 auto;
}
.hero .subtitle .ln { display: block; }
.hero .subtitle .ln + .ln { margin-top: 3px; }

/* خط النبض */
.pulse-rule {
  display: block;
  width: min(420px, 74%);
  height: clamp(16px, 2.6vh, 26px);
  margin: clamp(10px, 2vh, 20px) auto clamp(4px, 1vh, 10px);
  overflow: visible;
}
.pulse-rule .trace {
  fill: none; stroke: var(--gold-deep); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.pulse-rule .sweep {
  fill: none; stroke: var(--teal2); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 60 460;
  animation: sweep 3.4s linear infinite;
}
@keyframes sweep { to { stroke-dashoffset: -520; } }

/* ── البطاقات ─────────────────────────────────────────────────────────── */
.portals {
  width: 100%;
  display: flex; gap: 24px; flex-wrap: wrap; justify-content: center;
  animation: fadeUp .8s ease .2s both;
}

.portal {
  position: relative; overflow: hidden;
  display: block; width: 300px; text-align: center;
  padding: clamp(20px, 3.6vh, 34px) 32px;
  background: rgba(15,32,68,0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  text-decoration: none; cursor: pointer;
  transition: all .3s ease;
}
.portal::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(201,168,76,.04));
  opacity: 0; transition: opacity .3s;
}
.portal:hover {
  transform: translateY(-6px);
  border-color: rgba(201,168,76,.5);
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 40px rgba(201,168,76,.1);
}
.portal:hover::before { opacity: 1; }
.portal.teal-card:hover {
  border-color: rgba(13,148,136,.6);
  box-shadow: 0 20px 60px rgba(0,0,0,.4), 0 0 40px rgba(13,148,136,.15);
}

.portal .glyph svg { width: 54%; height: 54%; stroke-width: 1.7; fill: none;
                      stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }

.portal .glyph {
  display: grid; place-items: center;
  width: clamp(52px, 8vh, 68px); height: clamp(52px, 8vh, 68px);
  margin: 0 auto clamp(10px, 2vh, 18px);
  border-radius: 18px;
  font-size: clamp(1.4rem, 3vh, 1.9rem);
  background: rgba(201,168,76,.12); border: 1px solid rgba(201,168,76,.3);
  color: var(--gold2);
}
.portal.teal-card .glyph {
  background: rgba(13,148,136,.12); border-color: rgba(13,148,136,.3);
  color: var(--teal2);
}

.portal h2 { margin: 0 0 8px; font-size: 1.15rem; font-weight: 900; color: var(--white); }
.portal p  { margin: 0 0 clamp(12px, 2.4vh, 22px); font-size: .78rem;
             color: var(--text-soft); line-height: 1.7; }

/* ── الأزرار ──────────────────────────────────────────────────────────── */
.btn {
  display: block; width: 100%;
  margin-top: 14px; padding: 11px 20px;
  border: 0; border-radius: 10px;
  font-family: var(--font); font-size: .88rem; font-weight: 700;
  color: var(--navy); cursor: pointer; text-decoration: none; text-align: center;
  transition: all .2s;
}
.btn-gold { background: linear-gradient(135deg, var(--gold), #a8832a); color: var(--navy); }
.btn-gold:hover { box-shadow: 0 6px 20px rgba(201,168,76,.4); transform: translateY(-1px); }
.btn-teal { background: linear-gradient(135deg, var(--teal), #0a7a72); color: #fff; }
.btn-teal:hover { box-shadow: 0 6px 20px rgba(13,148,136,.4); transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--gold2); outline-offset: 3px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── شريط الإحصاء ─────────────────────────────────────────────────────── */
.stats-row {
  display: flex; gap: 32px; flex-wrap: wrap; justify-content: center;
  animation: fadeUp .8s ease .4s both;
}
.stat-item { text-align: center; padding: 0 16px; border-left: 1px solid var(--border); }
.stat-item:last-child { border-left: none; }
.stat-num { font-size: clamp(1.1rem, 2.2vh, 1.5rem); font-weight: 900; color: var(--gold2); }
.stat-label { font-size: .7rem; color: var(--text-soft); margin-top: 2px; }

/* ── التذييل ──────────────────────────────────────────────────────────── */
.footer {
  position: relative; z-index: 10;
  padding: 10px 16px; text-align: center;
  border-top: 1px solid var(--border);
  font-size: .7rem; color: var(--text-soft);
}
.footer .sep { margin: 0 10px; color: var(--gold-deep); }

/* ── جداول موحّدة ─────────────────────────────────────────────────────── */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 12px; text-align: right; white-space: nowrap;
  font-size: .74rem; font-weight: 900; letter-spacing: .02em;
  color: var(--gold2);
  background: linear-gradient(180deg, #16324f 0%, #12293f 100%);
  border-bottom: 2px solid var(--gold-deep);
}
.tbl thead th:first-child { border-start-start-radius: var(--radius-sm); }
.tbl thead th:last-child  { border-start-end-radius: var(--radius-sm); }
.tbl tbody td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--line-soft); }
.tbl tbody tr:nth-child(even) { background: rgba(255,255,255,.014); }
.tbl tbody tr:hover { background: rgba(26,58,107,.35); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: rgba(15,32,68,.5);
}

/* ── شاشات قصيرة الارتفاع (لابتوبات + تكبير ويندوز 125–150%) ─────────── */
@media (max-height: 700px) {
  .stats-row { display: none; }
  .hero .subtitle { max-width: 440px; }
}
@media (max-height: 640px) {
  .site-logo { width: 38px; height: 38px; }
  .portal .glyph { width: 46px; height: 46px; font-size: 1.3rem; }
  body.page-index main { justify-content: flex-start; }
}
@media (max-height: 580px) { .hero .subtitle { display: none; } }

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; }
  .topnav { order: 4; width: 100%; }
  .portal { width: 100%; max-width: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero h1, .site-logo, .brand-mark .dot,
  .pulse-rule .sweep, .hero, .portals, .stats-row { animation: none !important; }
  .hero h1 {
    background: none; color: var(--gold2); -webkit-text-fill-color: var(--gold2);
    transform: none;
  }
  .portal:hover { transform: none; }
}
