/* Intake form styles, shared by intake_form.php and consent_sign.php (consent part 2).
   Moved unchanged out of intake_form.php's inline style block so the one-time consent
   signing page looks exactly like the intake form it stands in for. */
    /* ── Design tokens ── */
    :root {
      --sx-deep:   #08090D;
      --sx-dark:   #0F1018;
      --sx-navy:   #1a1d3d;
      /* Spartacus's colours by default. intake_form.php and consent_sign.php
         override these four from Clinic Settings (functions/brand.php). */
      --brand: #7B2FFF; --brand-rgb: 123,47,255; --brand-2: #E040FB; --brand-2-rgb: 224,64,251;
      --sx-indigo: var(--brand-2);
      --sx-brand:  var(--brand);
      --sx-silver: #9ca3af;
      --sx-light:  #f8faff;
      --sx-ease:   cubic-bezier(0.4, 0, 0.2, 1);
    }
    *, *::before, *::after { box-sizing: border-box; }
    html { scroll-behavior: smooth; margin: 0; padding: 0; background: var(--sx-deep); }
    body {
      font-family: 'Roboto', sans-serif;
      background: transparent;
      margin: 0 !important; padding: 0;
      overflow-x: hidden;
    }
    a { text-decoration: none !important; }

    /* ── NAVBAR ───────────────────────────── */
    .sx-nav {
      position: fixed; top: 0; left: 0; right: 0; z-index: 1050;
      display: flex; align-items: center;
      padding: 16px 32px;
      transition: background 0.4s var(--sx-ease), padding 0.4s var(--sx-ease), box-shadow 0.4s var(--sx-ease);
    }
    .sx-nav.scrolled {
      background: rgba(7,10,20,0.96);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      padding: 10px 32px;
      box-shadow: 0 2px 40px rgba(0,0,0,0.5);
    }
    .sx-nav-brand {
      display: flex; align-items: center; gap: 10px;
      color: #fff !important; font-weight: 700; font-size: 15px; flex-shrink: 0;
      margin-right: 28px;
    }
    .sx-nav-brand img {
      width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
      border: 2px solid rgba(255,255,255,0.25); flex-shrink: 0;
    }
    .sx-nav-brand-name { display: none; }
    @media (min-width: 1100px) { .sx-nav-brand-name { display: block; } }
    .sx-nav-links { display: none; flex: 1; align-items: center; gap: 2px; }
    @media (min-width: 900px) { .sx-nav-links { display: flex; } }
    .sx-nav-links a {
      color: rgba(255,255,255,0.75) !important; font-size: 13px; font-weight: 500;
      padding: 6px 12px; border-radius: 8px;
      transition: color 0.2s, background 0.2s; white-space: nowrap;
    }
    .sx-nav-links a:hover { color: #fff !important; background: rgba(255,255,255,0.1); }
    .sx-nav-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
    .sx-nav-btn {
      font-size: 12px; font-weight: 600; padding: 7px 16px;
      border-radius: 8px; transition: all 0.2s; white-space: nowrap;
    }
    .sx-nav-btn-ghost {
      color: rgba(255,255,255,0.85) !important;
      border: 1px solid rgba(255,255,255,0.25);
    }
    .sx-nav-btn-ghost:hover { background: rgba(255,255,255,0.1); color: #fff !important; }
    .sx-nav-btn-solid {
      background: var(--sx-brand); color: #fff !important;
      border: 1px solid var(--sx-brand);
    }
    .sx-nav-btn-solid:hover { background: var(--sx-indigo); border-color: var(--sx-indigo); }
    .sx-hamburger {
      display: flex; align-items: center; justify-content: center;
      width: 36px; height: 36px; border: 1px solid rgba(255,255,255,0.25);
      border-radius: 8px; background: none; color: #fff; font-size: 15px; cursor: pointer;
    }
    @media (min-width: 900px) { .sx-hamburger { display: none; } }
    /* Mobile drawer */
    .sx-drawer {
      display: none; position: fixed; inset: 0; z-index: 1200;
      background: rgba(7,10,20,0.98);
      flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    }
    .sx-drawer.open { display: flex; }
    .sx-drawer a {
      color: rgba(255,255,255,0.85) !important; font-size: 18px; font-weight: 600;
      padding: 10px 36px; border-radius: 10px; transition: background 0.2s;
    }
    .sx-drawer a:hover { background: rgba(255,255,255,0.08); }
    .sx-drawer-close {
      position: absolute; top: 18px; right: 24px;
      background: none; border: none; color: #fff; font-size: 26px; cursor: pointer;
    }

    /* ── Hero ── */
    .sx-intake-hero {
      background: linear-gradient(145deg, #08090D 0%, #0F1018 52%, #1a1d3d 100%);
      position: relative; overflow: hidden;
      padding: 100px 24px 52px;
      text-align: center;
    }
    .sx-intake-orb {
      position: absolute; border-radius: 50%;
      filter: blur(90px); pointer-events: none;
    }
    .sx-intake-orb-1 {
      width: 340px; height: 340px;
      background: radial-gradient(circle, rgba(var(--brand-2-rgb),0.5) 0%, transparent 70%);
      top: -100px; left: -60px;
      animation: aqOrb1 22s ease-in-out infinite;
    }
    .sx-intake-orb-2 {
      width: 260px; height: 260px;
      background: radial-gradient(circle, rgba(var(--brand-rgb),0.38) 0%, transparent 70%);
      bottom: -40px; right: -40px;
      animation: aqOrb2 26s ease-in-out infinite;
    }
    @keyframes aqOrb1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(40px,50px) scale(1.12)} }
    @keyframes aqOrb2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-30px,-40px) scale(1.18)} }
    @keyframes aqFloat { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-14px)} }

    .sx-intake-bearer {
      width: 144px; height: 144px; object-fit: cover;
      border-radius: 50%;
      padding: 4px; background: #fff;
      border: 1px solid rgba(255,255,255,0.55);
      box-shadow: 0 0 0 3px rgba(var(--brand-rgb),0.35), 0 8px 36px rgba(var(--brand-rgb),0.5), 0 4px 16px rgba(0,0,0,0.3);
      animation: aqFloat 7s ease-in-out infinite;
      position: relative; z-index: 2;
      margin-bottom: 18px;
    }
    .sx-intake-hero-title {
      font-size: 28px; font-weight: 700; color: #fff;
      position: relative; z-index: 2; margin-bottom: 8px;
    }
    .sx-intake-hero-sub {
      font-size: 14px; color: rgba(255,255,255,0.6);
      position: relative; z-index: 2; max-width: 560px; margin: 0 auto;
      line-height: 1.6;
    }

    /* ── Progress strip ── */
    .sx-progress-strip {
      position: sticky; top: 70px; z-index: 99;
      background: #fff;
      border-bottom: 2px solid #e5e7eb;
      box-shadow: 0 2px 12px rgba(0,0,0,0.06);
      overflow-x: auto;
      display: flex; justify-content: center;
    }
    .sx-progress-inner {
      display: flex; align-items: stretch;
      min-width: max-content;
      padding: 0 8px;
    }
    .sx-ps-step {
      display: flex; flex-direction: column; align-items: center;
      justify-content: center;
      padding: 10px 14px; gap: 3px;
      cursor: pointer; text-decoration: none !important;
      border-bottom: 3px solid transparent;
      transition: border-color 0.2s, background 0.2s;
      white-space: nowrap;
    }
    .sx-ps-step:hover { background: var(--sx-light); }
    .sx-ps-step.active { border-bottom-color: var(--sx-indigo); }
    .sx-ps-num {
      width: 26px; height: 26px; border-radius: 50%;
      background: #e5e7eb; color: #6b7280;
      font-size: 11px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      transition: background 0.2s, color 0.2s;
    }
    .sx-ps-step.active .sx-ps-num { background: var(--sx-indigo); color: #fff; }
    .sx-ps-label {
      font-size: 11px; font-weight: 600; color: #9ca3af;
      transition: color 0.2s;
    }
    .sx-ps-step.active .sx-ps-label { color: var(--sx-indigo); }

    /* ── Main content ── */
    .sx-intake-main { padding: 32px 0 60px; background: var(--sx-light); }

    /* ── Section card ── */
    .sx-section-card {
      background: #fff;
      border-radius: 16px;
      box-shadow: 0 2px 20px rgba(0,0,0,0.07);
      padding: 28px 32px 32px;
      margin-bottom: 24px;
    }
    .sx-section-header {
      display: flex; align-items: center; gap: 14px;
      margin-bottom: 18px; padding-bottom: 16px;
      border-bottom: 2px solid var(--sx-light);
    }
    .sx-section-num {
      width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
      background: linear-gradient(135deg, var(--sx-indigo) 0%, var(--sx-brand) 100%);
      color: #fff; font-size: 15px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      font-style: italic;
    }
    .sx-section-title {
      font-size: 17px; font-weight: 700;
      color: var(--sx-dark); margin: 0;
      text-transform: uppercase; letter-spacing: 0.5px;
    }

    /* ── Info banner ── */
    .sx-info-banner {
      background: var(--sx-light);
      border: 1px solid rgba(var(--brand-2-rgb),0.18);
      border-left: 4px solid var(--sx-indigo);
      border-radius: 10px;
      padding: 12px 16px;
      font-size: 13.5px; color: #374151;
      margin-bottom: 22px;
      line-height: 1.5;
    }
    .sx-info-banner i { color: var(--sx-indigo); margin-right: 6px; }

    /* ── Fields ── */
    .sx-field { margin-bottom: 18px; }
    .sx-field label {
      display: block; font-size: 13px; font-weight: 600;
      color: #374151; margin-bottom: 7px;
    }
    .sx-field label i { color: var(--sx-indigo); margin-right: 5px; font-size: 11px; }
    .sx-input, .sx-select {
      width: 100%; padding: 11px 14px;
      border: 1.5px solid #e5e7eb; border-radius: 10px;
      font-size: 14.5px; color: #111827;
      background: #fafbff; outline: none;
      font-family: 'Roboto', sans-serif;
      transition: border-color 0.2s, box-shadow 0.2s;
    }
    .sx-input:focus, .sx-select:focus {
      border-color: var(--sx-indigo);
      box-shadow: 0 0 0 3px rgba(var(--brand-2-rgb),0.1);
      background: #fff;
    }
    .sx-select { cursor: pointer; -webkit-appearance: none; appearance: none;
      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 d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
      background-repeat: no-repeat; background-position: right 14px center;
      padding-right: 36px;
    }

    /* ── Validation ── */
    .validation-error-highlight {
      border: 2px solid #f44336 !important;
      border-radius: 10px !important;
      background-color: rgba(244,67,54,0.05) !important;
      animation: valShake 0.42s ease;
    }
    @keyframes valShake {
      0%,100%{transform:translateX(0)}
      20%{transform:translateX(-5px)}
      40%{transform:translateX(5px)}
      60%{transform:translateX(-3px)}
      80%{transform:translateX(3px)}
    }
    .validation-error-label {
      display: block; color: #f44336;
      font-size: 12px; margin-top: 4px;
    }
    .sx-input.validation-error-highlight,
    .sx-select.validation-error-highlight {
      border: 2px solid #f44336 !important;
    }

    /* ── Checkbox pills ── */
    .sx-check-pill-wrap {
      display: flex; flex-wrap: wrap; gap: 10px;
      padding: 4px 0;
    }
    .sx-check-pill { position: relative; }
    .sx-check-pill input[type="checkbox"] {
      position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
    }
    .sx-check-pill input[type="checkbox"] + label {
      display: inline-flex; align-items: center; gap: 7px;
      padding: 8px 16px;
      border: 1.5px solid #e5e7eb; border-radius: 20px;
      font-size: 13px; font-weight: 500; color: #6b7280;
      cursor: pointer; user-select: none;
      background: #fafbff;
      transition: all 0.15s;
    }
    .sx-check-pill input[type="checkbox"] + label::before {
      content: "\f111"; font-family: "Font Awesome 5 Free";
      font-weight: 400; font-size: 11px;
      transition: all 0.15s;
    }
    .sx-check-pill input[type="checkbox"]:checked + label {
      background: var(--sx-indigo); border-color: var(--sx-indigo); color: #fff;
    }
    .sx-check-pill input[type="checkbox"]:checked + label::before {
      content: "\f058"; font-weight: 900;
    }

    /* ── Health history grid & pills ── */
    .sx-hx-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
    }
    @media (max-width: 900px) { .sx-hx-grid { grid-template-columns: repeat(2, 1fr); } }
    @media (max-width: 580px) { .sx-hx-grid { grid-template-columns: 1fr; } }

    .sx-hx-item {
      background: #fafbff;
      border: 1.5px solid #e5e7eb;
      border-radius: 10px;
      padding: 11px 13px;
      transition: border-color 0.2s;
    }
    .sx-hx-item.validation-error-highlight {
      border-color: #f44336 !important;
      background: rgba(244,67,54,0.04) !important;
      animation: valShake 0.42s ease;
    }
    .sx-hx-label {
      display: block; font-size: 12.5px; font-weight: 600;
      color: #374151; margin-bottom: 9px; line-height: 1.3;
    }
    .sx-hx-pills {
      display: flex; gap: 5px;
    }
    .sx-hx-pills input[type="radio"] {
      position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
    }
    .sx-hx-pills input[type="radio"] + label {
      flex: 1; text-align: center; padding: 5px 3px;
      border: 1.5px solid #e5e7eb; border-radius: 7px;
      font-size: 11.5px; font-weight: 700; color: #9ca3af;
      cursor: pointer; transition: all 0.15s; user-select: none;
    }
    .sx-hx-pills input[type="radio"] + label:hover { border-color: var(--sx-indigo); color: var(--sx-indigo); }
    /* Never = indigo */
    .sx-hx-pills .sx-pill-z:checked + label { background: var(--sx-indigo); border-color: var(--sx-indigo); color: #fff; }
    /* Current = red */
    .sx-hx-pills .sx-pill-c:checked + label { background: #DC2626; border-color: #DC2626; color: #fff; }
    /* Past = slate */
    .sx-hx-pills .sx-pill-x:checked + label { background: #6B7280; border-color: #6B7280; color: #fff; }

    /* ── Social history table ── */
    .sx-social-row {
      display: flex; align-items: center; gap: 16px;
      padding: 12px 0;
      border-bottom: 1px solid #f3f4f6;
    }
    .sx-social-row:last-child { border-bottom: none; }
    .sx-social-label {
      flex: 1; font-size: 14px; font-weight: 600; color: #374151;
    }
    .sx-yn-pills { display: flex; gap: 8px; }
    .sx-yn-pill { position: relative; }
    .sx-yn-pill input[type="checkbox"] {
      position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0;
    }
    .sx-yn-pill input[type="checkbox"] + label {
      display: inline-block; padding: 6px 18px;
      border: 1.5px solid #e5e7eb; border-radius: 8px;
      font-size: 13px; font-weight: 700; color: #9ca3af;
      cursor: pointer; transition: all 0.15s; user-select: none;
    }
    .sx-yn-yes input[type="checkbox"]:checked + label { background: #10B981; border-color: #10B981; color: #fff; }
    .sx-yn-no  input[type="checkbox"]:checked + label { background: #EF4444; border-color: #EF4444; color: #fff; }

    /* ── Immunization selects ── */
    .sx-immu-grid {
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 16px;
    }
    @media (max-width: 600px) { .sx-immu-grid { grid-template-columns: 1fr; } }
    .sx-immu-group { }
    .sx-immu-label {
      font-size: 12px; font-weight: 700; color: var(--sx-indigo);
      text-transform: uppercase; letter-spacing: 0.5px;
      margin-bottom: 10px; display: block;
    }

    /* ── Drug allergy layout ── */
    .sx-allergy-wrap {
      display: grid; grid-template-columns: auto 1fr;
      gap: 20px; align-items: start;
    }
    @media (max-width: 640px) { .sx-allergy-wrap { grid-template-columns: 1fr; } }
    .sx-allergy-yn { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
    .sx-allergy-drugs { display: flex; flex-direction: column; gap: 10px; }

    /* ── Consent text ── */
    .sx-consent-text {
      background: var(--sx-light);
      border: 1px solid #e5e7eb;
      border-radius: 12px;
      padding: 20px 24px;
      font-size: 13.5px; color: #374151;
      line-height: 1.7; margin-bottom: 22px;
      max-height: 340px; overflow-y: auto;
    }
    .sx-consent-text p { margin-bottom: 12px; }
    .sx-consent-text p:last-child { margin-bottom: 0; }

    /* ── Signature area ── */
    .sx-sig-wrap {
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 20px; align-items: center;
    }
    @media (max-width: 640px) { .sx-sig-wrap { grid-template-columns: 1fr; } }
    .sx-sig-ack-label {
      font-size: 13.5px; color: #374151; font-weight: 500; line-height: 1.4;
      display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
    }
    .sx-sig-ack-label input[type="checkbox"] {
      /* Override MDB's global native-checkbox hiding */
      position: static !important;
      display: inline-block !important;
      opacity: 1 !important;
      pointer-events: auto !important;
      width: 18px !important; height: 18px !important;
      flex-shrink: 0; margin-top: 2px; cursor: pointer;
      accent-color: var(--sx-indigo);
    }

    /* ── Submit ── */
    .sx-submit-wrap {
      text-align: center; padding: 24px 0 8px;
    }
    .sx-intake-submit {
      padding: 14px 48px;
      background: linear-gradient(135deg, var(--sx-indigo) 0%, var(--sx-brand) 100%);
      color: #fff; border: none; border-radius: 12px;
      font-size: 16px; font-weight: 700;
      font-family: 'Roboto', sans-serif; letter-spacing: 0.3px;
      cursor: pointer; transition: opacity 0.2s, transform 0.15s;
    }
    .sx-intake-submit:hover { opacity: 0.9; transform: translateY(-2px); }

    .sx-submit-note {
      font-size: 12.5px; color: #9ca3af; margin-top: 14px; line-height: 1.5;
    }

    /* ── Back to top FAB ── */
    #btnTop {
      display: none;
      position: fixed; bottom: 45px; right: 24px; z-index: 500;
    }
    #btnTop a {
      display: flex; align-items: center; justify-content: center;
      width: 46px; height: 46px; border-radius: 50%;
      background: var(--sx-indigo) !important;
      color: #fff !important;
      font-size: 16px; text-decoration: none !important;
      box-shadow: 0 4px 20px rgba(var(--brand-2-rgb),0.45);
      transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    }
    #btnTop a:hover {
      background: var(--sx-brand) !important;
      transform: translateY(-3px);
      box-shadow: 0 6px 28px rgba(var(--brand-rgb),0.6);
    }

    /* ── Responsive ── */
    @media (max-width: 767px) {
      .sx-section-card { padding: 20px 16px 24px; }
      .sx-intake-hero { padding: 84px 16px 38px; }
      .sx-intake-hero-title { font-size: 22px; }
    }
