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

:root {
  --bg: #0b1220;
  --bg-soft: #111827;
  --card: #1a2332;
  --text: #f1f5f9;
  --text-soft: #94a3b8;
  --muted: #64748b;
  --line: #334155;
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-soft: rgba(56, 189, 248, 0.15);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --error-text: #f87171;
  --error-bg: rgba(248, 113, 113, 0.15);
  --radius: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

html {
  direction: rtl;
  unicode-bidi: embed;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: "Tajawal", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

body { min-height: 100vh; }

/* منع تشقلب الكلام عند خلط العربي مع الإنجليزي */
[dir="rtl"] .ltr-inline,
span[dir="ltr"],
.brand-en {
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

.brand-en { display: block; }

.topbar {
  background: rgba(11, 18, 32, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-ar {
  font-size: 1.65rem;
  font-weight: 800;
  margin: 0;
}

.brand-en {
  font-size: 0.8rem;
  color: var(--text-soft);
  margin: 4px 0 0;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}

.hero-card,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.hero-card {
  padding: 30px 28px;
  margin-bottom: 20px;
}

.hero-title {
  margin: 0 0 8px;
  font-size: 2.25rem;
  line-height: 1.2;
  font-weight: 800;
}

.hero-subtitle {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.1rem;
  line-height: 1.8;
}

label {
  display: block;
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 1rem;
  background: var(--bg-soft);
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
  font-family: inherit;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2338bdf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 44px;
  cursor: pointer;
}

select option {
  background: var(--card);
  color: var(--text);
}

select option:disabled {
  color: var(--muted);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 130px;
  resize: vertical;
}

.field {
  margin-bottom: 18px;
}

/* ── أيقونة إظهار/إخفاء كلمة المرور ── */
.pw-wrap { position: relative; }
.pw-wrap input { padding-left: 44px !important; }
.pw-toggle {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 4px;
  color: var(--text-soft); display: flex; align-items: center;
  transition: color .15s;
}
.pw-toggle:hover { color: var(--primary); }
.pw-toggle.visible { color: var(--primary); }

.btn {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--bg);
  padding: 18px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s ease, transform .15s ease;
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-primary {
  background: var(--primary);
  color: var(--bg);
}

.login-wrap {
  max-width: 720px;
  margin: 48px auto;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 42px 36px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header .brand-ar {
  font-size: 2.5rem;
}

.login-header .brand-en {
  font-size: 1rem;
}

.muted-link {
  text-align: center;
  color: var(--muted);
  margin-top: 18px;
  font-size: 0.95rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 20px;
}

.card {
  padding: 24px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 1.75rem;
  font-weight: 800;
}

.section-subtitle {
  margin: 0 0 18px;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.8;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.9rem;
  font-weight: 700;
}

.progress-card {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-label {
  font-weight: 700;
  font-size: 1.05rem;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-hover));
  border-radius: 999px;
}

.timeline {
  position: relative;
  margin-top: 6px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 16px;
  width: 2px;
  background: var(--line);
}

.timeline-step {
  position: relative;
  padding: 0 52px 22px 0;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.step-dot {
  position: absolute;
  right: 8px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  z-index: 1;
}

.timeline-step.done .step-dot {
  background: var(--primary);
  border-color: var(--primary);
}

.timeline-step.active .step-dot {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 5px var(--primary-soft);
}

.step-title {
  margin: 0 0 5px;
  font-size: 1.05rem;
  font-weight: 800;
}

.step-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.note-box {
  margin-top: 18px;
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.note-box h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.note-box p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.9;
}

.wizard-wrap {
  max-width: 980px;
  margin: 0 auto;
}

.wizard-stepper {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 14px 0 22px;
}

.wizard-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.wizard-chip.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.wizard-chip.done {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

a.wizard-chip {
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}

a.wizard-chip.done:hover {
  background: rgba(34, 197, 94, 0.28);
  color: #86efac;
  transform: translateY(-1px);
}

/* آخر خطوة وصل إليها (غير مكتملة لكن قابلة للنقر) */
a.wizard-chip:not(.done):hover {
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-soft);
  transform: translateY(-1px);
}

.wizard-grid {
  display: block;
}

.wizard-grid aside {
  display: none;
}

.actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.mini-card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.mini-card + .mini-card {
  margin-top: 14px;
}

.mini-card h4 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.mini-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.8;
  font-size: 0.9rem;
}

.helper {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
}

.tag {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
}

.field-error {
  color: var(--error-text);
}

@media (max-width: 960px) {
  .grid-2,
  .wizard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 20px 16px 40px;
  }

  .login-card,
  .card,
  .hero-card {
    padding: 20px;
    border-radius: 18px;
  }

  .hero-title,
  .login-header .brand-ar {
    font-size: 1.9rem;
  }

  .brand-ar {
    font-size: 1.4rem;
  }

  .section-title {
    font-size: 1.4rem;
  }

  .actions-row {
    grid-template-columns: 1fr;
  }
}
