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

/* ===== Design Tokens ===== */
:root {
  --navy:        #0f172a;
  --navy-mid:    #1e293b;
  --blue:        #2563eb;
  --blue-light:  #3b82f6;
  --blue-dim:    rgba(37,99,235,.12);
  --bg:          #ffffff;
  --bg-alt:      #f8fafc;
  --text:        #0f172a;
  --text-muted:  #64748b;
  --border:      #e2e8f0;
  --green:       #16a34a;
  --green-dim:   rgba(22,163,74,.1);
  --amber:       #d97706;
  --amber-dim:   rgba(217,119,6,.1);
  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 16px rgba(0,0,0,.08);
  --shadow-md:   0 8px 32px rgba(0,0,0,.10);
  --max-width:   1100px;
  --font-en:     'Inter', system-ui, sans-serif;
  --font-ar:     'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-en);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
[lang="ar"] body { font-family: var(--font-ar); }
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ===== Layout ===== */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.75rem; }
section { padding: 6rem 0; }
section:nth-child(even) { background: var(--bg-alt); }

/* ===== Nav ===== */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; }
.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.logo-icon svg { width: 18px; height: 18px; }
.logo span { color: var(--blue); }
[lang="ar"] .logo { letter-spacing: 0; }
.lang-switch {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  border-radius: 100px;
  padding: 0.35rem 1rem;
  transition: background .18s, color .18s;
}
.lang-switch:hover { background: var(--blue); color: white; }

/* ===== Hero ===== */
#hero {
  position: relative;
  background: var(--navy);
  color: white;
  text-align: center;
  padding: 8rem 0 7rem;
  overflow: hidden;
}
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% -10%, rgba(37,99,235,.5) 0%, transparent 65%),
    radial-gradient(ellipse 40% 30% at 85% 110%, rgba(59,130,246,.2) 0%, transparent 60%);
}
#hero .container { position: relative; }

.hero-eyebrow {
  display: inline-block;
  background: rgba(59,130,246,.15);
  border: 1px solid rgba(59,130,246,.3);
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.35rem 1rem;
  border-radius: 100px;
  margin-bottom: 1.75rem;
}
[lang="ar"] .hero-eyebrow { letter-spacing: 0; font-size: 0.85rem; }

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}
[lang="ar"] .hero-title { letter-spacing: 0; line-height: 1.3; }

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.18rem);
  opacity: 0.72;
  max-width: 580px;
  margin: 0 auto 2.5rem;
  line-height: 1.8;
}

.hero-cta-group { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  background: var(--blue);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 2.25rem;
  border-radius: 100px;
  transition: background .18s, transform .18s, box-shadow .18s;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
}
.btn-primary:hover {
  background: var(--blue-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(37,99,235,.5);
}

.hero-note { margin-top: 1.5rem; font-size: 0.82rem; opacity: 0.45; }

/* ===== Trust Bar ===== */
#trust {
  background: var(--navy-mid);
  padding: 1.5rem 0;
}
.trust-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255,255,255,.65);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}
.trust-item svg { opacity: 0.7; flex-shrink: 0; }
.trust-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,.15);
}
@media (max-width: 640px) { .trust-divider { display: none; } }

/* ===== Section headings ===== */
.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.75rem;
}
[lang="ar"] .section-label { letter-spacing: 0; font-size: 0.82rem; }

.section-title {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--navy);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
[lang="ar"] .section-title { letter-spacing: 0; }

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 540px;
  margin-bottom: 3.5rem;
  margin-inline: auto;
  line-height: 1.75;
}

#problem .section-label,
#problem .section-title,
#problem .section-subtitle { display: block; text-align: center; }

/* ===== Problem Cards ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
.card {
  background: white;
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.card-icon { font-size: 2.1rem; margin-bottom: 1.25rem; line-height: 1; }
.card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.6rem; color: var(--navy); }
.card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }

/* ===== Solution ===== */
#solution { text-align: center; }
.solution-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  text-align: start;
}
.solution-item {
  background: white;
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  transition: box-shadow .2s;
}
.solution-item:hover { box-shadow: var(--shadow); }
.solution-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--blue-dim);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.solution-item strong { display: block; font-size: 0.975rem; font-weight: 700; color: var(--navy); margin-bottom: 0.4rem; }
.solution-item p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.65; }

/* ===== How It Works ===== */
#how { text-align: center; }
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
  text-align: center;
  position: relative;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.step-number {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  flex-shrink: 0;
}
.step h3 { font-size: 1rem; font-weight: 700; color: var(--navy); }
.step p { font-size: 0.88rem; color: var(--text-muted); line-height: 1.65; max-width: 220px; margin: 0 auto; }

/* ===== App Preview ===== */
#preview {
  background: var(--navy);
  color: white;
  text-align: center;
  overflow: hidden;
}
#preview .section-title { color: white; }
#preview .section-subtitle { color: rgba(255,255,255,.6); }

.app-window {
  max-width: 820px;
  margin: 0 auto;
  background: #1e293b;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  overflow: hidden;
  text-align: start;
}
.app-titlebar {
  background: #0f172a;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  direction: ltr;
}
.app-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
}
.app-dot:nth-child(1) { background: #ef4444; }
.app-dot:nth-child(2) { background: #f59e0b; }
.app-dot:nth-child(3) { background: #22c55e; }
.app-titlebar-title {
  margin-left: 0.75rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,.4);
  font-family: var(--font-en);
}


.app-body { padding: 1.5rem; }
.app-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.app-toolbar-title { font-size: 0.9rem; font-weight: 700; color: white; }
.app-btn {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--blue);
  color: white;
  border-radius: 100px;
  padding: 0.4rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.app-table { width: 100%; border-collapse: collapse; }
.app-table th {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: start;
}
[lang="ar"] .app-table th { letter-spacing: 0; }
.app-table td {
  font-size: 0.8rem;
  color: rgba(255,255,255,.75);
  padding: 0.75rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.app-table tr:last-child td { border-bottom: none; }
.app-table tr:hover td { background: rgba(255,255,255,.03); }
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}
.badge-green { background: var(--green-dim); color: #4ade80; }
.badge-amber { background: var(--amber-dim); color: #fbbf24; }
.badge-blue  { background: var(--blue-dim);  color: #93c5fd; }

/* ===== FAQ ===== */
#faq { text-align: center; }
.faq-list {
  max-width: 680px;
  margin: 0 auto;
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
details {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
details[open] { box-shadow: var(--shadow); }
summary {
  padding: 1.1rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
.summary-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--blue-dim);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  transition: transform .2s;
}
details[open] .summary-icon { transform: rotate(45deg); }
.faq-answer {
  padding: 0 1.5rem 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* ===== Waitlist Form ===== */
#waitlist { text-align: center; }
.form-card {
  max-width: 460px;
  margin: 0 auto;
  background: white;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  text-align: start;
}
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-weight: 600; font-size: 0.875rem; margin-bottom: 0.45rem; color: var(--text); }
.form-group input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-en);
  color: var(--text);
  background: var(--bg-alt);
  transition: border-color .18s, box-shadow .18s;
}
[lang="ar"] .form-group input { font-family: var(--font-ar); }
.form-group input::placeholder { color: #94a3b8; }
.form-group input:focus {
  outline: none;
  border-color: var(--blue);
  background: white;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-submit {
  width: 100%;
  padding: 0.9rem;
  background: var(--blue);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--font-en);
  transition: background .18s, transform .18s;
  margin-top: 0.5rem;
}
[lang="ar"] .form-submit { font-family: var(--font-ar); }
.form-submit:hover { background: var(--blue-light); transform: translateY(-1px); }
.form-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.success-message { font-size: 1.1rem; color: var(--blue); font-weight: 600; padding: 2rem 1rem; text-align: center; }
#form-status { min-height: 1.25rem; }
.error-message { color: #dc2626; font-size: 0.85rem; margin-top: 0.4rem; }

/* ===== Focus ===== */
.btn-primary:focus-visible,
.lang-switch:focus-visible,
.form-submit:focus-visible {
  outline: 3px solid var(--blue-light);
  outline-offset: 3px;
}

/* ===== Footer ===== */
footer {
  background: var(--navy);
  color: rgba(255,255,255,.5);
  padding: 3rem 0 2.5rem;
  font-size: 0.875rem;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  font-size: 1rem;
}
.footer-brand .logo-icon { width: 28px; height: 28px; }
.footer-brand .logo-icon svg { width: 14px; height: 14px; }
.footer-contact a {
  color: rgba(255,255,255,.55);
  font-size: 0.85rem;
  transition: color .18s;
}
.footer-contact a:hover { color: white; }
.footer-copy { color: rgba(255,255,255,.3); font-size: 0.8rem; }

/* ===== RTL ===== */
/* Native browser dir="rtl" handles direction and alignments perfectly. 
   Removing double-reversing overrides to prevent layout mirroring bugs. */
[lang="ar"] .app-table td:nth-child(1),
[lang="ar"] .app-table td:nth-child(4) {
  direction: ltr;
  text-align: right;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  section { padding: 4rem 0; }
  #hero { padding: 5rem 0 4rem; }
  .cards, .solution-grid, .steps { grid-template-columns: 1fr; }
  .form-card { padding: 2rem 1.25rem; }
  .footer-inner { flex-direction: column; text-align: center; }
  [dir="rtl"] .footer-inner { flex-direction: column; }
  .app-table th:nth-child(3),
  .app-table td:nth-child(3) { display: none; }
}
