/* Buddy Public Booking · FULL design - Shared form fields.
 * The field grid, text inputs, custom dropdown, address autocomplete and
 * error styles. Used by every text form: Step 1 (Pet Parent),
 * Step 2 (Pet Details) and Step 6 (Vet Details). */

/* Form grid */
.bb-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; align-items: start; }
.bb-form-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--bb-gray-300); border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.bb-form-section { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); align-items: start; gap: 16px 40px; min-height: 0; height: auto; padding: 16px; border: 0; background: #fff; }
.bb-form-section + .bb-form-section { margin-top: 0; border-top: 1px solid var(--bb-gray-300); }
.bb-form-section-copy { display: flex; flex-direction: column; gap: 4px; }
.bb-form-section-copy h4 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; }
.bb-form-section-copy p { margin: 0; max-width: none; color: var(--bb-gray-800); font-size: 12px; line-height: 16px; }
.bb-col-2 { grid-column: 1 / -1; }
.bb-field label { display: block; color: var(--bb-text); font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.bb-field .bb-req { color: var(--bb-danger); margin-left: 2px; }
.bb-input, .bb-select, .bb-textarea {
  width: 100%;
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--bb-gray-400);
  border-radius: 8px;
  font-size: 13px;
  line-height: 18px;
  background: #fff;
  color: var(--bb-text);
}
.bb-input:focus, .bb-select:focus, .bb-textarea:focus {
  outline: none;
  border-color: var(--bb-purple);
  box-shadow: 0 0 0 3px rgba(47, 91, 234, .16);
}
.bb-input.is-invalid, .bb-select.is-invalid { border-color: var(--bb-danger); }
.bb-error { color: var(--bb-danger); font-size: 13px; margin-top: 5px; }
textarea.bb-textarea { height: auto; min-height: 88px; padding: 8px 12px; resize: vertical; }

/* Custom dropdown (theme-proof replacement for native <select>) */
.bb-dd { position: relative; }
.bb-dd-toggle {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--bb-gray-400);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: var(--bb-text);
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
}
.bb-dd-toggle:hover { border-color: var(--bb-purple); }
.bb-dd.is-open .bb-dd-toggle { border-color: var(--bb-purple); box-shadow: 0 0 0 3px rgba(47, 91, 234, .16); }
.bb-dd.is-invalid .bb-dd-toggle { border-color: var(--bb-danger); }
.bb-dd-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-dd-value.is-placeholder { color: #98939f; }
.bb-dd-arrow {
  flex: 0 0 auto; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--bb-gray-800);
  transition: transform 0.15s ease;
}
.bb-dd.is-open .bb-dd-arrow { transform: rotate(180deg); }
.bb-dd-panel {
  display: none;
  position: fixed; z-index: 10010;
  background: #fff; border: 1px solid var(--bb-gray-400); border-radius: 9px;
  box-shadow: 0 8px 24px rgba(16,24,40,.14);
  padding: 6px;
  max-height: 280px; overflow: hidden;
}
.bb-dd-search {
  width: 100%; height: 30px; padding: 0 10px; margin-bottom: 6px;
  border: 1px solid var(--bb-gray-300); border-radius: 7px; font-size: 14px;
}
.bb-dd-search:focus { outline: none; border-color: var(--bb-purple); box-shadow: 0 0 0 3px rgba(47, 91, 234, .16); }
.bb-dd-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; max-height: 220px; overflow-y: auto; }
.bb-dd-item, .bb-ac-item { box-sizing: border-box; flex: 0 0 28px; width: 100%; min-height: 0; height: 28px; padding: 0 10px; border: 0; appearance: none; -webkit-appearance: none; background: transparent; color: var(--bb-text); font-family: inherit; font-size: 13px; line-height: 18px; text-align: left; text-decoration: none; transition: background-color 120ms ease, color 120ms ease; }
.bb-dd-item { border-radius: 6px; cursor: pointer; }
.bb-dd-item:hover, .bb-dd-item:focus-visible, .bb-dd-item.is-active { background-color: #f0f3ff; outline: 0; }
.bb-dd-item.is-selected { background-color: #f0f3ff; color: #3154c6; font-weight: 600; }
.bb-dd-empty { padding: 9px 11px; font-size: 13px; color: var(--bb-gray-800); }

/* Safari on touch devices zooms the viewport when a text input is smaller
 * than 16px. Keep the V5 desktop sizes while preventing that focus zoom on
 * phones and tablets, including the search field rendered in the body portal. */
@media (hover: none) and (pointer: coarse) {
  .bb-wrap :is(.bb-input, .bb-select, .bb-textarea),
  .bb-portal-popover .bb-dd-search { font-size: 16px !important; }
}

.bb-server-error {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  color: #9f1239;
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 14px;
  margin-top: 10px;
}

/* Google Places autocomplete */
.bb-ac-wrap { position: relative; }
.bb-ac-list {
  display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 4px;
  position: fixed; z-index: 10010;
  background: #fff; border: 1px solid var(--bb-gray-400); border-radius: 9px;
  box-shadow: 0 8px 24px rgba(16,24,40,.14); max-height: 240px; overflow-y: auto;
}
.bb-ac-item { border-radius: 6px; cursor: pointer; }
.bb-ac-item:hover, .bb-ac-item:focus-visible { background-color: #f0f3ff; outline: 0; }

/* Vet details (Step 6) */
.bb-wrap .bb-vet-form-card .bb-form-section-copy h4 { color: var(--bb-text) !important; font-family: inherit !important; font-size: 14px !important; line-height: 20px !important; font-weight: 600 !important; }
.bb-wrap .bb-vet-form-card .bb-form-section-copy p { color: var(--bb-gray-800) !important; font-family: inherit !important; font-size: 12px !important; line-height: 16px !important; }
.bb-vet-form-card .bb-form-section-body { min-width: 0; }
.bb-vet-form-card > .bb-vet-reset { margin: 0 16px 16px; }
.bb-vet-form-card .bb-field.is-readonly :is(.bb-input, .bb-textarea) { background: var(--bb-fade); color: var(--bb-muted-label); cursor: default; }
.bb-vet-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.bb-wrap button.bb-vet-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 0;
  padding: 12px 16px; border: 1px solid var(--bb-gray-300) !important; border-radius: 12px !important;
  background: #fff !important; color: var(--bb-text) !important; appearance: none; -webkit-appearance: none;
  font-family: inherit !important; font-size: 14px !important; line-height: 20px !important;
  text-align: left; cursor: pointer !important; transition: border-color 120ms ease, box-shadow 120ms ease;
}
.bb-wrap button.bb-vet-choice:hover { border-color: var(--bb-gray-400) !important; background: #fff !important; }
.bb-wrap button.bb-vet-choice:focus-visible { outline: none !important; border-color: var(--bb-purple) !important; box-shadow: 0 0 0 3px rgba(47,91,234,.16) !important; }
.bb-wrap button.bb-vet-choice.is-selected { border-color: var(--bb-purple) !important; background: #fff !important; box-shadow: 0 0 0 1px var(--bb-purple) !important; }
.bb-vet-choice-title { display: inline-flex; align-items: center; gap: 8px; color: var(--bb-text); font-family: inherit; font-size: 14px; line-height: 20px; font-weight: 500; }
.bb-vet-choice-dot { position: relative; display: inline-grid; width: 16px; height: 16px; flex: 0 0 16px; place-items: center; border: 1px solid var(--bb-gray-400); border-radius: 50%; background: #fff; }
.bb-vet-choice.is-selected .bb-vet-choice-dot { border-color: var(--bb-purple); }
.bb-vet-choice.is-selected .bb-vet-choice-dot::after { width: 8px; height: 8px; border-radius: 50%; background: var(--bb-purple); content: ""; }
.bb-vet-choice-hint { padding-left: 24px; color: var(--bb-gray-800); font-size: 12px; line-height: 16px; }
.bb-vet-details-content { display: flex; min-width: 0; flex-direction: column; gap: 16px; }
.bb-vet-clinic-field .bb-dd-toggle { padding-left: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2365708a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px center; }
.bb-wrap button.bb-vet-switch { align-self: flex-start; min-height: 0 !important; height: auto !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--bb-purple-dark) !important; appearance: none; -webkit-appearance: none; font-family: inherit !important; font-size: 13px !important; line-height: 18px !important; font-weight: 500 !important; text-decoration: underline !important; text-underline-offset: 3px; cursor: pointer !important; }
.bb-wrap button.bb-vet-switch:hover { color: var(--bb-text) !important; background: transparent !important; }
.bb-wrap button.bb-vet-switch:focus-visible { outline: 2px solid var(--bb-purple) !important; outline-offset: 3px; border-radius: 2px !important; }
.bb-vet-clinic-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 12px 16px; border: 0; border-radius: 8px; background: var(--bb-fade); }
.bb-vet-clinic-summary > div { min-width: 0; }
.bb-vet-clinic-summary dt { margin: 0 0 3px; color: var(--bb-gray-800); font-size: 12px; line-height: 16px; font-weight: 500; }
.bb-vet-clinic-summary dd { margin: 0; overflow-wrap: anywhere; color: var(--bb-text); font-size: 13px; line-height: 18px; font-weight: 600; }
.bb-vet-transaction-help { margin: -10px 0 0; color: var(--bb-muted-label); font-size: 12px; line-height: 16px; }
.bb-wrap button.bb-vet-reset { align-self: flex-start; min-height: 30px !important; height: 30px !important; padding: 0 10px !important; border: 1px solid var(--bb-gray-400) !important; border-radius: 8px !important; background: #fff !important; color: var(--bb-text) !important; appearance: none; -webkit-appearance: none; font-family: inherit !important; font-size: 13px !important; line-height: 18px !important; font-weight: 500 !important; cursor: pointer !important; }
.bb-wrap button.bb-vet-reset:hover { background: var(--bb-gray-100) !important; border-color: var(--bb-gray-500) !important; }
.bb-wrap button.bb-vet-reset:focus-visible { outline: none !important; border-color: var(--bb-purple) !important; box-shadow: 0 0 0 3px rgba(47,91,234,.16) !important; }

/* Responsive: stack fields in one column */
@media (max-width: 860px) {
  .bb-grid { grid-template-columns: 1fr; }
  .bb-form-section { grid-template-columns: 1fr; gap: 12px; }
  .bb-vet-choices, .bb-vet-clinic-summary { grid-template-columns: 1fr; }
}
