/* ==========================================================
   ESTIMATE MODAL STYLES
   File: estimate-modal.css
   Location: wp-content/themes/generatepress-child/estimate-modal.css
   ========================================================== */

/* ---------- Modal Overlay ---------- */
.sf-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.sf-modal-overlay.active {
  opacity: 1;
}

/* ---------- Modal Container ---------- */
.sf-modal {
  background: #ffffff;
  border-radius: 1rem;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 2rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s ease;
}
.sf-modal-overlay.active .sf-modal {
  transform: translateY(0) scale(1);
}

/* ---------- Close Button ---------- */
.sf-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.625rem;  /* 10px padding + 24px icon = 44px touch target */
  border-radius: 0.5rem;
  transition: color 0.2s, background 0.2s;
  z-index: 10;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sf-modal-close:hover {
  color: #272727;
  background: #f3f4f6;
}

/* ---------- Header ---------- */
.sf-modal-header {
  text-align: center;
  margin-bottom: 1.25rem;
}
.sf-modal-eyebrow {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #93b26a;
  margin: 0 0 0.25rem;
}
.sf-modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: #272727;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}
.sf-modal-subtitle {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0;
  line-height: 1.4;
}

/* ---------- Progress Bar ---------- */
.sf-progress {
  margin-bottom: 1.5rem;
}
.sf-progress-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.sf-progress-fill {
  height: 100%;
  background: #93b26a;
  border-radius: 2px;
  transition: width 0.4s ease;
}
.sf-progress-steps {
  display: flex;
  justify-content: space-between;
}
.sf-step-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color 0.3s;
}
.sf-step-label.active {
  color: #93b26a;
}
.sf-step-label.completed {
  color: #272727;
}

/* ---------- Step Title ---------- */
.sf-step-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #272727;
  margin: 0 0 1rem;
}

/* ---------- Category Cards ---------- */
.sf-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.sf-card {
  cursor: pointer;
  display: flex;
}
.sf-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
/* Prevent focus bleed-through from hidden radios */
.sf-card input[type="radio"]:focus + .sf-card-inner {
  border-color: #e5e7eb;
  background: #fff;
}
.sf-card input[type="radio"]:focus:checked + .sf-card-inner {
  border-color: #93b26a;
  background: #f4f9ee;
  box-shadow: 0 0 0 1px #93b26a;
}
.sf-card-inner {
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem 1rem;
  text-align: center;
  transition: all 0.2s ease;
  background: #fff;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (hover: hover) {
  .sf-card-inner:hover {
    border-color: #93b26a;
    background: #f9fdf6;
  }
}
.sf-card input:checked + .sf-card-inner {
  border-color: #93b26a;
  background: #f4f9ee;
  box-shadow: 0 0 0 1px #93b26a;
}
.sf-card-icon {
  display: flex;
  justify-content: center;
  color: #93b26a;
  margin-bottom: 0.5rem;
}
.sf-card-label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: #272727;
  margin-bottom: 0.15rem;
}
.sf-card-desc {
  display: block;
  font-size: 0.8rem;
  color: #9ca3af;
}

/* ---------- Sub-Options (Conditional) ---------- */
.sf-sub-options {
  animation: sfSlideIn 0.3s ease;
}
@keyframes sfSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.sf-sub-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #272727;
  margin: 0 0 0.6rem;
}

/* ---------- Chips (Selectable Pills) ---------- */
.sf-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.sf-chip {
  cursor: pointer;
}
.sf-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
/* Prevent focus bleed-through from hidden radios */
.sf-chip input:focus + span {
  border-color: #e5e7eb;
  background: #fff;
}
.sf-chip input:focus:checked + span {
  border-color: #93b26a;
  background: #93b26a;
  color: #fff;
}
.sf-chip span {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.1rem;  /* taller for 44px touch target */
  min-height: 44px;
  border: 1.5px solid #e5e7eb;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  background: #fff;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-sizing: border-box;
}
@media (hover: hover) {
  .sf-chip span:hover {
    border-color: #93b26a;
    background: #f9fdf6;
  }
}
.sf-chip input:checked + span {
  border-color: #93b26a;
  background: #93b26a;
  color: #fff;
}

/* ---------- Form Fields ---------- */
.sf-field {
  margin-bottom: 1rem;
}
.sf-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.sf-label {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.35rem;
}
.sf-optional {
  color: #9ca3af;
  font-weight: 400;
}
.sf-hint {
  font-size: 0.75rem;
  color: #9ca3af;
  margin: 0 0 0.5rem;
}
.sf-input,
.sf-textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  color: #272727;
  background: #f9fafb;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}
.sf-input:focus,
.sf-textarea:focus {
  outline: none;
  border-color: #93b26a;
  box-shadow: 0 0 0 3px rgba(147, 178, 106, 0.15);
  background: #fff;
}
.sf-input-short {
  max-width: 160px;
}
.sf-textarea {
  resize: vertical;
  min-height: 90px;
}

/* ---------- Consent & Disclosure ---------- */
.sf-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1rem 0 0.75rem;
  cursor: pointer;
}
.sf-checkbox {
  margin-top: 0.1rem;
  width: 1.375rem;   /* 22px — visible checkbox */
  height: 1.375rem;
  accent-color: #93b26a;
  flex-shrink: 0;
  cursor: pointer;
}
.sf-consent-text {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #6b7280;
}
.sf-consent-text a {
  color: #93b26a;
  text-decoration: underline;
}
.sf-disclosure {
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.4;
  margin: 0 0 1rem;
}
.sf-disclosure a {
  color: #9ca3af;
  text-decoration: underline;
}

/* ---------- Buttons ---------- */
.sf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.sf-btn-primary {
  background: #93b26a;
  color: #fff;
  width: 100%;
  padding: 0.85rem;
}
.sf-btn-primary:hover {
  background: #7a9656;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(147, 178, 106, 0.3);
}
.sf-btn-primary:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.sf-btn-ghost {
  background: none;
  color: #6b7280;
  padding: 0.75rem 1rem;
}
.sf-btn-ghost:hover {
  color: #272727;
  background: #f3f4f6;
}
.sf-btn-dark {
  background: #272727;
  color: #fff;
}
.sf-btn-dark:hover {
  background: #93b26a;
}
.sf-btn-submit {
  font-size: 1rem;
}
.sf-btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.sf-btn-row .sf-btn-primary {
  width: auto;
  flex: 1;
}

/* ---------- Loading State ---------- */
.sf-btn-primary.loading {
  pointer-events: none;
  opacity: 0.8;
}
.sf-btn-primary.loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: sfSpin 0.6s linear infinite;
  margin-left: 0.5rem;
}
@keyframes sfSpin {
  to { transform: rotate(360deg); }
}

/* ---------- Success & Error States ---------- */
.sf-success,
.sf-error {
  text-align: center;
  padding: 2rem 0;
}
.sf-success-icon,
.sf-error-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.sf-success-title,
.sf-error-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #272727;
  margin: 0 0 0.5rem;
}
.sf-success-text,
.sf-error-text {
  font-size: 0.9rem;
  color: #6b7280;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.sf-success-subtext {
  font-size: 0.8rem;
  color: #9ca3af;
  margin: 0 0 0.5rem;
}

/* ---------- Shake Animation ---------- */
@keyframes sfShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
  /* Centered modal with safe-area awareness */
  .sf-modal-overlay {
    padding: 0.5rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    align-items: center;
  }
  .sf-modal {
    padding: 1.25rem 1.25rem 1.5rem;
    border-radius: 0.75rem;
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    /* Prevent pull-to-refresh from killing the form */
    overscroll-behavior: contain;
  }
  .sf-modal-header {
    margin-bottom: 0.75rem;
  }
  .sf-modal-eyebrow {
    font-size: 0.75rem;  /* 12px — minimum for Lighthouse */
    margin-bottom: 0.15rem;
  }
  .sf-modal-title {
    font-size: 1.25rem;  /* 20px */
    margin-bottom: 0.2rem;
  }
  .sf-modal-subtitle {
    font-size: 0.875rem;  /* 14px */
  }
  /* Tighter progress bar */
  .sf-progress {
    margin-bottom: 1rem;
  }
  .sf-step-label {
    font-size: 0.75rem;  /* 12px */
  }
  .sf-step-title {
    font-size: 1.05rem;  /* ~17px */
    margin-bottom: 0.75rem;
  }
  .sf-field-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .sf-card-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .sf-card-inner {
    padding: 1rem 0.75rem;
  }
  /* Tighter form fields */
  .sf-field {
    margin-bottom: 0.75rem;
  }
  .sf-label {
    font-size: 0.875rem;  /* 14px — readable for all ages */
    margin-bottom: 0.25rem;
  }
  /* IMPORTANT: 16px minimum prevents iOS Safari auto-zoom on focus */
  .sf-input,
  .sf-textarea {
    padding: 0.7rem 0.75rem;
    font-size: 16px;
    min-height: 44px;       /* Google mobile touch target */
    box-sizing: border-box;
  }
  .sf-textarea {
    min-height: 80px;
  }
  .sf-chip span {
    padding: 0.5rem 0.9rem;
    min-height: 44px;      /* maintain touch target on mobile */
    font-size: 0.875rem;   /* 14px */
  }
  .sf-chip-grid {
    gap: 0.5rem;           /* 8px minimum between targets */
    margin-bottom: 0.75rem;
  }
  /* Buttons */
  .sf-btn-row {
    flex-direction: column-reverse;
  }
  .sf-btn-row .sf-btn-primary {
    width: 100%;
  }
  .sf-btn-ghost {
    width: 100%;
  }
  .sf-input-short {
    max-width: 100%;
  }
  /* Tighter consent */
  .sf-consent {
    margin: 0.75rem 0 0.5rem;
  }
  .sf-consent-text {
    font-size: 0.75rem;  /* 12px — legal fine print minimum */
  }
  .sf-disclosure {
    font-size: 0.7rem;  /* ~11.2px — smallest element, still legible */
    margin-bottom: 0.75rem;
  }
}

/* Extra: prevent pull-to-refresh for all screen sizes when modal is open */
body.sf-modal-open {
  overflow: hidden;
  overscroll-behavior: contain;
}