:root{
  --bg1:#f6f7fb;
  --bg2:#ffffff;
  --card:#ffffffcc;
  --line:#e7eaf3;
  --shadow: 0 20px 60px rgba(20, 30, 60, .10);
  --shadow2: 0 10px 30px rgba(20, 30, 60, .08);
  --txt:#0f172a;
  --muted:#64748b;
  --primary:#2563eb;
  --violet:#7c3aed;
  --accent:#22c55e;
  --radius:22px;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:"Cairo",system-ui,-apple-system,Segoe UI,Arial;
  color:var(--txt);
  background:
    radial-gradient(1200px 700px at 10% 10%, rgba(37,99,235,.12), transparent 55%),
    radial-gradient(1200px 700px at 90% 20%, rgba(124,58,237,.10), transparent 55%),
    radial-gradient(1200px 700px at 50% 100%, rgba(34,197,94,.10), transparent 55%),
    linear-gradient(180deg,var(--bg1),var(--bg2));
  overflow-x:hidden;
}

/* خلفية خطوط متحركة */
.bg-lines{
  position:fixed; inset:-20%;
  background:
    repeating-linear-gradient(120deg,
      rgba(15,23,42,.05) 0px,
      rgba(15,23,42,.05) 1px,
      transparent 1px,
      transparent 16px);
  transform: rotate(6deg);
  animation: drift 14s linear infinite;
  pointer-events:none;
  z-index:-2;
}
@keyframes drift{
  0%{transform:translateX(0) rotate(6deg)}
  100%{transform:translateX(180px) rotate(6deg)}
}

/* Orbs */
.orb{
  position:fixed;
  width:420px; height:420px;
  border-radius:50%;
  filter: blur(30px);
  opacity:.55;
  z-index:-1;
  pointer-events:none;
  animation: floaty 10s ease-in-out infinite;
}
.orb.o1{left:-140px; top:40px; background: radial-gradient(circle at 30% 30%, rgba(37,99,235,.35), transparent 60%);}
.orb.o2{right:-170px; top:160px; background: radial-gradient(circle at 30% 30%, rgba(124,58,237,.30), transparent 60%); animation-delay:-2.5s;}
.orb.o3{left:30%; bottom:-220px; background: radial-gradient(circle at 30% 30%, rgba(34,197,94,.28), transparent 60%); animation-delay:-5s;}
@keyframes floaty{
  0%{transform:translate(0,0) scale(1)}
  50%{transform:translate(45px,-28px) scale(1.05)}
  100%{transform:translate(0,0) scale(1)}
}

/* Layout */
.wrap{min-height:100%;display:flex;align-items:flex-start;justify-content:center;padding:18px}
.card{
  width:min(980px,100%);
  background: var(--card);
  border:1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  backdrop-filter: blur(10px);
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover{transform:translateY(-2px);box-shadow:0 26px 75px rgba(20,30,60,.14)}

/* Header Center */
.header{
  padding:18px 18px 14px;
  border-bottom:1px solid var(--line);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  text-align:center;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.80));
}
.logo-img{
  width:min(360px, 90vw);
  height:auto;
  display:block;
  border-radius:18px;
  padding:12px;
  border:1px solid var(--line);
  background:#fff;
  box-shadow: var(--shadow2);
  transition: transform .25s ease, box-shadow .25s ease;
}
.logo-img:hover{transform: translateY(-2px) scale(1.01);box-shadow:0 18px 44px rgba(20,30,60,.14)}
.header-title{font-weight:950;font-size:20px}
.header-sub{color:var(--muted);font-size:13px}

.header-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.chip{
  display:inline-flex;align-items:center;gap:8px;
  padding:10px 12px;border-radius:999px;
  border:1px solid var(--line);
  background:#fff;text-decoration:none;color:var(--txt);
  box-shadow:0 10px 22px rgba(20,30,60,.06);
  transition:.2s ease;
}
.chip i{color:var(--primary)}
.chip:hover{transform:translateY(-2px);box-shadow:0 16px 30px rgba(20,30,60,.10);border-color:rgba(37,99,235,.25)}

/* Hero */
.hero{padding:16px 18px 6px;text-align:center}
.hero h1{margin:0;font-weight:950;font-size:20px}
.hero p{margin:8px 0 0;color:var(--muted);font-size:13px;line-height:1.8}

/* Body */
.body{padding:10px 18px 18px}

/* Sections */
.section{
  margin-top:12px;
  border:1px solid var(--line);
  background:#fff;
  border-radius:18px;
  box-shadow:0 10px 26px rgba(20,30,60,.06);
  overflow:hidden;
}
.section-head{
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  display:flex;gap:12px;align-items:center;
  background:linear-gradient(180deg, rgba(37,99,235,.05), rgba(124,58,237,.03));
}
.section-icon{
  width:44px;height:44px;border-radius:14px;
  display:grid;place-items:center;
  background:linear-gradient(135deg, rgba(37,99,235,.14), rgba(124,58,237,.10));
  border:1px solid rgba(37,99,235,.12);
}
.section-head h2{margin:0;font-weight:950;font-size:15px}
.section-head span{color:var(--muted);font-size:12px}

/* Fields */
.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:12px}
@media(max-width:820px){.grid{grid-template-columns:1fr}}
.field{position:relative}
.field.full{grid-column:1/-1}

.field label{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin:0 0 8px;font-size:13px;color:var(--muted);
}
.req{
  font-size:11px;color:var(--txt);
  border:1px solid var(--line);
  padding:4px 10px;border-radius:999px;
  background:rgba(37,99,235,.06);
}

.input, .textarea, .file{
  width:100%;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  color:var(--txt);
  outline:none;
  transition: .2s ease;
  font-size:14px;
  box-shadow: 0 10px 20px rgba(20,30,60,.04);
}
.textarea{min-height:110px; resize:vertical}
.input:focus,.textarea:focus,.file:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 5px rgba(37,99,235,.12);
}
.input:hover,.textarea:hover,.file:hover{
  border-color: rgba(37,99,235,.25);
  transform: translateY(-1px);
}

.help{margin-top:8px;color:var(--muted);font-size:12px}

/* Sticky submit */
.submit-bar{
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding: 12px 12px;
  margin: 14px -18px -18px;
  z-index: 50;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:center;
}
.btn{
  flex:1;
  min-width: 220px;
  padding:12px 14px;
  border:none;
  border-radius:16px;
  cursor:pointer;
  font-weight:950;
  font-size:15px;
  transition:.22s ease;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.btn.primary{
  color:#fff;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  box-shadow: 0 16px 36px rgba(37,99,235,.18);
  position:relative;
  overflow:hidden;
}
.btn.primary::after{
  content:"";
  position:absolute; top:-40%; left:-60%;
  width:60%; height:200%;
  transform: rotate(20deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shine 2.8s ease-in-out infinite;
  opacity:.75;
}
@keyframes shine{
  0%{transform:translateX(-120%) rotate(20deg)}
  60%{transform:translateX(260%) rotate(20deg)}
  100%{transform:translateX(260%) rotate(20deg)}
}
.btn.primary:hover{transform: translateY(-2px); box-shadow: 0 22px 50px rgba(37,99,235,.22)}

.btn.secondary{
  background:#fff;
  border:1px solid var(--line);
  color:var(--txt);
  text-decoration:none;
  box-shadow: 0 12px 28px rgba(20,30,60,.08);
}
.btn.secondary:hover{
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(20,30,60,.12);
  border-color: rgba(37,99,235,.22);
}

/* Footer note + footer */
.footer-note{
  padding:12px 0 6px;
  text-align:center;
  color:var(--muted);
  font-size:12px;
}

.footer{
  padding:12px 18px 14px;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:12px;
  display:flex;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
  background:rgba(255,255,255,.75);
}

/* Motion reduction */
@media (prefers-reduced-motion: reduce){
  .bg-lines,.orb,.btn.primary::after{animation:none !important}
  *{transition:none !important}
}
.progress-wrap{
  background:#fff;border:1px solid var(--line);border-radius:16px;
  padding:12px;margin:10px 0 14px;box-shadow:0 10px 26px rgba(20,30,60,.06)
}
.progress-top{display:flex;justify-content:space-between;color:var(--muted);font-size:13px}
.progress-bar{height:10px;background:#eef2ff;border-radius:999px;overflow:hidden;margin-top:10px}
#pFill{height:100%;width:0%;background:linear-gradient(90deg,var(--primary),var(--violet));transition:.25s}
/* Steps */
.steps-bar{
  display:flex;align-items:center;gap:10px;
  margin:12px 0 16px;
  background:#fff;border:1px solid var(--line);
  border-radius:16px;padding:12px;
  box-shadow:0 10px 26px rgba(20,30,60,.06);
}
.steps-bar .step{
  display:flex;align-items:center;gap:8px;
  color:#64748b;font-weight:900;font-size:13px;
  user-select:none;
}
.steps-bar .step span{
  width:28px;height:28px;border-radius:999px;
  border:2px solid #e7eaf3;
  display:inline-flex;align-items:center;justify-content:center;
  background:#fff;
}
.steps-bar .step.active{color:#0f172a}
.steps-bar .step.active span{
  border-color:rgba(37,99,235,.35);
  background:linear-gradient(90deg,var(--primary),var(--violet));
  color:#fff;
}
.steps-bar .step.done span{
  border-color:rgba(16,185,129,.35);
  background:#10b981;color:#fff;
}
.steps-bar .line{
  flex:1;height:2px;background:#eef2ff;border-radius:999px;
}

/* Screens */
.step-screen{display:none}
.step-screen.active{display:block}

/* Legal + Signature */
.legal-box{
  border:1px solid #eef2ff;border-radius:16px;padding:12px;background:#fff;
}
.legal-title{font-weight:950}
.checkbox-row{
  display:flex;gap:10px;align-items:flex-start;
  padding:10px;border:1px solid #e7eaf3;border-radius:14px;background:#fff;
}
.checkbox-row input{margin-top:4px; accent-color: var(--primary);}
.sign-wrap{
  border:1px solid #e7eaf3;border-radius:16px;overflow:hidden;background:#fff;
}
#signPad{width:100%;height:220px;display:block;touch-action:none}
.sign-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-top:10px}
/* FIX: Steps bar يظهر أفقي */
.steps-bar{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:space-between !important;
  flex-wrap:nowrap !important;
  gap:10px !important;
  width:100% !important;
}

.steps-bar .line{
  flex:1 !important;
  height:2px !important;
  min-width:18px !important;
}

.steps-bar .step{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  gap:8px !important;
  white-space:nowrap !important;
}

/* على الموبايل: نخليه يلتف بشكل مرتب بدل عمودي */
@media (max-width: 680px){
  .steps-bar{
    flex-wrap:wrap !important;
    justify-content:center !important;
  }
  .steps-bar .line{
    display:none !important;
  }
  .steps-bar .step{
    padding:6px 10px !important;
    border:1px solid #e7eaf3 !important;
    border-radius:999px !important;
    background:#fff !important;
  }
}
/* ===== Steps Bar FIX RTL ===== */
#stepsBar{
  direction:ltr;                 /* الحل الذهبي */
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  width:100%;
  max-width:1100px;
  margin:16px auto;
}

#stepsBar .step{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  color:#64748b;
  white-space:nowrap;
}

#stepsBar .step span{
  width:30px;
  height:30px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#e5e7eb;
  color:#0f172a;
  font-weight:900;
}

#stepsBar .step.active span{
  background:linear-gradient(135deg,#2563eb,#4f46e5);
  color:#fff;
}

#stepsBar .step.done span{
  background:#10b981;
  color:#fff;
}

#stepsBar .line{
  flex:1;
  height:2px;
  background:#e5e7eb;
  margin:0 6px;
}

/* Mobile */
@media (max-width:700px){
  #stepsBar{
    flex-wrap:wrap;
    justify-content:center;
  }
  #stepsBar .line{
    display:none;
  }
}
/* Signature bigger on mobile */
#signPad{
  width:100%;
  height:220px;          /* افتراضي للديسكتوب */
  display:block;
  touch-action:none;
}

@media (max-width: 700px){
  #signPad{
    height:360px;        /* ✅ كبير للهاتف */
  }
  .sign-wrap{
    border-radius:18px;
  }
}
/* FORCE signature area height */
.sign-wrap{
  width:100% !important;
  height:auto !important;
}

#signPad{
  width:100% !important;
  height:260px !important;        /* ديسكتوب */
  display:block !important;
  touch-action:none !important;
}

@media (max-width: 700px){
  #signPad{
    height:430px !important;      /* ✅ كبير للهاتف */
  }
}
.steps-bar{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  width:100%;
  flex-wrap:nowrap;
}

/* الخطوات */
.step{
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
  font-size:14px;
}

.step span{
  width:26px;
  height:26px;
  border-radius:50%;
  background:#eef2ff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:bold;
}

/* الخط */
.line{
  flex:0.4;
  height:2px;
  min-width:10px;
  background:#eef2ff;
}

/* ✅ تحسين خاص للموبايل */
@media (max-width:600px){

  .steps-bar{
    gap:4px;
  }

  /* نخفي النص ونخلي الأرقام فقط */
  .step b{
    display:none;
  }

  .step span{
    width:22px;
    height:22px;
    font-size:12px;
  }

  .line{
    flex:1;
    min-width:14px;
  }
}
/* ====== Desktop (يبقى طبيعي) ====== */
.steps-bar{
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:space-between;
  width:100%;
  gap:10px;
  flex-wrap:nowrap;
}
.step{display:flex;align-items:center;gap:8px;white-space:nowrap;}
.step span{
  width:28px;height:28px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:#eef2ff;font-weight:800;
}
.line{flex:1;height:2px;min-width:18px;background:#eef2ff;}
.mobile-step-title{display:none;}

/* ====== Mobile only (أحلى) ====== */
@media (max-width:600px){

  /* الشريط كـ pill */
  .steps-bar{
    justify-content:center;
    gap:8px;
    padding:10px 12px;
    border-radius:16px;
    background:rgba(255,255,255,.65);
    border:1px solid rgba(0,0,0,.06);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
  }

  /* نخفي أسماء الخطوات داخل الشريط */
  .step b{display:none;}

  /* دوائر أجمل */
  .step span{
    width:34px;height:34px;
    font-size:13px;
    background:rgba(238,242,255,.9);
    border:1px solid rgba(99,102,241,.22);
    box-shadow: 0 6px 14px rgba(99,102,241,.12);
    transition:.25s;
  }

  /* تمييز الخطوة الحالية */
  .step.active span{
    background: linear-gradient(135deg, #6366f1, #22c55e);
    color:#fff;
    border-color: transparent;
    transform: scale(1.08);
    box-shadow: 0 10px 20px rgba(99,102,241,.22);
  }

  /* الخط بين الدوائر */
  .line{
    flex:1;
    min-width:16px;
    height:3px;
    border-radius:99px;
    background:rgba(0,0,0,.08);
  }

  /* عنوان الخطوة الحالية تحت الشريط */
  .mobile-step-title{
    display:block;
    text-align:center;
    margin-top:10px;
    font-weight:800;
    font-size:14px;
    color:#0f172a;
    opacity:.95;
  }
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%2394a3b8' d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 14px;
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%2394a3b8' d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 14px;
}
.top-action{
  position: fixed;
  top: 20px;
  left: 20px; /* لأن RTL */
  z-index: 1000;
}

.top-btn{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: 'Cairo', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg,#2563eb,#7c3aed);
  box-shadow: 0 10px 25px rgba(59,130,246,.35);
  transition: all .25s ease;
}

.top-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(59,130,246,.45);
}

.top-btn i{
  font-size: 14px;
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%2394a3b8' d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 14px;
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%2394a3b8' d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 14px;
}
