/* ── 1. CSS Custom Properties ── */
:root {
  --fb-primary:      #830051;
  --fb-primary-h:    #6f0045;
  --fb-bg:           #fdf8fc;
  --fb-card-bg:      rgba(255,255,255,0.8);
  --fb-border:       #ced4da;
  --fb-input-bd:     #e5e7eb;
  --fb-ring:         #8b5cf6;
  --fb-error:        #dc2626;
  --fb-gray-400:     #9ca3af;
  --fb-gray-700:     #374151;
  --fb-radius-card:  24px;
  --fb-radius-input: 12px;
  --fb-radius-btn:   9999px;
  --fb-shadow-btn:   0 4px 6px rgba(0,0,0,0.1);
  --fb-shadow-btn-h: 0 8px 15px rgba(0,0,0,0.15);
}

/* ── 2. Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  background-color: var(--fb-bg);
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--fb-gray-700);
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
}

/* ── 3. Header ── */
.fb-header {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--fb-input-bd);
  position: sticky;
  top: 0;
  z-index: 30;
}
.fb-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.fb-logo { height: 32px; width: auto; object-fit: contain; display: block; }
.fb-nav { display: flex; align-items: center; gap: 28px; }
.fb-nav-group { position: relative; }
.fb-nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: none; cursor: pointer;
  padding: 10px 16px; border-radius: 8px;
  font: 500 14px/1 'Inter', sans-serif; color: var(--fb-gray-700);
  transition: background 0.15s, color 0.15s;
}
.fb-nav-btn:hover { background: #f5f3ff; color: #4c1d95; }
.fb-nav-btn svg { transition: transform 0.2s; }
.fb-nav-group:hover .fb-nav-btn svg { transform: rotate(180deg); color: #4c1d95; }
.fb-dropdown {
  display: none; position: absolute; left: 0; top: 100%;
  padding-top: 12px; min-width: 256px; z-index: 50;
}
.fb-nav-group:hover .fb-dropdown { display: block; }
.fb-dropdown-inner {
  background: white; border: 1px solid var(--fb-input-bd);
  border-radius: 12px; box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
  padding: 8px;
}
.fb-dropdown a {
  display: block; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; color: var(--fb-gray-700); text-decoration: none;
  transition: background 0.1s, color 0.1s;
}
.fb-dropdown a:hover { background: #f5f3ff; color: #4c1d95; }
.fb-nav-cta {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fb-primary); color: white;
  border-radius: 12px; padding: 10px 16px;
  font: 600 14px/1 'Inter', sans-serif; text-decoration: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
  transition: background 0.15s, box-shadow 0.15s;
}
.fb-nav-cta:hover { background: var(--fb-primary-h); box-shadow: 0 4px 8px rgba(0,0,0,0.2); color: white; }
.fb-hamburger {
  display: none; border: 1px solid var(--fb-input-bd);
  background: white; border-radius: 8px; width: 40px; height: 40px;
  align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s;
}
.fb-hamburger:hover { background: #f9fafb; }
.fb-mobile-nav { display: none; padding: 12px 24px 16px; }
.fb-mobile-nav.open { display: block; }
.fb-mobile-group {
  border: 1px solid var(--fb-input-bd); border-radius: 8px;
  background: white; padding: 8px 12px; margin-bottom: 8px;
}
.fb-mobile-group-btn {
  width: 100%; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  font: 500 14px 'Inter', sans-serif; color: var(--fb-gray-700); padding: 4px 0;
}
.fb-mobile-submenu { display: none; margin-top: 8px; }
.fb-mobile-submenu.open { display: block; }
.fb-mobile-submenu a {
  display: block; padding: 6px 8px; border-radius: 6px;
  font-size: 14px; color: #4b5563; text-decoration: none;
  transition: background 0.1s;
}
.fb-mobile-submenu a:hover { background: #f5f3ff; color: #4c1d95; }
.fb-mobile-cta {
  display: block; width: 100%; text-align: center;
  background: var(--fb-primary); color: white; border-radius: 12px;
  padding: 12px; font: 600 14px 'Inter', sans-serif; text-decoration: none;
  margin-top: 4px;
}

/* ── 4. Step Indicator ── */
.fb-step-indicator { display: flex; align-items: stretch; margin-bottom: 40px; }
.fb-step-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding-bottom: 4px;
}
.fb-step-label {
  font: 700 18px/1.2 'Inter', sans-serif;
  color: var(--fb-gray-400);
  transition: color 0.2s;
  padding-bottom: 8px;
}
.fb-step-line {
  height: 3px; width: 100%; border-radius: 9999px;
  background: transparent; transition: background 0.2s;
}
.fb-step-tab.active .fb-step-label { color: var(--fb-primary); }
.fb-step-tab.active .fb-step-line   { background: var(--fb-primary); }

/* ── 5. Main / Card ── */
.fb-main { flex: 1; padding: 32px 16px; }
@media (min-width: 768px) { .fb-main { padding: 64px 16px; } }
.fb-card-wrap { max-width: 896px; margin: 0 auto; }
.fb-card {
  background: var(--fb-card-bg);
  backdrop-filter: blur(8px);
  border-radius: var(--fb-radius-card);
  border: 1px solid var(--fb-border);
  padding: 24px;
}
@media (min-width: 768px) { .fb-card { padding: 48px; } }

/* ── 6. Form Title ── */
.fb-form-title {
  text-align: center; margin-bottom: 40px;
}
.fb-form-title h1 {
  font: 700 32px/1.2 'Inter', sans-serif;
  color: var(--fb-primary); margin-bottom: 16px;
}
@media (min-width: 768px) { .fb-form-title h1 { font-size: 40px; } }
.fb-form-title p { color: #4b5563; font-size: 16px; margin: 0; }

/* ── 7. Step Section ── */
.fb-step { display: none; }
.fb-step.active { display: block; }
.fb-step-heading {
  font: 700 24px/1.2 'Inter', sans-serif;
  color: var(--fb-primary); text-align: center; margin-bottom: 8px;
}

/* ── 8. Inputs & Labels ── */
.fb-field { margin-bottom: 0; }
.fb-label {
  display: block; font: 500 14px 'Inter', sans-serif;
  color: var(--fb-gray-700); margin-bottom: 6px;
}
.fb-required { color: var(--fb-ring); }
.fb-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--fb-input-bd);
  border-radius: var(--fb-radius-input);
  font: 400 16px 'Inter', sans-serif;
  color: var(--fb-gray-700);
  background: white;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
.fb-input:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--fb-ring);
}
.fb-input.fb-error-state {
  border-color: var(--fb-error);
  box-shadow: 0 0 0 2px rgba(220,38,38,0.2);
}
.fb-input:disabled {
  background: #f9fafb; color: var(--fb-gray-400);
  cursor: not-allowed; opacity: 0.6;
}
.fb-input::placeholder { color: var(--fb-gray-400); }
.fb-input-icon-wrap { position: relative; }
.fb-input-icon-wrap .fb-input { padding-left: 48px; }
.fb-input-icon {
  position: absolute; left: 16px; top: 50%;
  transform: translateY(-50%); color: var(--fb-gray-400);
  pointer-events: none; width: 20px; height: 20px;
}
.fb-input-icon-right {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%); color: var(--fb-gray-400);
  cursor: pointer; background: none; border: none; padding: 0;
  display: flex; align-items: center; transition: color 0.15s;
}
.fb-input-icon-right:hover { color: var(--fb-primary); }
.fb-input.fb-input-pr { padding-right: 48px; }

/* ── 9. Select ── */
.fb-select {
  width: 100%;
  padding: 14px 40px 14px 16px;
  border: 1px solid var(--fb-input-bd);
  border-radius: var(--fb-radius-input);
  font: 400 16px 'Inter', sans-serif;
  color: var(--fb-gray-700);
  background: white url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") no-repeat right 16px center / 1.5em 1.5em;
  -webkit-appearance: none; appearance: none;
  outline: none; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fb-select:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--fb-ring);
}
.fb-select.fb-error-state {
  border-color: var(--fb-error);
  box-shadow: 0 0 0 2px rgba(220,38,38,0.2);
}
.fb-select:disabled { background-color: #f9fafb; color: var(--fb-gray-400); cursor: not-allowed; opacity: 0.6; }

/* ── 10. Error & Warn Messages ── */
.fb-error {
  display: none; color: var(--fb-error);
  font-size: 12px; font-weight: 500; margin-top: 6px; line-height: 1.4;
}
.fb-error.visible { display: block; }
.fb-warn-text {
  display: none;
  align-items: flex-start; gap: 8px;
  background: #fffbeb; border: 1px solid #fcd34d;
  color: #92400e; border-radius: 8px;
  padding: 10px 12px; margin-top: 8px;
  font-size: 12px; font-weight: 500; line-height: 1.4;
}
.fb-warn-text.visible { display: flex; }

/* ── 11. Checkboxes ── */
.fb-check-label {
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; font-size: 14px; color: var(--fb-gray-700);
  transition: color 0.15s; line-height: 1.5;
}
.fb-check-label:hover { color: #111827; }
.fb-check {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px;
  border: 1px solid #d1d5db; border-radius: 4px;
  accent-color: #7c3aed; cursor: pointer;
}
.fb-check:focus { outline: 2px solid var(--fb-ring); outline-offset: 2px; }
.fb-check-link { color: #0d6efd; text-decoration: underline; font-weight: 500; }
.fb-check-link:hover { color: #0856c7; }

/* ── 12. Section Headers & Dividers ── */
.fb-section-header {
  font: 600 14px 'Inter', sans-serif;
  color: var(--fb-gray-700);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 16px; padding-top: 16px;
}
.fb-section-header svg { width: 16px; height: 16px; }
.fb-divider { border: none; border-top: 1px solid #f3f4f6; margin: 0; }
.fb-prefs-divider { border: none; border-top: 1px solid #f3f4f6; margin: 4px 0; }

/* ── 13. Buttons ── */
.fb-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 32px; border-radius: var(--fb-radius-btn);
  background: var(--fb-primary); color: white; border: none;
  font: 500 16px 'Inter', sans-serif; cursor: pointer;
  box-shadow: var(--fb-shadow-btn);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s, color 0.15s;
  white-space: nowrap;
}
.fb-btn-primary:hover:not(:disabled) {
  background: var(--fb-primary-h);
  box-shadow: var(--fb-shadow-btn-h);
  transform: scale(1.02);
}
.fb-btn-primary:active:not(:disabled) { transform: scale(0.98); }
.fb-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.fb-btn-primary.outline {
  background: white; color: var(--fb-gray-700);
  border: 1px solid #d1d5db; box-shadow: none;
}
.fb-btn-primary.outline:hover:not(:disabled) {
  background: #f9fafb; box-shadow: none; transform: scale(1.02);
}
.fb-btn-back {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--fb-radius-btn);
  background: white; color: var(--fb-gray-700);
  border: 1px solid #d1d5db; font: 500 16px 'Inter', sans-serif;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
  text-decoration: none;
}
.fb-btn-back:hover:not(:disabled) { background: #f9fafb; transform: scale(1.02); }
.fb-btn-back:active:not(:disabled) { transform: scale(0.98); }

/* ── 14. Nav buttons row ── */
.fb-nav-buttons {
  display: flex; flex-direction: column-reverse; align-items: stretch; gap: 12px;
  margin-top: 40px; padding-top: 24px;
}
@media (min-width: 576px) {
  .fb-nav-buttons {
    flex-direction: row; align-items: center; justify-content: center;
  }
  .fb-nav-buttons .fb-btn-primary,
  .fb-nav-buttons .fb-btn-back { width: auto; }
}
.fb-nav-buttons .fb-btn-primary,
.fb-nav-buttons .fb-btn-back { width: 100%; }

/* ── 15. API Error Banner ── */
.fb-api-error {
  display: none;
  align-items: flex-start; gap: 10px;
  background: #fef2f2; border: 1px solid #fecaca;
  color: #b91c1c; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 20px; font-size: 14px; line-height: 1.5;
}
.fb-api-error.visible { display: flex; }
.fb-api-error svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.fb-api-error ul { list-style: none; padding: 0; margin: 0; }
.fb-api-error ul li + li { margin-top: 4px; }
.fb-api-error .validation-summary-errors { margin: 0; }

/* ── 16. Medication Grid ── */
.fb-med-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px; margin-top: 12px;
}
@media (min-width: 768px) { .fb-med-grid { grid-template-columns: 1fr 1fr; } }
.fb-med-card {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--fb-input-bd); border-radius: 12px;
  padding: 16px; cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.fb-med-card:hover { border-color: #c4b5fd; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.fb-med-card.selected { border-color: #8b5cf6; background: #f5f3ff; }
.fb-med-checkbox {
  width: 20px; height: 20px; accent-color: #7c3aed; flex-shrink: 0; cursor: pointer;
}
.fb-med-card span { font: 500 14px 'Inter', sans-serif; color: var(--fb-gray-700); transition: color 0.15s; }
.fb-med-card:hover span,
.fb-med-card.selected span { color: #4c1d95; }
.fb-med-counter {
  display: none;
  padding: 4px 12px; border-radius: 9999px;
  font: 500 12px 'Inter', sans-serif;
  background: #ede9fe; color: #6d28d9;
}
.fb-med-counter.visible { display: inline-block; }
.fb-med-counter.over { background: #fee2e2; color: #b91c1c; }

/* ── 17. reCAPTCHA container ── */
.fb-recaptcha-wrap { display: flex; justify-content: center; margin-top: 24px; }
#recaptcha-container { margin: 0 auto; }

/* ── 18. Modais ── */
.fb-modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 100;
  align-items: center; justify-content: center; padding: 16px;
}
.fb-modal-backdrop.open { display: flex; }
.fb-modal {
  background: white; border-radius: 16px;
  padding: 24px; max-width: 480px; width: 100%;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}
.fb-modal-icon-wrap { display: flex; justify-content: center; margin-bottom: 12px; }
.fb-modal-icon {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.fb-modal-icon svg { width: 40px; height: 40px; }
.fb-modal-icon.amber { background: #fef3c7; color: #b45309; box-shadow: 0 0 0 4px #fffbeb; }
.fb-modal-icon.blue  { background: #dbeafe; color: #1d4ed8; box-shadow: 0 0 0 4px #eff6ff; }
.fb-modal-icon.green { background: #16a34a; color: white; }
.fb-modal-desc {
  text-align: center; font-size: 16px; color: #374151;
  max-width: 320px; margin: 0 auto 20px;
}
.fb-modal-footer { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 576px) { .fb-modal-footer { flex-direction: row; justify-content: flex-end; } }
.fb-btn-orange {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--fb-radius-btn);
  background: #ea580c; color: white; border: none;
  font: 500 14px 'Inter', sans-serif; cursor: pointer;
  transition: background 0.15s; white-space: nowrap;
}
.fb-btn-orange:hover { background: #c2410c; }
.fb-btn-modal-primary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--fb-radius-btn);
  background: var(--fb-primary); color: white; border: none;
  font: 500 14px 'Inter', sans-serif; cursor: pointer;
  transition: background 0.15s; white-space: nowrap;
}
.fb-btn-modal-primary:hover { background: var(--fb-primary-h); }
.fb-btn-modal-cancel {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--fb-radius-btn);
  background: white; color: var(--fb-gray-700);
  border: 1px solid #d1d5db;
  font: 500 14px 'Inter', sans-serif; cursor: pointer;
  transition: background 0.15s; white-space: nowrap;
}
.fb-btn-modal-cancel:hover { background: #f9fafb; }

/* ── 19. Spinner ── */
.fb-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white; border-radius: 50%;
  animation: fb-spin 0.8s linear infinite;
}
@keyframes fb-spin { to { transform: rotate(360deg); } }

/* ── 20. Required legend & step counter ── */
.fb-required-legend { font-size: 12px; color: var(--fb-gray-400); padding-top: 8px; }
.fb-step-counter-mobile {
  text-align: center; margin-top: 24px;
  font-size: 14px; color: var(--fb-gray-400);
}
@media (min-width: 768px) { .fb-step-counter-mobile { display: none; } }

/* ── 21. Address rows & grid helpers ── */
.fb-address-rows { display: flex; flex-direction: column; gap: 16px; }
.fb-row { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 768px) {
  .fb-row-2 { flex-direction: row; }
  .fb-row-2 > * { flex: 1; }
  .fb-row-3 { flex-direction: row; }
  .fb-row-3 > * { flex: 1; }
  .fb-row-2-1 { flex-direction: row; }
  .fb-row-2-1 > *:first-child { flex: 2; }
  .fb-row-2-1 > *:last-child  { flex: 1; }
}

/* ── 22. Spacing helpers ── */
.fb-space-y-8  { display: flex; flex-direction: column; gap: 32px; }
.fb-space-y-4  { display: flex; flex-direction: column; gap: 16px; }
.fb-space-y-3  { display: flex; flex-direction: column; gap: 12px; }
.fb-mb-10 { margin-bottom: 40px; }

/* ── 23. ASP.NET validation span integration ── */
.field-validation-error { display: block; }
.field-validation-valid  { display: none; }
