/* Buyback quote popup (buyback-quote.js). Scoped under .bq so the site's
   global label/span/h2 rules in main.css cannot leak in. */
.bq {
  --bq-bg: #fff;
  --bq-ink: #272722;
  --bq-muted: #5e5b52;
  --bq-accent: #285e63;
  --bq-accent-soft: #e6f0f0;
  --bq-gold: #85651e;
  --bq-line: #ddd8ca;
  --bq-surface: #f7f5ef;
  --bq-error: #a3261b;
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(440px, calc(100% - 32px));
  height: fit-content;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--bq-line);
  border-radius: 16px;
  background: var(--bq-bg);
  color: var(--bq-ink);
  font-family: monospace;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
  color-scheme: light;
}

.bq::backdrop {
  background: rgba(12, 12, 10, 0.6);
}

.bq[open] {
  animation: bq-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes bq-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.bq *,
.bq *::before,
.bq *::after {
  box-sizing: border-box;
}

.bq span {
  font-size: inherit;
  color: inherit;
  font-weight: inherit;
}

.bq[lang="ar"],
.bq[lang="ar"] :is(h2, button, select, input, legend, label) {
  font-family: "Cairo", sans-serif;
}

.bq-form {
  display: grid;
  gap: 18px;
  padding: 22px 22px 24px;
}

.bq-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bq .bq-head h2 {
  flex: 1;
  margin: 0;
  font-family: "Urbanist", sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--bq-ink);
}

.bq[lang="ar"] .bq-head h2 {
  font-family: "Cairo", sans-serif;
  font-size: 21px;
  letter-spacing: normal;
}

.bq-lang,
.bq-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--bq-line);
  border-radius: 999px;
  background: transparent;
  color: var(--bq-accent);
  cursor: pointer;
}

.bq-lang {
  padding: 0 14px;
  font-family: "Cairo", sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.bq-lang[lang="en"] {
  font-family: "Urbanist", sans-serif;
}

.bq-close svg {
  width: 20px;
  height: 20px;
}

.bq-lang:hover,
.bq-close:hover {
  background: var(--bq-surface);
}

.bq-lead {
  margin: -6px 0 0;
  color: var(--bq-muted);
  font-size: 13px;
}

.bq-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: grid;
  gap: 8px;
}

.bq legend,
.bq .bq-label {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--bq-ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bq[lang="ar"] :is(legend, .bq-label) {
  font-size: 14px;
  text-transform: none;
  letter-spacing: normal;
}

.bq-field > .bq-label {
  margin-bottom: 0;
}

.bq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bq .bq-chip {
  position: relative;
  display: inline-flex;
  margin: 0;
  cursor: pointer;
}

.bq-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.bq-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--bq-line);
  border-radius: 999px;
  background: var(--bq-bg);
  color: var(--bq-ink);
}

.bq-chip:hover span {
  border-color: var(--bq-accent);
}

.bq-chip input:checked + span {
  border-color: var(--bq-accent);
  background: var(--bq-accent-soft);
  color: var(--bq-accent);
  font-weight: 700;
}

.bq-chip input:focus-visible + span,
.bq :is(select, input[type="text"], input[type="number"], .bq-stepper button, .bq-send, .bq-lang, .bq-close):focus-visible {
  outline: 3px solid var(--bq-accent);
  outline-offset: 2px;
}

.bq select,
.bq .bq-other,
.bq-stepper input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--bq-line);
  border-radius: 10px;
  background: var(--bq-bg);
  color: var(--bq-ink);
  font: inherit;
}

.bq .bq-other[hidden] {
  display: none;
}

.bq-chips + .bq-other {
  margin-top: 2px;
}

.bq-stepper {
  display: grid;
  grid-template-columns: 44px 88px 44px;
  gap: 8px;
  align-items: center;
}

.bq-stepper input {
  padding: 0 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.bq-stepper input::-webkit-inner-spin-button,
.bq-stepper input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.bq-stepper button {
  min-height: 44px;
  border: 1px solid var(--bq-line);
  border-radius: 10px;
  background: var(--bq-surface);
  color: var(--bq-ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.bq-error {
  margin: 0;
  color: var(--bq-error);
  font-size: 12px;
  font-weight: 700;
}

.bq-invalid .bq-chip span,
.bq-invalid select,
.bq-invalid .bq-other,
.bq-invalid .bq-stepper input {
  border-color: var(--bq-error);
}

.bq-docs {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bq-surface);
  color: var(--bq-muted);
  font-size: 12px;
}

.bq-send {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  background: var(--bq-accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.bq-send svg {
  width: 20px;
  height: 20px;
}

.bq-send:hover {
  filter: brightness(1.1);
}

.bq ::selection {
  background: #ddc58c;
  color: #272722;
}

@media (prefers-color-scheme: dark) {
  .bq {
    --bq-bg: #1d1c19;
    --bq-ink: #eeeae1;
    --bq-muted: #bcb5a6;
    --bq-accent: #8adce2;
    --bq-accent-soft: rgba(138, 220, 226, 0.12);
    --bq-gold: #d8ba73;
    --bq-line: #474138;
    --bq-surface: #26251f;
    --bq-error: #ff8a7a;
    color-scheme: dark;
  }

  .bq-send {
    color: #122729;
  }
}

/* Phones: a sheet that rises from the bottom edge. */
@media (max-width: 600px) {
  .bq {
    width: 100%;
    max-width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    inset: auto 0 0;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }

  .bq[open] {
    animation-name: bq-up;
  }

  @keyframes bq-up {
    from { transform: translateY(100%); }
    to { transform: none; }
  }

  .bq-form {
    padding: 18px 18px max(22px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .bq[open] {
    animation: none;
  }
}
