/* ===== Variables ===== */
:root {
  --bg-deep: #0a1628;
  --bg-mid: #0f2b5b;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --gold: #fbbf24;
  --gold-soft: rgba(251, 191, 36, 0.15);
  --surface: rgba(255, 255, 255, 0.07);
  --surface-hover: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --error: #f87171;
  --success: #34d399;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  --font: 'Tajawal', system-ui, sans-serif;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===== Background ===== */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(145deg, var(--bg-deep) 0%, var(--bg-mid) 45%, #1a3a6e 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: float 12s ease-in-out infinite;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: var(--accent);
  top: -120px;
  right: -80px;
}

.orb-2 {
  width: 320px;
  height: 320px;
  background: #6366f1;
  bottom: 10%;
  left: -100px;
  animation-delay: -4s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: var(--gold);
  top: 40%;
  left: 30%;
  opacity: 0.25;
  animation-delay: -8s;
}

.grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black, transparent);
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.05); }
}

/* ===== Layout ===== */
.site-header,
.main-content,
.site-footer {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 32px);
}

.site-header {
  padding-top: clamp(32px, 6vw, 56px);
  padding-bottom: 28px;
  text-align: center;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 16px;
}

.brand-logo {
  width: clamp(140px, 32vw, 200px);
  height: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
}

.brand-name {
  font-size: clamp(1.75rem, 6vw, 2.75rem);
  font-weight: 800;
  line-height: 1.25;
  color: var(--text);
  max-width: 18ch;
}

.brand-subtitle {
  font-size: clamp(1.2rem, 3.5vw, 1.65rem);
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
}

.header-desc {
  color: var(--text-muted);
  font-size: clamp(1rem, 2.8vw, 1.2rem);
  max-width: 560px;
  margin-inline: auto;
  line-height: 1.7;
}

.main-content {
  padding-bottom: 32px;
}

/* ===== Form Card ===== */
.form-card,
.success-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 40px);
  box-shadow: var(--shadow);
  animation: slideUp 0.6s ease both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Progress ===== */
.progress-wrap {
  margin-bottom: 28px;
}

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  width: 33.33%;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  border-radius: 99px;
  transition: width var(--transition);
}

.steps-indicator {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.step-dot {
  flex: 1;
  text-align: center;
  opacity: 0.45;
  transition: opacity var(--transition);
}

.step-dot.active,
.step-dot.done {
  opacity: 1;
}

.step-dot span {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 2px solid var(--border);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 6px;
  transition: all var(--transition);
}

.step-dot.active span {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}

.step-dot.done span {
  background: var(--success);
  border-color: var(--success);
}

.step-dot small {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ===== Form Steps ===== */
.form-step {
  display: none;
  animation: fadeStep 0.4s ease both;
}

.form-step.active {
  display: block;
}

@keyframes fadeStep {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.step-title {
  font-size: clamp(1.35rem, 3vw, 1.65rem);
  font-weight: 700;
  margin-bottom: 6px;
}

.step-subtitle {
  color: var(--text-muted);
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  margin-bottom: 28px;
}

/* ===== Fields ===== */
.field {
  margin-bottom: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: block;
  font-weight: 500;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  margin-bottom: 10px;
}

.req {
  color: var(--error);
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.25);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: clamp(1.05rem, 2.5vw, 1.15rem);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(0, 0, 0, 0.35);
}

input::placeholder,
textarea::placeholder {
  color: rgba(148, 163, 184, 0.6);
}

input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2);
}

.field select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;
  padding-left: 40px;
}

.field-error {
  display: block;
  color: var(--error);
  font-size: 0.8rem;
  margin-top: 6px;
  min-height: 1.2em;
}

.submit-error {
  text-align: center;
  font-size: 0.95rem;
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: var(--radius-sm);
}

.field-hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 6px;
}

.recaptcha-box {
  margin: 20px 0 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.recaptcha-label {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
}

#recaptchaContainer {
  display: flex;
  justify-content: center;
}

.recaptcha-loading {
  margin: 0 0 10px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.field-error[data-for="recaptcha"] {
  text-align: center;
  margin-top: 10px;
}

/* ===== Type Cards ===== */
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.type-card {
  position: relative;
  cursor: pointer;
  margin-bottom: 0;
}

.type-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-card > span:not(.type-icon):not(.type-label) {
  display: none;
}

.type-card .type-icon,
.type-card .type-label {
  display: block;
}

.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-align: center;
}

.type-card:hover {
  background: var(--surface-hover);
  border-color: rgba(255,255,255,0.2);
}

.type-card input:checked + .type-icon {
  transform: scale(1.15);
}

.type-card:has(input:checked) {
  border-color: var(--accent-light);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 20px var(--accent-glow);
}

.type-icon {
  font-size: 2rem;
  transition: transform var(--transition);
}

.type-label {
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  font-weight: 500;
}

/* ===== Phone Input ===== */
.phone-input {
  display: flex;
  gap: 8px;
}

.phone-input select {
  flex: 0 0 auto;
  width: auto;
  min-width: 110px;
  padding-inline: 10px;
  cursor: pointer;
}

.phone-input input {
  flex: 1;
  min-width: 0;
}

/* ===== Review ===== */
.review-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 20px;
}

.review-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
}

.review-item:last-child {
  border-bottom: none;
}

.review-item strong {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.review-item span {
  text-align: left;
  word-break: break-word;
}

/* ===== Consent ===== */
.consent-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 14px;
  background: var(--gold-soft);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.consent-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.consent-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--gold);
  border-radius: 6px;
  margin-top: 2px;
  transition: all var(--transition);
  position: relative;
}

.consent-box input:checked ~ .consent-check {
  background: var(--gold);
}

.consent-box input:checked ~ .consent-check::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='%230a1628' d='M1 5l3.5 3.5L11 1'/%3E%3C/svg%3E") center/contain no-repeat;
}

.consent-text {
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  line-height: 1.6;
}

/* ===== Buttons ===== */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.btn {
  font-family: var(--font);
  font-size: clamp(1.05rem, 2.5vw, 1.15rem);
  font-weight: 700;
  padding: 16px 32px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: white;
  box-shadow: 0 8px 24px var(--accent-glow);
  margin-right: auto;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-loader {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Success ===== */
.success-card {
  text-align: center;
  padding: clamp(32px, 6vw, 48px) clamp(20px, 5vw, 32px);
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.success-circle {
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: strokeCircle 0.6s ease forwards;
}

.success-check {
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: strokeCheck 0.4s 0.5s ease forwards;
}

@keyframes strokeCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes strokeCheck {
  to { stroke-dashoffset: 0; }
}

.success-card h2 {
  font-size: clamp(1.6rem, 4vw, 2rem);
  margin-bottom: 10px;
}

.success-card > p {
  color: var(--text-muted);
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  margin-bottom: 24px;
}

.success-details {
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 24px;
  text-align: right;
  font-size: 0.9rem;
}

.success-details p {
  margin-bottom: 6px;
}

.success-details p:last-child {
  margin-bottom: 0;
}

/* ===== Features ===== */
.features-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
}

.feature-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.feature strong {
  display: block;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  margin-bottom: 4px;
}

.feature p {
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 24px 16px 32px;
  color: var(--text-muted);
  font-size: clamp(0.9rem, 2vw, 1rem);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .type-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .features-strip {
    grid-template-columns: 1fr;
  }

  .form-nav {
    flex-wrap: wrap;
  }

  .btn-primary {
    width: 100%;
    order: -1;
  }

  .btn-ghost {
    width: 100%;
  }

  .step-dot small {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  .phone-input {
    flex-direction: column;
  }

  .phone-input select {
    width: 100%;
  }
}

@media (min-width: 768px) {
  .site-header,
  .main-content,
  .site-footer {
    max-width: 960px;
  }

  .brand-name {
    max-width: none;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
