/* Shared billing form (templates/_billing_fields*.tpl, js/billing_form.js): the wizard's billing step and the account
   page. Everything is scoped under .rt-bf; a host page retunes it through the --bf-* tokens (values from DESIGN.md). */

.rt-bf {
  --bf-ink: #101828;
  --bf-ink-2: #475467;
  --bf-ink-3: #5D6B82;
  --bf-line: #E4E7EC;
  --bf-field: #8792A2;          /* input border, 3.3:1 on white */
  --bf-soft: #F5F7FB;
  --bf-track: #EEF1F6;
  --bf-accent: #2D6FE3;
  --bf-blue-50: #F1F5FF;
  --bf-action: #2E7D32;
  --bf-action-tint: #E7F4E8;
  --bf-danger: #B42318;
  --bf-warn-bg: #FFF8E6;
  --bf-warn-dot: #B54708;
  --bf-ease: cubic-bezier(0.16, 1, 0.3, 1);

  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--bf-ink);
}
.rt-bf *, .rt-bf *::before, .rt-bf *::after { box-sizing: border-box; }
.rt-bf :where(p) { margin: 0; }
.rt-bf :focus-visible { outline: 3px solid var(--bf-accent); outline-offset: 2px; }
.rt-bf [hidden] { display: none !important; }

.rt-bf-field { margin: 0 0 20px; }
.rt-bf-field--ac { position: relative; }
.rt-bf-field--short { max-width: 320px; }
.rt-bf .rt-bf-label {
  display: block; margin: 0 0 6px; font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--bf-ink);
  text-transform: none; letter-spacing: 0;
}
.rt-bf-optional { font-weight: 500; color: var(--bf-ink-3); }

.rt-bf .rt-bf-input {
  display: block; width: 100%; height: 48px; margin: 0; padding: 0 14px;
  border: 1px solid var(--bf-field); border-radius: 10px; background: #fff; box-shadow: none;
  color: var(--bf-ink); font: inherit; font-size: 16px; line-height: 1.2;
  caret-color: var(--bf-accent);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rt-bf .rt-bf-input:hover { border-color: #5D6B82; }
.rt-bf .rt-bf-input:focus { outline: none; border-color: var(--bf-accent); box-shadow: 0 0 0 3px rgba(45, 111, 227, 0.22); }
.rt-bf .rt-bf-input[aria-invalid="true"] { border-color: var(--bf-danger); }
.rt-bf .rt-bf-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.18); }
.rt-bf .rt-bf-input:disabled { background: var(--bf-soft); color: var(--bf-ink-3); }
.rt-bf .rt-bf-input[aria-busy="true"] { box-shadow: inset 0 -2px 0 var(--bf-accent); }
.rt-bf .rt-bf-select {
  padding-right: 40px; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: #fff url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='%235D6B82' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' d='M6 9.5l6 6 6-6'/></svg>") no-repeat right 12px center / 18px 18px;
}
/* build.js wraps every <select> in selectBoxIt; the billing form keeps the native select */
.rt-bf .selectboxit-container { display: none !important; }
.rt-bf select.rt-bf-select { display: block !important; }

.rt-bf-help { margin-top: 6px; font-size: 14px; line-height: 1.45; color: var(--bf-ink-3); }
.rt-bf-error {
  display: flex; align-items: flex-start; gap: 6px; margin-top: 6px;
  font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--bf-danger);
}
.rt-bf-error::before {
  content: ""; flex: 0 0 16px; width: 16px; height: 16px; margin-top: 2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' d='M12 7v6m0 4h.01'/><circle cx='12' cy='12' r='10' fill='none' stroke='black' stroke-width='2.2'/></svg>") center / contain no-repeat;
          mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' d='M12 7v6m0 4h.01'/><circle cx='12' cy='12' r='10' fill='none' stroke='black' stroke-width='2.2'/></svg>") center / contain no-repeat;
}

.rt-bf-fieldset { min-width: 0; margin: 0 0 28px; padding: 0; border: 0; }
.rt-bf .rt-bf-legend {
  display: block; width: auto; margin: 0 0 10px; padding: 0; border: 0;
  font-size: 15px; font-weight: 700; line-height: 1.4; color: var(--bf-ink); text-transform: none; letter-spacing: 0;
}

/* person / company: two pills on a soft track */
.rt-bf-seg { display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 999px; background: var(--bf-track); }
.rt-bf .rt-bf-seg__opt {
  position: relative; display: flex; align-items: center; justify-content: center;
  height: 44px; margin: 0; padding: 0 22px; border-radius: 999px;
  font-size: 15px; font-weight: 700; color: var(--bf-ink-2); white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.rt-bf-seg__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rt-bf-seg__opt:hover { color: var(--bf-ink); }
.rt-bf-seg__opt:has(input:checked) { background: #fff; color: var(--bf-ink); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08), 0 2px 8px rgba(16, 24, 40, 0.06); }
.rt-bf-seg__opt:has(input:focus-visible) { outline: 3px solid var(--bf-accent); outline-offset: 1px; }

/* tax ID + ANAF lookup on one line */
.rt-bf-cui { display: flex; gap: 8px; }
.rt-bf-cui .rt-bf-input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; }
.rt-bf .rt-bf-lookup {
  position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 0; height: 48px; margin: 0; padding: 0 18px;
  border: 0; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1.5px var(--bf-ink);
  color: var(--bf-ink); font: inherit; font-size: 15px; font-weight: 700; line-height: 1; letter-spacing: 0; text-transform: none; white-space: nowrap;
  cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease;
}
.rt-bf .rt-bf-lookup:hover { background: var(--bf-ink); color: #fff; }
.rt-bf .rt-bf-lookup:disabled { opacity: 0.6; cursor: progress; }
.rt-bf .rt-bf-lookup[aria-busy="true"] { background: #fff; color: var(--bf-ink); }
.rt-bf-lookup__icon { flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rt-bf-lookup__spin {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(16, 24, 40, 0.2); border-top-color: var(--bf-ink);
  animation: rt-bf-spin 0.8s linear infinite;
}
.rt-bf-lookup[aria-busy="true"] .rt-bf-lookup__spin { display: block; }
.rt-bf-lookup[aria-busy="true"] .rt-bf-lookup__icon { display: none; }
@keyframes rt-bf-spin { to { transform: rotate(360deg); } }

/* ANAF answer and tax ID warnings: a dot, a tint, no colored edge */
.rt-bf-note {
  display: flex; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px;
  background: var(--bf-blue-50); font-size: 14px; font-weight: 600; line-height: 1.45; color: var(--bf-ink);
}
.rt-bf-note::before { content: ""; flex: 0 0 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--bf-accent); }
.rt-bf-note[data-tone="ok"] { background: var(--bf-action-tint); }
.rt-bf-note[data-tone="ok"]::before { background: var(--bf-action); }
.rt-bf-note[data-tone="warn"] { background: var(--bf-warn-bg); }
.rt-bf-note[data-tone="warn"]::before { background: var(--bf-warn-dot); }

.rt-bf-address { margin: 8px 0 8px; }
.rt-bf-address > .rt-bf-legend { margin-bottom: 14px; font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.rt-bf-address .rt-bf-error[data-error-for="address"] { margin: -8px 0 16px; }
.rt-bf-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }

/* Google predictions (js/billing_address.js) in the form's type */
.rt-bf ul.rt-ac-list { margin-top: 4px; padding: 6px; border: 0; border-radius: 12px; box-shadow: 0 0 0 1px var(--bf-line), 0 12px 32px rgba(16, 24, 40, 0.14); }
.rt-bf ul.rt-ac-list li.rt-ac-option { padding: 10px 12px; border-radius: 8px; font-family: inherit; font-size: 15px; color: var(--bf-ink); }
.rt-bf ul.rt-ac-list li.rt-ac-option:hover, .rt-bf ul.rt-ac-list li.rt-ac-option.rt-ac-active { background: var(--bf-blue-50); box-shadow: none; }

@media (max-width: 600px) {
  .rt-bf-seg { display: grid; width: 100%; }
  .rt-bf .rt-bf-seg__opt { padding: 0 10px; }
  .rt-bf-row { grid-template-columns: minmax(0, 1fr); }
  .rt-bf-field--short { max-width: none; }
  .rt-bf .rt-bf-lookup { padding: 0 14px; }
}
@media (max-width: 360px) {
  .rt-bf-cui { flex-wrap: wrap; }
  .rt-bf .rt-bf-lookup { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .rt-bf *, .rt-bf *::before, .rt-bf *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
  .rt-bf-lookup__spin { animation: none; border-right-color: var(--bf-ink); }
}
