/**
 * BulCommerce — Speedy checkout picker styles
 *
 * Styles the office/APT picker and address autocomplete that speedy-frontend.js
 * renders inside the .flowcheckout-additional-fields mount div.
 *
 * DOM contract (from speedy-frontend.js + Speedy/Office.php + Speedy/Address.php):
 *   Mount     : .flowcheckout-additional-fields[data-type="office|address"]
 *   Mode root : .fc-speedy--office  /  .fc-speedy--address
 *   Search    : .fc-speedy__search
 *   List      : .fc-speedy__list > .fc-speedy__opt
 *   Opt types : .fc-speedy__opt--city  /  .fc-speedy__opt--street
 *   Selection : .fc-speedy__selected > .fc-speedy__selected-lbl
 *   Label     : .fc-speedy__label
 *   Addr rows : .fc-speedy__addr-list > .fc-speedy__addr-query
 *   Street no : .fc-speedy__street-number
 *   Extra     : .fc-speedy__addr-extra
 *   Message   : .fc-speedy__msg
 *   Other     : .fc-speedy__other
 */

/* ─── Design tokens ─────────────────────────────────────────────────────── */

.flowcheckout-additional-fields[data-type="office"],
.flowcheckout-additional-fields[data-type="address"] {
  --fc-blue:      #3b5ef5;
  --fc-blue-dark: #2545d4;
  --fc-gray-50:   #f8fafc;
  --fc-gray-100:  #f1f5f9;
  --fc-gray-200:  #e2e8f0;
  --fc-gray-400:  #94a3b8;
  --fc-gray-500:  #64748b;
  --fc-gray-700:  #334155;
  --fc-gray-900:  #0f172a;
  --fc-radius:    10px;
}

/* ─── Mount container ───────────────────────────────────────────────────── */

.flowcheckout-additional-fields {
  /* Sits right under the city field; keep the top gap tight (the city field
     already has its own bottom margin) so the office/address search isn't
     floating far below the selected city. */
  margin-top: 0;
  padding: 2px 0 4px;
}

/* ─── Mode roots ────────────────────────────────────────────────────────── */

.fc-speedy--office,
.fc-speedy--address {
  width: 100%;
}

/* ─── Label above a field ───────────────────────────────────────────────── */

.fc-speedy__label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fc-gray-500, #64748b);
  letter-spacing: .01em;
  margin-bottom: 7px;
}

/* ─── Search input (matches the "Search city" field / .fc-citystate) ─────── */

.fc-speedy input.fc-speedy__search {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px 12px 44px;
  border: 1.5px solid var(--fc-gray-200, #e2e8f0);
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fc-gray-900, #0f172a);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' 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") no-repeat left 16px center,
    #fbfcfe;
  background-size: 18px 18px, auto;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  margin-bottom: 6px;
}

.fc-speedy input.fc-speedy__search::placeholder {
  color: var(--fc-gray-400, #94a3b8);
  font-weight: 400;
}

.fc-speedy input.fc-speedy__search:hover {
  border-color: #cbd5e1;
  background-color: #fff;
}

.fc-speedy input.fc-speedy__search:focus {
  outline: none;
  border-color: var(--fc-blue, #3b5ef5);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(59,94,245,.12);
}

/* A chosen office is shown in this input (JS sets data-fc-selected-label). Swap the
   magnifier for a blue location pin so the selected office reads as a confirmed
   place — the magnifier returns the moment the buyer focuses to search again. */
.fc-speedy input.fc-speedy__search[data-fc-selected-label]:not(:focus) {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%233b5ef5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E") no-repeat left 16px center,
    #fbfcfe;
  background-size: 18px 18px, auto;
}

/* wc/theme-override: when the picker renders inside ul#shipping_method (the
   multi-method/locator case), WooCommerce's `ul#shipping_method li input`
   ID-specificity rule resets the input padding back to ~0, so the placeholder
   text slid under the left magnifier icon. Pin the left padding that clears the
   icon (higher specificity than the WC rule, plus !important to beat Divi). */
ul#shipping_method li input.fc-speedy__search,
.fc-speedy input.fc-speedy__search {
  padding: 12px 16px 12px 44px !important;
}

/* ─── Results list ──────────────────────────────────────────────────────── */

.fc-speedy__list {
  background: #fff;
  border: 1px solid var(--fc-gray-200, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16,24,40,.14);
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
  margin-bottom: 8px;
}

/* Idle: the office list is emptied until the buyer types — collapse it so no
   open dropdown shows on load. */
.fc-speedy__list:empty {
  display: none;
}

/* Office/street option row — the shared pickup-list skin owns its appearance
   (padding, borders, radius, the <button> reset and the theme-defeating
   !important flags). See src/css/pickup-list.css; renderOfficeList() emits
   .fc-pickup__row alongside .fc-speedy__opt. Only Speedy-specific bits belong
   here now. */

.fc-speedy__opt-ic {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--fc-blue, #3b5ef5);
}

.fc-speedy__opt:hover .fc-speedy__opt-ic {
  color: var(--fc-blue-dark, #2545d4);
}

.fc-speedy__opt-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left !important;
  gap: 2px;
  min-width: 0;
}

.fc-speedy__opt-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--fc-gray-900, #0f172a);
  line-height: 1.25;
}

.fc-speedy__opt-addr {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fc-gray-500, #64748b);
  line-height: 1.35;
}

/* Address-picker city/street options reuse .fc-speedy__opt but render plain
   text (no pin/body). Keep them single-line and readable. */
.fc-speedy__opt--city {
  font-weight: 700;
}

.fc-speedy__opt--street {
  font-size: 14px;
  font-weight: 500;
  color: var(--fc-gray-700, #334155);
}

/* ─── Selected value display ────────────────────────────────────────────── */

.fc-speedy__selected {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 16px;
  background: #fff;
  border: 2px solid var(--fc-gray-200, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
  margin-bottom: 8px;
}

/* Green confirmation check, drawn as a data-URI so no markup change is needed. */
.fc-speedy__selected::before {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") no-repeat center;
  background-size: 18px 18px;
}

.fc-speedy__selected-lbl {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--fc-gray-900, #0f172a);
  line-height: 1.35;
  flex: 1;
}

/* Hide the selected card (and its green check) until something is actually
   chosen — the JS empties it when there is no selection. */
.fc-speedy__selected:empty {
  display: none;
}

/* ─── Address list (street suggestions) ─────────────────────────────────── */

.fc-speedy__addr-list {
  margin-bottom: 8px;
}

/* Idle: the JS empties the address list until the buyer searches — collapse the
   container so no empty box/prompt shows before any input. */
.fc-speedy__addr-list:empty {
  display: none;
}

.fc-speedy input.fc-speedy__addr-query {
  width: 100%;
  min-height: 56px;
  padding: 16px 16px 16px 48px;
  border: 2px solid var(--fc-gray-200, #e2e8f0);
  border-radius: 12px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--fc-gray-900, #0f172a);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23647489' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat left 18px center,
    #fbfcfe;
  background-size: 18px 18px, auto;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
  margin-bottom: 4px;
}

.fc-speedy input.fc-speedy__addr-query::placeholder {
  color: var(--fc-gray-500, #64748b);
  font-weight: 500;
}

.fc-speedy input.fc-speedy__addr-query:hover {
  border-color: #cbd5e1;
  background-color: #fff;
}

.fc-speedy input.fc-speedy__addr-query:focus {
  outline: none;
  border-color: var(--fc-blue, #3b5ef5);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(59,94,245,.12);
}

/* ─── Street number + other — fused into one segmented row, matching Econt ── */

/* The wrapper is a transparent flex row (it used to carry its own border —
   that wrongly double-boxed the two inputs). The two inputs are separate cards
   with a gap between them, not a fused segmented control. */
.fc-speedy__addr-extra {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
  /* Breathing room below the "Street or quarter" search (its suggestion list
     collapses when empty, so without this the two inputs sit almost flush). */
  margin-top: 12px;
}

.fc-speedy input.fc-speedy__street-number,
.fc-speedy input.fc-speedy__other {
  min-height: 56px;
  padding: 16px 20px;
  border: 2px solid var(--fc-gray-200, #e2e8f0);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--fc-gray-900, #0f172a);
  background-color: #fbfcfe;
  box-sizing: border-box;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.fc-speedy input.fc-speedy__street-number {
  flex: 0 0 42%;
  max-width: none;
  border-radius: 12px;
}

.fc-speedy input.fc-speedy__other {
  flex: 1 1 0;
  min-height: 56px;
  resize: none;
  border-radius: 12px;
}

.fc-speedy input.fc-speedy__street-number::placeholder,
.fc-speedy input.fc-speedy__other::placeholder {
  color: var(--fc-gray-500, #64748b);
  font-weight: 500;
}

.fc-speedy input.fc-speedy__street-number:hover,
.fc-speedy input.fc-speedy__other:hover {
  border-color: #cbd5e1;
  background-color: #fff;
}

.fc-speedy input.fc-speedy__street-number:focus,
.fc-speedy input.fc-speedy__other:focus {
  outline: none;
  border-color: var(--fc-blue, #3b5ef5);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(59,94,245,.12);
  /* lift the focused field so its blue ring/border sits above its neighbour */
  position: relative;
  z-index: 1;
}

/* wc/theme-override: same hardening as Econt — WooCommerce's
   `ul#shipping_method li input` margin and Divi's 1px input border would
   otherwise break the fused row. */
.fc-speedy__addr-extra input.fc-speedy__street-number,
.fc-speedy__addr-extra input.fc-speedy__other {
  margin: 0 !important;
  padding: 16px 20px !important;
  border: 2px solid var(--fc-gray-200, #e2e8f0) !important;
}
.fc-speedy__addr-extra input.fc-speedy__other {
  margin-left: 0 !important;
}
.fc-speedy__addr-extra input.fc-speedy__street-number:hover,
.fc-speedy__addr-extra input.fc-speedy__other:hover {
  border-color: #cbd5e1 !important;
}
.fc-speedy__addr-extra input.fc-speedy__street-number:focus,
.fc-speedy__addr-extra input.fc-speedy__other:focus {
  border-color: var(--fc-blue, #3b5ef5) !important;
}
.fc-speedy--address input.fc-speedy__addr-query {
  margin-right: 0 !important;
  padding: 16px 16px 16px 48px !important;
}

/* ─── Status / error message ────────────────────────────────────────────── */

.fc-speedy__msg {
  padding: 6px 10px;
  border-radius: var(--fc-radius, 5px);
  font-size: 13px;
  background: var(--fc-gray-50, #f8fafc);
  color: var(--fc-gray-700, #334155);
  margin-top: 4px;
}

.fc-speedy__msg:empty {
  display: none;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .fc-speedy__list {
    max-height: 180px;
  }
  .fc-speedy input.fc-speedy__street-number {
    flex-basis: 38%;
  }
}
