/* MyRapid Delivery - three-tab quote box.
   Everything is namespaced mrd-qt-* / mrd-modal-* on purpose: the React quote
   widget injects its own <style> into <head> at runtime, which lands after this
   file, so any shared single-class name would lose. Colours come only from the
   theme tokens so the html[data-palette] swaps keep working. */

.mrd-qt { position: relative; }

/* ---- Tab strip ---------------------------------------------------------- */

.mrd-qt-tabs {
  display: flex;
  gap: 4px;
  padding: 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.mrd-qt-tabs::-webkit-scrollbar { display: none; }

.mrd-qt-tab {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid var(--line-soft);
  border-bottom: 0;
  background: color-mix(in oklch, var(--bg-elevated) 55%, transparent);
  color: var(--ink-soft);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 11px 20px 13px;
  border-radius: var(--radius) var(--radius) 0 0;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms, color 160ms;
}
.mrd-qt-tab:hover { background: color-mix(in oklch, var(--bg-elevated) 80%, transparent); color: var(--ink); }
.mrd-qt-tab.is-active {
  background: var(--bg-elevated);
  border-color: var(--line);
  color: var(--ink);
  position: relative;
  z-index: 2;
}
.mrd-qt-tab:focus-visible { outline: 2px solid var(--navy-700); outline-offset: 2px; }

/* Square off the top of whichever card sits directly under the strip.
   Two classes deep so it outranks the React widget's own .quote-card rule. */
.mrd-qt-panel .quote-card,
.mrd-qt-panel .mrd-qt-card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.mrd-qt-panel[hidden] { display: none !important; }
.mrd-qt-panel:focus { outline: none; }

/* ---- Enquiry form -------------------------------------------------------
   Mirrors the React parcel card (.quote-card / .qf-*) so the three tabs read
   as one component, but under its own class names so it never depends on the
   CDN-loaded widget's runtime styles. Values kept in step with
   assets/quote-form.src.jsx. */

.mrd-qt-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: var(--shadow-lg);
  border-color: var(--line);
}

.mrd-qt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}

.mrd-qt-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.018em;
  margin: 0;
}

.mrd-qt-section { display: flex; flex-direction: column; gap: 14px; position: relative; }

.mrd-qt-row { display: flex; gap: 12px; }
.mrd-qt-row > .field { flex: 1; min-width: 0; }

.mrd-qt-divider { height: 1px; background: var(--line-soft); margin: 22px 0; }

/* Unit suffix inside the numeric inputs (kg/cm or lb/in). */
.mrd-qt-suffix { position: relative; }
.mrd-qt-suffix .input { padding-right: 36px; }
.mrd-qt-suffix span {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--ink-muted);
  text-transform: lowercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* Quantity stepper - same geometry as the parcel form's .stepper. */
.mrd-qt-stepper {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream-50);
  overflow: hidden;
}
.mrd-qt-stepper button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}
.mrd-qt-stepper button:hover { background: var(--cream-200); color: var(--ink); }
.mrd-qt-stepper .input {
  border: 0;
  background: transparent;
  text-align: center;
  border-radius: 0;
  padding: 13px 0;
  -moz-appearance: textfield;
  appearance: textfield;
}
.mrd-qt-stepper .input:focus { box-shadow: none; }

.mrd-qt-card input[type="number"]::-webkit-outer-spin-button,
.mrd-qt-card input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mrd-qt-card input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.mrd-qt-submit { margin-top: 22px; }

.mrd-qt-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: mrd-qt-spin 0.7s linear infinite;
}
@keyframes mrd-qt-spin { to { transform: rotate(360deg); } }

.mrd-qt-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}
.mrd-qt-foot svg { color: oklch(0.55 0.1 155); flex: 0 0 auto; }

/* Off-screen rather than display:none - bots skip the latter. */
.mrd-qt-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.mrd-qt-note {
  padding: 20px 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--cream-100);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

/* ---- Errors ------------------------------------------------------------- */

.mrd-qt-errors {
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid oklch(0.7 0.15 25);
  background: oklch(0.97 0.04 25);
  color: var(--ink);
  font-size: 14px;
}
.mrd-qt-errors[hidden] { display: none; }
.mrd-qt-errors strong { display: block; margin-bottom: 6px; }
.mrd-qt-errors ul { margin: 0; padding-left: 18px; }
.mrd-qt-errors li { margin-bottom: 3px; }
.mrd-qt-errors:focus { outline: 2px solid oklch(0.6 0.18 25); outline-offset: 2px; }

.mrd-qt-card[aria-busy="true"] { opacity: 0.72; }
.mrd-qt-card[aria-busy="true"] .mrd-qt-submit { cursor: progress; }

/* ---- Thank-you modal ---------------------------------------------------- */

.mrd-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
}
.mrd-modal[hidden] { display: none !important; }

.mrd-modal-backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in oklch, var(--navy-900) 55%, transparent);
}

.mrd-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 34px 32px 30px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: mrd-modal-in 180ms ease-out;
}

@keyframes mrd-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.mrd-modal-x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
}
.mrd-modal-x:hover { background: var(--cream-200); color: var(--ink); }
.mrd-modal-x:focus-visible { outline: 2px solid var(--navy-700); outline-offset: 2px; }

.mrd-modal-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  background: oklch(0.88 0.12 145);
  color: oklch(0.35 0.13 145);
}

.mrd-modal-dialog h2 {
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.018em;
  margin: 0 0 10px;
}

.mrd-modal-body {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
}

.mrd-modal-ref {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--ink-muted);
}
.mrd-modal-ref[hidden] { display: none; }
.mrd-modal-ref strong { font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); word-break: break-all; }

.mrd-modal-done { width: 100%; }

body.mrd-modal-open { overflow: hidden; }

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 560px) {
  .mrd-qt-card { padding: 22px 20px 20px; }
  .mrd-qt-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .mrd-qt-row { flex-wrap: wrap; }
  /* Length/Width/Height are short numeric fields - keep them on one line. */
  .mrd-qt-dims > .field { flex: 1 1 28%; }
  .mrd-qt-tab { padding: 10px 15px 12px; font-size: 13px; }
  .mrd-modal-dialog { padding: 28px 22px 24px; }
  .mrd-modal-dialog h2 { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
  .mrd-qt-tab { transition: none; }
  .mrd-modal-dialog { animation: none; }
  .mrd-qt-spinner { animation-duration: 2s; }
}
