/* "Useful" section: the customs calculator and the rate tables (loaded only on pages that use them). */

/* ---- Calculator: form on the left, result on the right (same height, nothing jumps) ---- */
.calc-section { margin-top: clamp(22px, 3vw, 36px); scroll-margin-top: 90px; }
.calc {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 10px;
  border: 1px solid #dfeafb; border-radius: var(--concept-radius, 30px);
  background: linear-gradient(110deg, #eaf3ff, #f2f7ff 55%, #e6f1ff);
}
.calc-form, .calc-result {
  display: flex; flex-direction: column; min-width: 0; padding: clamp(18px, 2.4vw, 30px);
  border-radius: 22px; background: #fff; box-shadow: 0 10px 33px #16458a0b;
}
.calc-result { scroll-margin-top: 90px; }
.calc-title { margin-bottom: 16px; font-size: clamp(1.25rem, 1.9vw, 1.55rem); letter-spacing: -.035em; }
.calc-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.calc-picker span { text-align: center; line-height: 1.2; }

/* Fields: one per row — label, control, then a hint (or the error) */
.calc-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 22px; }
.calc-fields > .field { display: flex; flex-direction: column; gap: 6px; grid-row: auto; }
.calc-fields > .field > * { align-self: stretch; }
.calc-fields > .field[hidden], .calc-fields > .consent[hidden] { display: none; }
.calc-fields .field > :is(input, span, textarea, div) { margin-top: 0; }
.calc-fields .field-label { margin: 0; color: #253953; font-size: .86rem; font-weight: 750; }
.calc-money .field-label { cursor: pointer; }
.calc-fields .field :is(input, select) {
  min-height: 50px; border-radius: 11px; font-size: 1rem; font-variant-numeric: tabular-nums;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.calc-fields .field :is(input, select):hover { border-color: #a9c3e6; }
.calc-fields .field input::placeholder { color: #a3b1c4; font-weight: 500; }
.calc-fields .select-wrap .icon { top: 16px; right: 10px; }

/* A unit inside the field: "1998 cm³" */
.calc-unit { position: relative; display: block; }
.calc-unit input { padding-right: 54px; }
.calc-unit::after {
  content: attr(data-unit); position: absolute; top: 50%; right: 14px; transform: translateY(-50%);
  color: #6a7d98; font-size: .9rem; font-weight: 700; pointer-events: none;
}

/* Amount and currency read as one control */
.calc-money-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px; }
.calc-fields .calc-money-row > input {
  border-top-right-radius: 0; border-bottom-right-radius: 0; font-size: 1.05rem; font-weight: 750;
}
.calc-fields .calc-money-row select {
  margin-left: -1px; width: calc(100% + 1px); border-top-left-radius: 0; border-bottom-left-radius: 0;
  background: #f4f8fe; color: #1f3352; font-weight: 800;
}
.calc-money-row > input:focus-visible { position: relative; z-index: 1; }

/* Hints are quiet notes under the field (the site-wide pop-up would cover the next field) */
.calc .field > .field-hint {
  position: static; display: flex; gap: 6px; width: auto; max-width: none; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; animation: none;
  color: #5d7090; font-size: .78rem; font-weight: 600; line-height: 1.4;
}
.calc .field-hint::before { display: none; }
.calc .field-hint .icon { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 1px; color: #7c93b6; }
.calc .field[data-invalid] > .field-hint { display: none; }
.calc .calc-field-error { font-size: .8rem; }
.calc-check { margin-top: -2px; font-size: .86rem; }

.calc-submit { width: 100%; min-height: 54px; margin-top: auto; font-size: 1.02rem; }
.calc-submit .icon { width: 19px; height: 19px; }
.calc-submit:disabled { opacity: .55; cursor: not-allowed; }

/* Result */
.calc-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; margin-bottom: 10px; padding: 4px; border-radius: 11px; background: #f0f5fc; }
.calc-tabs[hidden] { display: none; }
.calc-tab { min-height: 40px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; color: #304568; font-size: .84rem; font-weight: 800; cursor: pointer; }
.calc-tab:hover { background: #e4edf9; }
.calc-tab[aria-pressed="true"] { background: var(--concept-blue, #1559d9); color: #fff; box-shadow: 0 3px 7px #0546c228; }
.calc-tab:focus-visible { outline: 2px solid var(--concept-blue, #1559d9); outline-offset: 2px; }
.calc-empty, .calc-error {
  margin-bottom: 4px; padding: 10px 13px; border-radius: 11px; background: #f5f9ff;
  color: #4f6383; font-size: .86rem; font-weight: 650; line-height: 1.4;
}
.calc-error { background: #fff4f2; color: #a11a12; }
.calc-empty[hidden], .calc-error[hidden], .calc-body[hidden] { display: none; }
.calc-lines { margin: 0; }
.calc-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 1px 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.calc-line[hidden] { display: none; }
.calc-line dt { color: #2b3d59; font-size: .9rem; font-weight: 700; }
.calc-line dd { display: contents; }
.calc-line dd b { grid-column: 2; grid-row: 1; font-size: .98rem; font-weight: 800; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-line dd small { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; font-weight: 600; }
.calc-line dd small:empty { display: none; }
.calc-result:not([data-state="ready"]) .calc-line dd b { color: #9aaac0; font-weight: 700; }
.calc-total {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 14px; margin-top: 14px;
  padding: 15px 18px; border-radius: 16px; background: var(--concept-blue, #1559d9); color: #fff;
  transition: background .25s ease, color .25s ease;
}
.calc-result:not([data-state="ready"]) .calc-total { background: #edf3fc; color: #50648a; }
.calc-total span { font-weight: 800; }
.calc-total strong { font-size: clamp(1.35rem, 2.3vw, 1.75rem); letter-spacing: -.03em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-total small { grid-column: 1 / -1; justify-self: end; color: #d9e7ff; font-size: .85rem; font-weight: 700; }
.calc-total small:empty { display: none; }
.calc-flash { animation: calc-flash .7s ease-out; }
@keyframes calc-flash {
  0% { box-shadow: 0 0 0 0 #1559d955; transform: scale(1); }
  35% { box-shadow: 0 0 0 7px #1559d922; transform: scale(1.015); }
  100% { box-shadow: 0 0 0 12px #1559d900; transform: scale(1); }
}
.calc-with-car { display: flex; justify-content: space-between; gap: 14px; margin-top: 10px; padding: 0 4px; color: #2b3d59; font-size: .9rem; font-weight: 700; }
.calc-with-car b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-compare { margin-top: 10px; padding: 10px 13px; border: 1px solid #ffd9a8; border-radius: 12px; background: #fff8ec; color: #6b4300; font-size: .85rem; font-weight: 700; line-height: 1.4; }
.calc-compare[hidden] { display: none; }
.calc-meta { margin-top: 10px; color: var(--muted); font-size: .78rem; font-weight: 600; line-height: 1.5; }
.calc-meta:empty { display: none; }
.calc-note { margin-top: auto; padding-top: 14px; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.calc-insure {
  align-self: stretch; min-height: 54px; margin-top: 12px; font-size: .95rem;
  border-color: #c9dbf6; background: #fff; color: var(--concept-blue, #1559d9);
}
.calc-insure:hover { background: #f1f6ff; color: #0d47b8; box-shadow: none; }

/* ---- Rate tables ---- */
.calc-tables-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: clamp(18px, 2.5vw, 30px); }
.rate-block { border: 1px solid var(--line); border-radius: 22px; background: #fff; }
.rate-block > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; list-style: none; cursor: pointer; }
.rate-block > summary::-webkit-details-marker { display: none; }
.rate-block > summary h3 { font-size: clamp(1.05rem, 1.6vw, 1.25rem); letter-spacing: -.03em; }
.rate-block > summary .icon { flex: 0 0 auto; width: 20px; height: 20px; color: var(--concept-blue, #1559d9); transition: transform .2s; }
.rate-block[open] > summary .icon { transform: rotate(180deg); }
.rate-block-body { padding: 0 22px 22px; }
.rate-block-body h4 { margin: 22px 0 10px; font-size: 1rem; letter-spacing: -.02em; }
.rate-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.rate-scroll:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
/* A short table gets a frame of its own size, not an empty full-width box. */
.rate-scroll:has(> .rate-table-narrow) { width: fit-content; max-width: 100%; }
.rate-table { width: 100%; border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums; }
.rate-table th, .rate-table td { padding: 8px 7px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.rate-table thead th { position: sticky; top: 0; background: #f3f8ff; color: #2b3d59; font-weight: 800; }
.rate-table th[scope="row"], .rate-table thead th:first-child { position: sticky; left: 0; z-index: 1; text-align: left; background: #f8fbff; font-weight: 750; box-shadow: 1px 0 0 var(--line); }
.rate-table tbody tr:last-child > * { border-bottom: 0; }
.rate-table tbody tr:hover td { background: #f5f9ff; }
.rate-table-narrow { width: auto; min-width: min(100%, 420px); }
.rate-table-narrow th, .rate-table-narrow td { padding-inline: 14px; }
.rate-table-narrow td:first-child { text-align: left; }
.rate-note { margin-top: 10px; color: var(--muted); font-size: .86rem; font-weight: 600; }
.rate-list { margin: 0; padding-left: 20px; color: #2b3d59; font-size: .9rem; font-weight: 650; }

/* In the visual editor every part is visible so that its texts can be edited. */
html.cms-editing .calc [hidden] { display: revert !important; }
html.cms-editing .calc-line { display: grid !important; }

@media (max-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr); }
  .calc-note { margin-top: 0; }
}
@media (max-width: 700px) {
  .calc { padding: 6px; border-radius: 22px; }
  .calc-form, .calc-result { padding: 18px 14px; border-radius: 17px; }
  .calc-fields { gap: 14px; }
  .calc-picker label, .calc-picker label:nth-child(n+4) { grid-column: auto; }
  .calc-picker span { min-height: 46px; font-size: .74rem; }
  .calc-money-row { grid-template-columns: minmax(0, 1fr) 86px; }
  .calc-total { padding: 14px 15px; }
  .rate-block > summary { padding: 15px 16px; }
  .rate-block-body { padding: 0 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .calc-total { transition: none; }
  .calc-flash { animation: none; }
}
