/* ================================================================
   Contact Page — HubSpot form Step-2 CSS
   Targets the real rendered DOM from {% form %} — not the preview's
   static <form>. main.css owns .contact-* and .form-group/* classes.
   HubSpot's form CSS loads separately and is aggressive — !important
   is required on layout-critical rules to win the cascade.
   ================================================================ */

/* ── Reset fieldset chrome ── */
.contact-form-card fieldset {
  border: none !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
}

/* ── Two-column row (first name / last name) ── */
.contact-form-card fieldset.form-columns-2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 16px !important;
  margin-bottom: 16px !important;
  float: none !important;
  width: 100% !important;
}

/* HubSpot float layout sets width:47% — force to fill the grid column */
.contact-form-card fieldset.form-columns-2 .hs-form-field {
  width: 100% !important;
  min-width: 0 !important;
  float: none !important;
  margin: 0 !important;
}

/* ── Single-column row ── */
.contact-form-card fieldset.form-columns-1 {
  margin-bottom: 16px !important;
  width: 100% !important;
}

/* ── Hide the empty form title HubSpot injects ── */
.contact-form-card .form-title {
  display: none;
}

/* ── Field wrapper — HubSpot sets width:95% on these ── */
.contact-form-card .hs-form-field {
  display: flex;
  flex-direction: column;
  width: 100% !important;
}

/* Fields stacked inside a dependent wrapper need individual gaps —
   the fieldset only provides the trailing gap after the whole group */
.contact-form-card .hs-dependent-field > .hs-form-field {
  margin-bottom: 16px;
}
.contact-form-card .hs-dependent-field > .hs-form-field:last-child {
  margin-bottom: 0;
}

/* ── Labels (empty spans in this form but styled for completeness) ── */
.contact-form-card .hs-form-field > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

/* ── Input wrapper ── */
.contact-form-card .hs-form-field .input {
  width: 100%;
}

/* ── All inputs, selects, textareas ── */
.contact-form-card .hs-input {
  width: 100% !important;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  outline: none;
  background: var(--surface);
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.contact-form-card .hs-input:focus {
  border-color: var(--blue);
}

/* ── Error state on inputs ── */
.contact-form-card .hs-input.invalid.error {
  border-color: #EF4444;
  background: #FFF8F8;
}

/* ── Select: custom arrow + placeholder dimming ── */
.contact-form-card select.hs-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2364748B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-color: var(--surface);
  padding-right: 40px;
  cursor: pointer;
}

.contact-form-card select.hs-input.is-placeholder {
  color: var(--text-muted);
}

/* ── Textarea ── */
.contact-form-card textarea.hs-input {
  min-height: 100px;
  resize: vertical;
}

/* ── International phone field ──────────────────────────────────────
   HubSpot renders this as div.hs-input.hs-fieldtype-intl-phone
   containing a country <select> + tel <input>, both also .hs-input.
   The div IS the visual container; inner elements share no border.
   ─────────────────────────────────────────────────────────────────── */
.contact-form-card div.hs-input.hs-fieldtype-intl-phone {
  display: flex !important;
  align-items: center !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  background: var(--surface) !important;
  width: 100% !important;
}

/* Country code dropdown — capped so it can't dominate the row */
.contact-form-card .hs-fieldtype-intl-phone select.hs-input {
  flex: 0 1 40% !important;
  width: 40% !important;
  max-width: 160px !important;
  min-width: 0 !important;
  border: none !important;
  border-right: 1px solid var(--border) !important;
  border-radius: 0 !important;
  background-color: transparent !important;
  padding: 12px 28px 12px 12px !important;
  background-position: right 8px center !important;
  box-shadow: none !important;
}

/* Tel number input — fills the remaining space, never clips */
.contact-form-card .hs-fieldtype-intl-phone input[type="tel"].hs-input {
  flex: 1 1 0% !important;
  width: 0 !important;
  min-width: 80px !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 12px 16px !important;
  box-shadow: none !important;
}

/* ── Inline error messages ── */
.contact-form-card .hs-error-msgs {
  list-style: none;
  margin: 5px 0 0;
  padding: 0;
}

.contact-form-card .hs-error-msg {
  font-size: 12px;
  font-weight: 500;
  color: #EF4444;
  display: block;
}

/* ── Error rollup banner ── */
.contact-form-card .hs_error_rollup {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.contact-form-card .hs_error_rollup label {
  font-size: 13px;
  font-weight: 500;
  color: #EF4444;
}

/* ── Submit button ── */
.contact-form-card .hs-button.primary {
  width: 100%;
  padding: 16px;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.contact-form-card .hs-button.primary:hover {
  background: var(--blue-dim);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

/* ── Responsive: stack two-column rows on narrow screens ── */
@media (max-width: 600px) {
  .contact-form-card fieldset.form-columns-2 {
    grid-template-columns: 1fr !important;
  }
}
