/*
 * Customs clearance calculator. Scoped under the wrapper, with !important only
 * where the Motors theme's global button / form styles would otherwise win.
 */
.ccc-calculator-wrapper {
    --ccc-red: #d71e0f;
    --ccc-red-soft: #fdf1f0;
    --ccc-text: #1f2328;
    --ccc-muted: #6b7280;
    --ccc-line: #e3e5e8;
    --ccc-panel: #f6f7f9;
    --ccc-control-height: 48px;
    --ccc-radius: 10px;

    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    gap: 24px;
    width: 100%;
    box-sizing: border-box;
    padding: 24px;
    background: #fff;
    border-radius: 14px;
    color: var(--ccc-text);
}

.ccc-calculator-wrapper *,
.ccc-calculator-wrapper *::before,
.ccc-calculator-wrapper *::after {
    box-sizing: border-box;
}

/* Form */
#ccc-calculator-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
    margin: 0;
}

.ccc-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.ccc-field[hidden] {
    display: none;
}

.ccc-calculator-wrapper .ccc-label {
    display: block;
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--ccc-muted);
}

.ccc-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    align-items: end;
    gap: 16px;
}

.ccc-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--ccc-text);
    cursor: pointer;
}

.ccc-checkbox[hidden] {
    display: none;
}

.ccc-checkbox input {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--ccc-red);
}

.ccc-calculator-wrapper .ccc-control {
    display: block;
    width: 100%;
    height: var(--ccc-control-height);
    margin: 0;
    padding: 0 14px;
    border: 1px solid var(--ccc-line);
    border-radius: var(--ccc-radius);
    background-color: #fff;
    box-shadow: none;
    font-family: inherit;
    font-size: 15px;
    line-height: normal;
    color: var(--ccc-text);
    /* Motors hides native selects until it swaps in its own dropdown; ours stays native. */
    opacity: 1;
    visibility: visible;
    transition: border-color 0.2s ease;
}

.ccc-calculator-wrapper .ccc-control:hover {
    border-color: #c4c8cf;
}

.ccc-calculator-wrapper .ccc-control:focus {
    border-color: var(--ccc-red);
    outline: none;
}

.ccc-calculator-wrapper select.ccc-control {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

/* Option buttons: equal-width segments that fill the row. */
.ccc-radio-group {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 8px;
}

.ccc-calculator-wrapper .ccc-radio-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: var(--ccc-control-height);
    margin: 0;
    padding: 0 8px !important;
    border: 1px solid var(--ccc-line) !important;
    border-radius: var(--ccc-radius) !important;
    background: #fff !important;
    box-shadow: none !important;
    font-family: inherit;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ccc-text) !important;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.ccc-calculator-wrapper .ccc-radio-btn:hover {
    border-color: #c4c8cf !important;
}

.ccc-calculator-wrapper .ccc-radio-btn:focus-visible {
    outline: 2px solid var(--ccc-red);
    outline-offset: 2px;
}

.ccc-calculator-wrapper .ccc-radio-btn.active {
    border-color: var(--ccc-red) !important;
    background: var(--ccc-red-soft) !important;
    color: var(--ccc-red) !important;
    font-weight: 600 !important;
}

.ccc-error {
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--ccc-radius);
    background: var(--ccc-red-soft);
    color: var(--ccc-red);
    font-size: 14px;
}

.ccc-error[hidden] {
    display: none;
}

/* Results */
#ccc-results {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px;
    border-radius: 12px;
    background: var(--ccc-panel);
    transition: opacity 0.2s ease;
}

#ccc-results.is-loading {
    opacity: 0.55;
}

.ccc-tariff-toggle .ccc-radio-btn {
    height: 42px;
}

.ccc-tariff-note {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ccc-muted);
}

.ccc-total {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ccc-line);
}

.ccc-calculator-wrapper #total-cost {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ccc-text);
}

#ccc-regime {
    font-size: 12px;
    line-height: 1.4;
    color: var(--ccc-muted);
}

.ccc-details {
    padding-top: 6px;
}

.ccc-detail-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    font-size: 14px;
    line-height: 1.4;
}

.ccc-detail-row span {
    color: var(--ccc-muted);
}

.ccc-detail-row small {
    color: #9ca3af;
}

.ccc-detail-row b {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--ccc-text);
}

.ccc-fees summary {
    list-style: none;
    cursor: pointer;
}

.ccc-fees summary::-webkit-details-marker {
    display: none;
}

.ccc-fees summary span::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin: 0 0 3px 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.ccc-fees[open] summary span::after {
    margin-bottom: -1px;
    transform: rotate(-135deg);
}

#ccc-fees {
    margin: 0 0 4px;
    padding-left: 12px;
    border-left: 2px solid var(--ccc-line);
}

#ccc-fees .ccc-detail-row {
    padding: 6px 0;
    font-size: 13px;
}

.ccc-compare {
    margin-top: 12px;
    padding: 12px 14px 6px;
    border-radius: var(--ccc-radius);
    background: #fff;
}

.ccc-compare .ccc-detail-row {
    padding: 6px 0;
}

.ccc-compare .ccc-detail-row:last-child {
    border-top: 1px solid var(--ccc-line);
}

.ccc-disclaimer {
    margin: 12px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--ccc-line);
    font-size: 12px;
    line-height: 1.5;
    color: var(--ccc-muted);
}

.ccc-disclaimer a {
    color: var(--ccc-red);
}

/* Tablet: results drop under the form. */
@media (max-width: 1024px) {
    .ccc-calculator-wrapper {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Phone */
@media (max-width: 600px) {
    .ccc-calculator-wrapper {
        --ccc-control-height: 46px;

        gap: 16px;
        padding: 16px;
        border-radius: 12px;
    }

    #ccc-calculator-form {
        gap: 16px;
    }

    .ccc-radio-group--fuel {
        grid-auto-flow: row;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ccc-calculator-wrapper .ccc-radio-btn {
        font-size: 13px !important;
    }

    .ccc-inputs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    #ccc-results {
        padding: 16px;
    }

    .ccc-calculator-wrapper #total-cost {
        font-size: 30px;
    }
}
