:root {
  --bg: #0a0e1a;
  --bg-soft: #111727;
  --bg-card: #161d30;
  --bg-elevated: #1d2640;
  --border: #263150;
  --text: #e6edf7;
  --text-dim: #9aa7c2;
  --text-faint: #6b7794;
  --accent: #3b82f6;
  --accent-soft: #1e3a8a;
  --danger: #ef4444;
  --danger-soft: #7f1d1d;
  --success: #22c55e;
  --warning: #f59e0b;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --mono: 'Fira Code', monospace;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}

[data-theme="light"] {
  --bg: #eef2f9;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #f3f6fc;
  --border: #d8e0ee;
  --text: #16203a;
  --text-dim: #4a5878;
  --text-faint: #8290ad;
  --shadow: 0 8px 30px rgba(40,60,110,.12);
}

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

body {
  font-family: 'Cairo', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background .3s, color .3s;
}

/* ===== شريط علوي ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 26px;
  background: linear-gradient(135deg, var(--bg-soft), var(--bg-card));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo { font-size: 36px; filter: drop-shadow(0 0 10px var(--accent)); }
.topbar h1 { font-size: 21px; font-weight: 900; letter-spacing: -.3px; }
.tagline { font-size: 12.5px; color: var(--text-dim); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.safe-badge {
  background: rgba(34,197,94,.12);
  color: var(--success);
  border: 1px solid rgba(34,197,94,.3);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
}
.theme-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px; height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  transition: .2s;
}
.theme-btn:hover { background: var(--accent-soft); }

/* ===== تنبيه أخلاقي ===== */
.ethics-banner {
  background: linear-gradient(90deg, var(--danger-soft), transparent);
  border-bottom: 1px solid rgba(239,68,68,.3);
  padding: 12px 26px;
  font-size: 13.5px;
  color: var(--text);
  position: relative;
  padding-inline-end: 50px;
}
.banner-close {
  position: absolute;
  inset-inline-end: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
}

/* ===== التخطيط ===== */
.layout { display: flex; min-height: calc(100vh - 140px); }
.sidebar {
  width: 270px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-inline-end: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  overflow-y: auto;
}
.sidebar-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  padding: 0 10px 12px;
  font-weight: 700;
}
.nav-list { list-style: none; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-dim);
  transition: .15s;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--bg-elevated); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: #fff;
  border-color: var(--accent);
}
.nav-item .nav-icon { font-size: 19px; }
.nav-item .nav-check {
  margin-inline-start: auto;
  font-size: 13px;
  color: var(--success);
  opacity: 0;
}
.nav-item.completed .nav-check { opacity: 1; }

.sidebar-footer { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.progress-label { font-size: 12px; color: var(--text-faint); margin-bottom: 8px; }
.progress-bar { height: 8px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width .5s; }
.progress-text { font-size: 12px; color: var(--text-dim); margin-top: 8px; text-align: center; }

/* ===== المحتوى ===== */
.content { flex: 1; padding: 32px 40px; max-width: 1000px; margin: 0 auto; width: 100%; }

.attack-header { margin-bottom: 26px; }
.attack-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}
.attack-title { font-size: 32px; font-weight: 900; margin-bottom: 8px; letter-spacing: -.5px; }
.attack-subtitle { font-size: 16px; color: var(--text-dim); }

.severity { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 8px; }
.sev-critical { background: rgba(239,68,68,.15); color: var(--danger); }
.sev-high { background: rgba(245,158,11,.15); color: var(--warning); }
.sev-medium { background: rgba(59,130,246,.15); color: var(--accent); }

/* بطاقات */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.card h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h3 .sec-icon { font-size: 22px; }
.card p { color: var(--text-dim); margin-bottom: 12px; }
.card p:last-child { margin-bottom: 0; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-top: 6px; }
.info-tile { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.info-tile .it-label { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.info-tile .it-value { font-size: 15px; font-weight: 700; }

ul.bullet { list-style: none; }
ul.bullet li { padding: 8px 0; padding-inline-start: 26px; position: relative; color: var(--text-dim); }
ul.bullet li::before { content: '◂'; position: absolute; inset-inline-start: 6px; color: var(--accent); }
ul.bullet.defense li::before { content: '✓'; color: var(--success); }
ul.bullet.risk li::before { content: '✕'; color: var(--danger); }

/* صندوق المحاكاة */
.sim-box {
  background: linear-gradient(160deg, var(--bg-elevated), var(--bg-card));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}
.sim-box h3 { color: var(--accent); }
.sim-label { font-size: 13px; color: var(--text-faint); margin: 0 0 6px; }

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: .18s;
}
.btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-ghost { background: var(--bg-elevated); border: 1px solid var(--border); color: var(--text); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; align-items: center; }

input.field, textarea.field, select.field {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  width: 100%;
}
input.field:focus, textarea.field:focus { outline: none; border-color: var(--accent); }
.field-group { margin-bottom: 14px; }
.field-group label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }

.terminal {
  background: #060912;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  height: 240px;
  overflow-y: auto;
  margin-top: 14px;
  direction: ltr;
  text-align: left;
}
.terminal .log-line { white-space: pre-wrap; word-break: break-all; }
.t-green { color: #4ade80; }
.t-red { color: #f87171; }
.t-yellow { color: #fbbf24; }
.t-blue { color: #60a5fa; }
.t-gray { color: #6b7794; }
.t-purple { color: #c084fc; }

.code-block {
  background: #060912;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: #e6edf7;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  margin: 12px 0;
  white-space: pre;
}
.code-block .cm { color: #6b7794; }
.code-block .kw { color: #c084fc; }
.code-block .str { color: #4ade80; }
.code-block .num { color: #fbbf24; }
.code-block .bad { background: rgba(239,68,68,.2); color: #fca5a5; border-radius: 3px; padding: 0 2px; }
.code-block .good { background: rgba(34,197,94,.18); color: #86efac; border-radius: 3px; padding: 0 2px; }

/* مقاييس حية */
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 12px; margin: 16px 0; }
.metric {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; text-align: center;
}
.metric .m-value { font-size: 26px; font-weight: 900; font-family: var(--mono); }
.metric .m-label { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

/* شريط الحِمل (DDoS) */
.server-vis { margin: 18px 0; }
.load-bar-wrap { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; height: 30px; overflow: hidden; position: relative; }
.load-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--success), var(--warning), var(--danger)); transition: width .25s; }
.load-bar-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; font-family: var(--mono); }
.server-status { text-align: center; font-weight: 800; font-size: 18px; margin-top: 12px; padding: 10px; border-radius: 10px; }
.status-online { color: var(--success); background: rgba(34,197,94,.1); }
.status-degraded { color: var(--warning); background: rgba(245,158,11,.1); }
.status-down { color: var(--danger); background: rgba(239,68,68,.12); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.packet-field { position: relative; height: 120px; background: var(--bg); border:1px solid var(--border); border-radius:10px; overflow:hidden; margin-top:14px; }
.packet { position: absolute; width: 8px; height: 8px; border-radius: 50%; }

/* بريد تصيّد */
.email-mock { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.email-head { padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--bg-elevated); }
.email-row { display: flex; gap: 8px; font-size: 13.5px; padding: 2px 0; }
.email-row .er-label { color: var(--text-faint); min-width: 70px; }
.email-body { padding: 18px 16px; font-size: 14px; }
.clue { background: rgba(245,158,11,.12); border-inline-start: 3px solid var(--warning); padding: 4px 8px; border-radius: 4px; cursor: help; position: relative; }
.clue.found { background: rgba(34,197,94,.15); border-color: var(--success); }
.phish-link { color: var(--accent); text-decoration: underline; cursor: pointer; }

.quiz-option {
  display: block; width: 100%; text-align: start;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); padding: 13px 16px; border-radius: 10px;
  margin-bottom: 10px; cursor: pointer; font-family: inherit; font-size: 14.5px;
  transition: .15s;
}
.quiz-option:hover { border-color: var(--accent); }
.quiz-option.correct { background: rgba(34,197,94,.18); border-color: var(--success); }
.quiz-option.wrong { background: rgba(239,68,68,.15); border-color: var(--danger); }
.quiz-feedback { margin-top: 12px; padding: 12px 14px; border-radius: 10px; font-weight: 600; display: none; }
.quiz-feedback.show { display: block; }
.quiz-feedback.ok { background: rgba(34,197,94,.12); color: var(--success); }
.quiz-feedback.no { background: rgba(239,68,68,.12); color: var(--danger); }

.complete-btn-wrap { text-align: center; margin: 30px 0 10px; }

.strength-meter { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.strength-fill { height: 100%; width: 0%; transition: width .3s, background .3s; }

.db-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; direction: ltr; }
.db-table th, .db-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.db-table th { background: var(--bg-elevated); }
.db-table .leaked { background: rgba(239,68,68,.12); }

/* صفحة البداية */
.home-hero { text-align: center; padding: 30px 0 20px; }
.home-hero h2 { font-size: 34px; font-weight: 900; margin-bottom: 12px; }
.home-hero p { font-size: 17px; color: var(--text-dim); max-width: 640px; margin: 0 auto; }
.attack-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 16px; margin-top: 28px; }
.attack-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; cursor: pointer; transition: .2s; position: relative; overflow: hidden;
}
.attack-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.attack-card .ac-icon { font-size: 38px; margin-bottom: 12px; }
.attack-card h4 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.attack-card p { font-size: 13.5px; color: var(--text-dim); }
.attack-card .ac-sev { position: absolute; top: 14px; inset-inline-end: 14px; font-size: 11px; padding: 3px 9px; border-radius: 6px; font-weight: 700; }

.footer { text-align: center; padding: 20px; color: var(--text-faint); font-size: 13px; border-top: 1px solid var(--border); }

.fade-in { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

html[lang="en"] body { font-family: 'Inter', 'Cairo', system-ui, sans-serif; }

@media (max-width: 860px) {
  .sidebar { position: fixed; top: 0; height: 100vh; inset-inline-start: -290px; z-index: 300; transition: .3s; box-shadow: var(--shadow); }
  .sidebar.open { inset-inline-start: 0; }
  .content { padding: 20px; }
  .topbar h1 { font-size: 17px; }
  .tagline { display: none; }
}
.mobile-menu-btn { display: none; }
@media (max-width: 860px) { .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; } }
