/* MediFlow Forms – Frontend v2.0 */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

.mff-wrap {
  --mff-accent:    #006D77;
  --mff-accent-lt: #83C5BE;
  --mff-bg:        #FFFFFF;
  --mff-text:      #1A1A2E;
  --mff-muted:     #6B7280;
  --mff-border:    #E5E7EB;
  --mff-surface:   #F8FAFC;
  --mff-error:     #EF4444;
  --mff-success:   #10B981;
  --mff-radius:    18px;

  font-family: 'DM Sans', sans-serif;
  max-width: 680px;
  margin: 32px auto;
  background: var(--mff-bg);
  border-radius: var(--mff-radius);
  box-shadow: 0 8px 48px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.04);
  overflow: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}
.mff-wrap * { box-sizing: border-box; }

/* RTL support */
.mff-wrap[dir="rtl"] { font-family: 'DM Sans', 'Noto Sans Arabic', sans-serif; }
.mff-wrap[dir="rtl"] .mff-btn--next svg,
.mff-wrap[dir="rtl"] .mff-btn--back svg { transform: scaleX(-1); }

/* ── Header ─────────────────────────────────── */
.mff-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--mff-border);
  background: linear-gradient(135deg, rgba(0,109,119,.03) 0%, rgba(131,197,190,.06) 100%);
}
.mff-logo-text { font-family:'Sora',sans-serif; font-size:18px; font-weight:800; }
.mff-logo-medi { color:var(--mff-text); }
.mff-logo-flow { color:var(--mff-accent); }
.mff-logo-badge { font-size:9px; font-weight:700; color:var(--mff-accent); opacity:.7; margin-left:2px; vertical-align:super; }
.mff-logo { height:32px; object-fit:contain; }
.mff-category-badge {
  font-size:10px; font-weight:700; padding:4px 10px; border-radius:20px;
  letter-spacing:.06em; text-transform:uppercase;
}
.mff-cat-dha     { background:#EBF8FF; color:#0369A1; }
.mff-cat-doh     { background:#EFF6FF; color:#1D4ED8; }
.mff-cat-moh     { background:#F0FDF4; color:#15803D; }
.mff-cat-general { background:#F5F3FF; color:#6D28D9; }

/* ── Progress ────────────────────────────────── */
.mff-progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 32px 10px;
  background: var(--mff-bg);
}
.mff-progress-track {
  flex: 1;
  height: 5px;
  background: #E5E7EB;
  border-radius: 99px;
  overflow: hidden;
}
.mff-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mff-accent), var(--mff-accent-lt));
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.mff-step-indicator {
  font-size: 11px;
  font-weight: 700;
  color: var(--mff-muted);
  white-space: nowrap;
}
.mff-step-current { color: var(--mff-accent); }

/* ── Steps ───────────────────────────────────── */
.mff-steps-container { position: relative; overflow: hidden; }

.mff-step {
  display: none;
  padding: 28px 32px 32px;
  animation: mff-slide-in .35s cubic-bezier(.4,0,.2,1) both;
}
.mff-step--active { display: block; }

@keyframes mff-slide-in {
  from { opacity:0; transform:translateX(28px); }
  to   { opacity:1; transform:translateX(0); }
}
@keyframes mff-slide-out {
  from { opacity:1; transform:translateX(0); }
  to   { opacity:0; transform:translateX(-28px); }
}

/* Step header */
.mff-step-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--mff-border);
}
.mff-step-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--mff-accent), var(--mff-accent-lt));
  color: #fff;
  display: flex; align-items:center; justify-content:center;
  flex-shrink: 0;
}
.mff-step-icon svg { width:22px; height:22px; }
.mff-step-title {
  font-family:'Sora',sans-serif; font-size:20px; font-weight:800;
  color:var(--mff-text); margin:0 0 4px; line-height:1.2;
}
.mff-step-subtitle { margin:0; font-size:13px; color:var(--mff-muted); line-height:1.5; }

/* ── Fields grid ─────────────────────────────── */
.mff-fields-grid { display:flex; flex-direction:column; gap:16px; }

.mff-field { display:flex; flex-direction:column; gap:6px; }

.mff-label {
  font-size:13px; font-weight:600; color:#374151;
  display: flex; align-items: baseline; gap: 4px;
}
.mff-required { color:var(--mff-accent); font-size:14px; line-height:1; }

/* Text inputs */
.mff-field input[type="text"],
.mff-field input[type="email"],
.mff-field input[type="tel"],
.mff-field input[type="number"],
.mff-field input[type="date"],
.mff-field textarea {
  width:100%; border:1.5px solid var(--mff-border); border-radius:10px;
  padding:12px 16px; font-size:15px; font-family:inherit;
  background:var(--mff-surface); color:var(--mff-text);
  transition:border-color .2s, box-shadow .2s, background .2s;
  outline:none; appearance:none;
}
.mff-field input:focus, .mff-field textarea:focus {
  border-color:var(--mff-accent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--mff-accent) 12%, transparent);
  background:#fff;
}
.mff-field input.mff-invalid, .mff-field textarea.mff-invalid,
.mff-field select.mff-invalid {
  border-color: var(--mff-error);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.mff-field textarea { resize:vertical; min-height:100px; }
.mff-field input[type="date"] { color:var(--mff-muted); }
.mff-field input[type="date"]:valid { color:var(--mff-text); }

/* Select */
.mff-select-wrap { position:relative; }
.mff-select-wrap::after {
  content:'▾'; position:absolute; right:14px; top:50%; transform:translateY(-50%);
  pointer-events:none; color:var(--mff-muted); font-size:13px;
}
.mff-field select {
  width:100%; border:1.5px solid var(--mff-border); border-radius:10px;
  padding:12px 38px 12px 16px; font-size:15px; font-family:inherit;
  background:var(--mff-surface); color:var(--mff-text);
  appearance:none; -webkit-appearance:none; outline:none;
  transition:border-color .2s, box-shadow .2s, background .2s; cursor:pointer;
}
.mff-field select:focus {
  border-color:var(--mff-accent);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--mff-accent) 12%, transparent);
  background:#fff;
}

/* Choices (radio/checkbox) */
.mff-choices { display:flex; flex-direction:column; gap:8px; }
.mff-choice {
  display:flex; align-items:center; gap:12px;
  padding:12px 16px; border:1.5px solid var(--mff-border);
  border-radius:10px; cursor:pointer; transition:all .2s;
  background:var(--mff-surface); user-select:none;
}
.mff-choice:hover { border-color:var(--mff-accent-lt); background:#fff; }
.mff-choice input[type="radio"],
.mff-choice input[type="checkbox"] { position:absolute; opacity:0; width:0; height:0; }

.mff-choice-indicator {
  width:20px; height:20px; border-radius:50%; border:2px solid var(--mff-border);
  flex-shrink:0; transition:all .2s; display:flex; align-items:center; justify-content:center;
  background:#fff;
}
.mff-choice-indicator--check { border-radius:5px; }

.mff-choice:has(input:checked) {
  border-color: var(--mff-accent);
  background: color-mix(in srgb, var(--mff-accent) 5%, white);
}
.mff-choice:has(input:checked) .mff-choice-indicator {
  background: var(--mff-accent);
  border-color: var(--mff-accent);
}
.mff-choice:has(input:checked) .mff-choice-indicator::after {
  content:'';
  width:8px; height:8px; border-radius:50%; background:#fff;
}
.mff-choice:has(input:checked) .mff-choice-indicator--check::after {
  content:'✓'; width:auto; height:auto; border-radius:0;
  color:#fff; font-size:11px; font-weight:800;
}
.mff-choice-label { font-size:14px; font-weight:500; color:var(--mff-text); line-height:1.4; }

/* Field error */
.mff-field-error { font-size:12px; color:var(--mff-error); font-weight:500; min-height:16px; }

/* ── Navigation ──────────────────────────────── */
.mff-step-nav {
  display:flex; align-items:center; justify-content:space-between; margin-top:28px; gap:12px;
}
.mff-btn {
  display:inline-flex; align-items:center; gap:8px;
  border:none; border-radius:12px; padding:13px 24px;
  font-size:15px; font-weight:600; cursor:pointer; font-family:inherit;
  transition:all .2s;
}
.mff-btn--next, .mff-btn--submit {
  background: var(--mff-accent);
  color: #fff;
  margin-left: auto;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--mff-accent) 30%, transparent);
}
.mff-btn--next:hover, .mff-btn--submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--mff-accent) 35%, transparent);
}
.mff-btn--back {
  background: transparent;
  color: var(--mff-muted);
  border: 1.5px solid var(--mff-border);
}
.mff-btn--back:hover { background:var(--mff-surface); color:var(--mff-text); border-color:#c4c9d4; }
.mff-btn--whatsapp {
  background: #25D366; color:#fff;
  margin-top:16px; border-radius:12px; padding:12px 24px;
  font-size:14px; font-weight:600; text-decoration:none;
  display:inline-flex; align-items:center; gap:8px;
  box-shadow:0 4px 16px rgba(37,211,102,.3);
  transition:all .2s;
}
.mff-btn--whatsapp:hover { filter:brightness(1.05); transform:translateY(-1px); }

/* ── GDPR note ───────────────────────────────── */
.mff-gdpr-note {
  margin: 0; padding: 12px 32px 18px;
  font-size: 11px; color: var(--mff-muted); line-height: 1.6;
  border-top: 1px solid var(--mff-border);
}

/* ── Success screen ──────────────────────────── */
.mff-success-screen {
  text-align: center;
  padding: 60px 40px;
  animation: mff-slide-in .4s ease both;
}
.mff-success-animation {
  width: 90px; height: 90px; margin: 0 auto 24px;
}
.mff-success-animation svg { width:100%; height:100%; }
.mff-success-circle {
  stroke-dasharray: 226;
  stroke-dashoffset: 226;
  animation: mff-draw-circle 0.6s ease forwards;
}
.mff-success-check {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: mff-draw-check 0.4s ease forwards 0.5s;
}
@keyframes mff-draw-circle { to { stroke-dashoffset:0; } }
@keyframes mff-draw-check  { to { stroke-dashoffset:0; } }
.mff-success-title   { font-family:'Sora',sans-serif; font-size:24px; font-weight:800; color:var(--mff-text); margin:0 0 10px; }
.mff-success-message { font-size:15px; color:var(--mff-muted); line-height:1.6; margin:0 0 24px; max-width:400px; margin-inline:auto; }

/* ── Loading ─────────────────────────────────── */
.mff-loading-overlay {
  position:absolute; inset:0; background:rgba(255,255,255,.85);
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  z-index:10; backdrop-filter:blur(6px);
}
.mff-spinner {
  width:40px; height:40px;
  border:3px solid var(--mff-border);
  border-top-color:var(--mff-accent);
  border-radius:50%;
  animation:mff-spin .7s linear infinite;
}
.mff-loading-overlay p { font-size:13px; color:var(--mff-muted); font-weight:600; }
@keyframes mff-spin { to { transform:rotate(360deg); } }

/* ── Error notice ────────────────────────────── */
.mff-error { color:#c0392b; font-size:13px; padding:10px 14px; background:#fdf2f2; border:1px solid #f5c6cb; border-radius:8px; }

/* ── Responsive ──────────────────────────────── */
@media (max-width:640px) {
  .mff-wrap { margin:0; border-radius:0; box-shadow:none; }
  .mff-step { padding:20px 20px 24px; }
  .mff-header { padding:14px 20px; }
  .mff-progress-wrap { padding:12px 20px 8px; }
  .mff-step-title { font-size:18px; }
  .mff-gdpr-note { padding:10px 20px 16px; }
}
