/* ============================================================
   منصة حوكمة GITEX 2026 — حكومة الفجيرة الرقمية
   هوية: كحلي سيادي + ذهبي، IBM Plex Sans Arabic
   ============================================================ */
:root {
  --navy-900: #0a1628;
  --navy-800: #10203a;
  --navy-700: #16294a;
  --navy-600: #1e3a5f;
  --navy-100: #e8edf5;
  --gold: #c9a227;
  --gold-light: #e5c65a;
  --gold-dim: rgba(201, 162, 39, .14);
  --ink: #1a2332;
  --muted: #6b7688;
  --line: #e3e8f0;
  --bg: #f4f6fa;
  --card: #ffffff;
  --success: #1e7e4e;
  --danger: #b23a3a;
  --warning: #b07d1a;
  --info: #2c5f8a;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(10, 22, 40, .06), 0 8px 24px rgba(10, 22, 40, .05);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}

* { font-family: var(--font); }
body { background: var(--bg); color: var(--ink); font-size: .925rem; }
html[dir="rtl"] body { letter-spacing: 0; }

/* ---------- الهيكل ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { padding: 1.5rem; flex: 1; }
@media (max-width: 768px) { .app-content { padding: 1rem; } }

/* ---------- الشريط الجانبي ---------- */
.sidebar {
  width: 264px; flex-shrink: 0; background: linear-gradient(180deg, var(--navy-900), var(--navy-800));
  color: #cfd8e6; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--navy-600); border-radius: 3px; }
.sidebar-brand {
  padding: 1.35rem 1.25rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-brand .brand-mark {
  width: 42px; height: 42px; border-radius: 10px; background: var(--gold-dim);
  border: 1px solid rgba(201,162,39,.45); color: var(--gold-light);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.05rem;
}
.sidebar-brand .brand-title { color: #fff; font-weight: 700; font-size: .92rem; line-height: 1.45; }
.sidebar-brand .brand-sub { color: var(--gold-light); font-size: .72rem; letter-spacing: .4px; }
.sidebar-nav { padding: .85rem .75rem; flex: 1; }
.sidebar-nav .nav-section { font-size: .68rem; color: #7c8aa0; letter-spacing: 1px; padding: .9rem .6rem .35rem; text-transform: uppercase; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .65rem; color: #cfd8e6; text-decoration: none;
  padding: .52rem .7rem; border-radius: 9px; font-size: .86rem; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.sidebar-nav a i { font-size: 1rem; width: 20px; text-align: center; opacity: .8; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--gold-dim); color: var(--gold-light); font-weight: 600; }
.sidebar-nav a.active i { opacity: 1; }
.sidebar-nav .badge { font-size: .62rem; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.07); font-size: .7rem; color: #7c8aa0; }
@media (max-width: 992px) {
  .sidebar { position: fixed; z-index: 1045; inset-inline-start: 0; transform: translateX(100%); transition: transform .25s; }
  html[dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0) !important; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(10,22,40,.5); z-index: 1040; display: none; }
  .sidebar-backdrop.show { display: block; }
}

/* ---------- الشريط العلوي ---------- */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line); padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 1030;
}
.topbar .page-title { font-weight: 700; font-size: 1.02rem; color: var(--navy-800); }
.topbar .event-chip {
  background: var(--gold-dim); color: #8a6d12; border: 1px solid rgba(201,162,39,.35);
  font-size: .72rem; padding: .25rem .7rem; border-radius: 100px; font-weight: 600; white-space: nowrap;
}
.notif-bell { position: relative; color: var(--navy-700); font-size: 1.15rem; }
.notif-bell .dot {
  position: absolute; top: -4px; inset-inline-end: -6px; background: var(--danger); color: #fff;
  font-size: .58rem; min-width: 16px; height: 16px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px; font-weight: 700;
}

/* ---------- البطاقات ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { background: transparent; border-bottom: 1px solid var(--line); font-weight: 700; color: var(--navy-800); padding: .9rem 1.15rem; font-size: .9rem; }
.card-header i { color: var(--gold); margin-inline-end: .4rem; }

/* بطاقات KPI */
.kpi-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.05rem 1.15rem; box-shadow: var(--shadow); height: 100%;
  border-inline-start: 4px solid var(--navy-600); position: relative; overflow: hidden;
}
.kpi-card.gold { border-inline-start-color: var(--gold); }
.kpi-card.danger { border-inline-start-color: var(--danger); }
.kpi-card.success { border-inline-start-color: var(--success); }
.kpi-card .kpi-value { font-size: 1.7rem; font-weight: 800; color: var(--navy-800); line-height: 1.1; }
.kpi-card .kpi-label { font-size: .76rem; color: var(--muted); margin-top: .2rem; }
.kpi-card .kpi-icon {
  position: absolute; inset-inline-end: .9rem; top: .9rem; font-size: 1.5rem; opacity: .13; color: var(--navy-700);
}

/* الجاهزية الدائرية */
.readiness-ring { --pct: 0; --clr: var(--gold); width: 120px; height: 120px; border-radius: 50%;
  background: conic-gradient(var(--clr) calc(var(--pct) * 1%), var(--navy-100) 0);
  display: flex; align-items: center; justify-content: center; margin-inline: auto; }
.readiness-ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.readiness-ring .pct { font-size: 1.35rem; font-weight: 800; color: var(--navy-800); }
.readiness-ring .lbl { font-size: .62rem; color: var(--muted); }

/* ---------- الجداول ---------- */
.table { font-size: .86rem; }
.table thead th {
  background: var(--navy-100); color: var(--navy-700); font-weight: 700; font-size: .76rem;
  border-bottom: 2px solid var(--line); white-space: nowrap;
}
.table tbody td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f7f9fd; }

/* ---------- الأزرار ---------- */
.btn { border-radius: 9px; font-size: .85rem; font-weight: 600; }
.btn-navy { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.btn-navy:hover { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--navy-900); }
.btn-outline-navy { border-color: var(--navy-600); color: var(--navy-700); }
.btn-outline-navy:hover { background: var(--navy-700); color: #fff; }

/* ---------- الشارات والتقدم ---------- */
.badge { font-weight: 600; font-size: .7rem; padding: .35em .7em; border-radius: 100px; }
.progress { height: 8px; border-radius: 100px; background: var(--navy-100); }
.progress-bar { border-radius: 100px; }

/* ---------- النماذج ---------- */
.form-label { font-weight: 600; font-size: .82rem; color: var(--navy-700); }
.form-control, .form-select { border-radius: 9px; font-size: .87rem; border-color: var(--line); }
.form-control:focus, .form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(201,162,39,.14); }
.form-section-title {
  font-weight: 700; color: var(--navy-800); font-size: .92rem;
  padding-bottom: .5rem; border-bottom: 2px solid var(--gold-dim); margin-bottom: 1rem;
}
.form-section-title i { color: var(--gold); }

/* ---------- صفحة الدخول ---------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1100px 600px at 80% -10%, rgba(201,162,39,.12), transparent 60%),
              linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 55%, var(--navy-700) 100%);
  padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 430px; background: var(--card); border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35); overflow: hidden;
}
.login-head { background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); padding: 2rem 1.75rem 1.6rem; text-align: center; }
.login-head .mark {
  width: 58px; height: 58px; border-radius: 15px; background: var(--gold-dim); border: 1px solid rgba(201,162,39,.5);
  color: var(--gold-light); font-weight: 800; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center; margin: 0 auto .85rem;
}
.login-head h1 { color: #fff; font-size: 1.02rem; font-weight: 700; line-height: 1.6; margin: 0; }
.login-head p { color: var(--gold-light); font-size: .74rem; margin: .3rem 0 0; }
.login-body { padding: 1.75rem; }
.login-footer { text-align: center; font-size: .7rem; color: var(--muted); padding: 0 1.75rem 1.5rem; }

/* ---------- الخط الزمني ---------- */
.timeline { position: relative; padding-inline-start: 1.4rem; }
.timeline::before { content: ''; position: absolute; inset-inline-start: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 1rem; }
.timeline-item::before {
  content: ''; position: absolute; inset-inline-start: -1.4rem; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--gold); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--gold-dim);
  margin-inline-start: .5px;
}
.timeline-item .t-title { font-weight: 600; font-size: .84rem; color: var(--navy-800); }
.timeline-item .t-meta { font-size: .72rem; color: var(--muted); }

/* ---------- بوابات الجاهزية ---------- */
.gate-track { display: flex; gap: .4rem; flex-wrap: wrap; }
.gate-pill {
  flex: 1; min-width: 84px; text-align: center; padding: .55rem .4rem; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; font-size: .7rem;
}
.gate-pill .g-code { font-weight: 800; font-size: .82rem; color: var(--navy-700); }
.gate-pill.approved { background: #eaf5ef; border-color: #bfe0cd; }
.gate-pill.approved .g-code { color: var(--success); }
.gate-pill.late { background: #fbeeee; border-color: #ecc8c8; }
.gate-pill.late .g-code { color: var(--danger); }
.gate-pill.in_progress { background: var(--gold-dim); border-color: rgba(201,162,39,.4); }
.gate-pill.in_progress .g-code { color: #8a6d12; }

/* ---------- غرفة القيادة ---------- */
.cc-banner {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff; border-radius: var(--radius); padding: 1.35rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  border: 1px solid rgba(201,162,39,.3);
}
.cc-banner .cc-day { font-size: 1.35rem; font-weight: 800; color: var(--gold-light); }
.cc-banner .cc-sub { font-size: .8rem; color: #b9c4d6; }
.cc-clock { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- التنبيهات ---------- */
.notif-item { border-inline-start: 3px solid var(--line); padding: .7rem .9rem; border-radius: 8px; background: #fff; }
.notif-item.unread { border-inline-start-color: var(--gold); background: #fffdf5; }

/* ---------- الطباعة ---------- */
.print-doc { background: #fff; max-width: 960px; margin: 0 auto; padding: 2.2rem; }
.print-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px solid var(--navy-800); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.print-header .p-title { font-size: 1.25rem; font-weight: 800; color: var(--navy-900); }
.print-header .p-sub { font-size: .78rem; color: var(--muted); }
.print-header .p-gold { width: 46px; height: 46px; border-radius: 10px; background: var(--gold-dim); border: 1px solid var(--gold); color: #8a6d12; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.print-section-title { font-weight: 800; color: var(--navy-800); border-inline-start: 4px solid var(--gold); padding-inline-start: .6rem; margin: 1.4rem 0 .8rem; font-size: .98rem; }
@media print {
  .no-print, .sidebar, .topbar { display: none !important; }
  body { background: #fff; }
  .app-content { padding: 0 !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-doc { padding: 0; max-width: 100%; }
  a { text-decoration: none; color: inherit; }
}

/* ---------- متفرقات ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.2rem; opacity: .3; display: block; margin-bottom: .6rem; }
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%; background: var(--navy-100); color: var(--navy-700);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem;
}
.filter-bar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.stat-inline { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.stat-inline .s-item .s-val { font-weight: 800; font-size: 1.15rem; color: var(--navy-800); }
.stat-inline .s-item .s-lbl { font-size: .72rem; color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h2 { font-size: 1.15rem; font-weight: 800; color: var(--navy-900); margin: 0; }
.page-head .head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.score-chip { font-weight: 800; font-size: 1.05rem; padding: .3rem .8rem; border-radius: 10px; background: var(--gold-dim); color: #8a6d12; border: 1px solid rgba(201,162,39,.35); }
html[dir="ltr"] .sidebar-brand .brand-title { font-size: .82rem; }
