/*
 * Delivery price calculator.
 *
 * Every class is prefixed dpc- on purpose: style.css defines global .btn, .form-card,
 * .wrap and bare element rules, and an unprefixed .field or .toggle here would leak
 * into the rest of the site. Colours come from the existing custom properties so the
 * page inherits the site palette rather than restating it.
 */

.dpc-calculator {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 30px;
    align-items: start;
    margin: 40px 0 60px;
}

.dpc-form {
    padding: 30px;
    box-shadow: var(--shadow);
}

/* ---------- blocks ---------- */

.dpc-block {
    border: 0;
    padding: 0;
    margin: 0 0 28px;
}

.dpc-block:last-of-type {
    margin-bottom: 20px;
}

.dpc-legend {
    padding: 0;
    margin: 0 0 14px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- vehicle type grid ---------- */

.dpc-vehicle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
}

.dpc-vehicle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 86px;
    padding: 12px 8px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--nav-radius);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, color .15s ease;
}

.dpc-vehicle i {
    font-size: 20px;
    color: var(--muted);
    transition: color .15s ease;
}
.dpc-vehicle svg {
    font-size: 40px;    
}
.dpc-vehicle:hover {
    border-color: var(--brand);
}

.dpc-vehicle.is-active {
    border-color: var(--brand);
    color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand) inset;
}

.dpc-vehicle.is-active i {
    color: var(--brand);
}

.dpc-vehicle:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ---------- capacity toggle ---------- */

.dpc-toggle {
    display: inline-flex;
    padding: 4px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--nav-radius);
}

.dpc-toggle-btn {
    padding: 10px 22px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.dpc-toggle-btn.is-active {
    background: var(--brand);
    color: var(--white);
}

.dpc-toggle-btn:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ---------- fields ---------- */

.dpc-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.dpc-fields--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dpc-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.dpc-field select,
.dpc-field input[type="number"] {
    width: 100%;
    padding: 11px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--nav-radius);
    color: var(--ink);
    font: inherit;
}

.dpc-field select:focus,
.dpc-field input:focus {
    outline: 0;
    border-color: var(--brand);
}

.dpc-field select:disabled {
    background: var(--bg);
    color: var(--muted);
    cursor: not-allowed;
}

.dpc-money {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--nav-radius);
}

.dpc-money span {
    color: var(--muted);
    font-weight: 600;
}

.dpc-money input[type="number"] {
    border: 0;
    padding-left: 0;
}

.dpc-money:focus-within {
    border-color: var(--brand);
}

.dpc-money input:focus {
    border-color: transparent;
}

/* ---------- transit indicator ---------- */

.dpc-transit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 9px 14px;
    background: rgba(232, 58, 66, .07);
    border-radius: 999px;
    font-size: 14px;
    color: var(--ink);
}

.dpc-transit i {
    color: var(--brand);
}

.dpc-transit-label {
    color: var(--muted);
}

.dpc-transit-value {
    color: var(--brand);
}

/* ---------- insurance ---------- */

.dpc-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 600;
}

.dpc-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    cursor: pointer;
}

.dpc-insurance-panel {
    margin-top: 16px;
}

/* ---------- errors ---------- */

.dpc-error {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--brand);
}

.dpc-field select[aria-invalid="true"],
.dpc-field input[aria-invalid="true"] {
    border-color: var(--brand);
}

/* ---------- submit ---------- */

.dpc-submit {
    /* width: 100%; */
    padding: 15px 30px;
    font-size: 16px;
}

.dpc-submit[disabled] {
    opacity: .6;
    cursor: progress;
}

/* ---------- receipt ---------- */

.dpc-receipt {
    position: sticky;
    top: 100px;
    padding: 26px;
    box-shadow: var(--shadow);
}

.dpc-receipt-empty {
    text-align: center;
    color: var(--muted);
    padding: 30px 10px;
}

.dpc-receipt-empty i {
    font-size: 34px;
    color: var(--line);
    margin-bottom: 14px;
    display: block;
}

.dpc-receipt-empty p {
    margin: 0;
    font-size: 14px;
}

.dpc-receipt-error {
    padding: 16px;
    background: rgba(232, 58, 66, .07);
    border-radius: var(--nav-radius);
    color: var(--brand);
    font-size: 14px;
}

.dpc-receipt-title {
    margin: 0 0 4px;
    font-size: 18px;
}

.dpc-receipt-route {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.dpc-receipt-transit {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--muted);
}

.dpc-lines {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dpc-lines li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 15px;
}

.dpc-lines li span {
    color: var(--muted);
}

.dpc-lines li strong {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dpc-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 2px dashed var(--line);
}

.dpc-total span {
    font-weight: 700;
}

.dpc-total strong {
    font-size: 26px;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.dpc-disclaimer {
    margin: 18px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

/* ---------- responsive ---------- */

@media (max-width: 980px) {
    .dpc-calculator {
        grid-template-columns: minmax(0, 1fr);
    }

    .dpc-receipt {
        position: static;
    }

    .dpc-fields,
    .dpc-fields--two {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    .dpc-form {
        padding: 20px;
    }

    .dpc-vehicle-grid {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    }

    .dpc-toggle {
        display: flex;
        width: 100%;
    }

    .dpc-toggle-btn {
        flex: 1;
        padding: 10px 12px;
    }
}

/* ---------- insurance options ---------- */

.dpc-radios {
    display: grid;
    gap: 8px;
}

.dpc-radio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--nav-radius);
    cursor: pointer;
    font-size: 14px;
    transition: border-color .15s ease;
}

.dpc-radio:hover {
    border-color: var(--brand);
}

.dpc-radio input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
    cursor: pointer;
    flex: none;
}

.dpc-radio:has(input:checked) {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand) inset;
}

/* ---------- insurance terms ---------- */

.dpc-terms-summary,
.dpc-terms-warning {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 0;
    padding: 10px 14px;
    border-radius: var(--nav-radius);
    font-size: 13px;
    line-height: 1.5;
}

.dpc-terms-summary {
    background: var(--bg);
    color: var(--ink);
}

.dpc-terms-summary i {
    color: var(--brand);
}

/* Declining cover is the one choice with no safety net, so it is stated in the
   brand colour rather than as quiet helper text. */
.dpc-terms-warning {
    background: rgba(232, 58, 66, .07);
    color: var(--brand);
    font-weight: 600;
}

.dpc-terms-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.dpc-terms-link:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ---------- terms modal ---------- */

.dpc-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.dpc-modal[hidden] {
    display: none;
}

.dpc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(16, 19, 24, .55);
}

.dpc-modal-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(640px, 100%);
    max-height: min(80vh, 720px);
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(16, 19, 24, .3);
}

.dpc-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line);
}

.dpc-modal-head h3 {
    margin: 0;
    font-size: 18px;
}

.dpc-modal-close {
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.dpc-modal-close:hover {
    color: var(--brand);
}

.dpc-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.dpc-terms-list {
    margin: 14px 0;
    padding-left: 20px;
}

.dpc-terms-list li {
    margin-bottom: 10px;
}

.dpc-terms-placeholder {
    margin: 14px 0 0;
    padding-top: 14px;
    border-top: 1px dashed var(--line);
    color: var(--muted);
    font-size: 13px;
}

.dpc-modal-foot {
    padding: 16px 24px;
    border-top: 1px solid var(--line);
    text-align: right;
}

/* ---------- EUR total ---------- */

.dpc-total-eur {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

.dpc-total-eur strong {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
