/* Phase 5 — Checkout Styling */

/* ===================================================================
   Base wrapper + stap-indicator
   =================================================================== */

.cbv-checkout-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Stap-indicator */
.cbv-step-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.cbv-step-indicator__step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #999;
    font-weight: 500;
    transition: color 0.2s;
}

.cbv-step-indicator__step--active {
    color: #2c2c2c;
}

.cbv-step-indicator__step--done {
    color: #5a8a3c;
}

.cbv-step-indicator__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    font-size: 0.875rem;
    font-weight: 700;
    transition: background 0.2s, color 0.2s;
}

.cbv-step-indicator__step--active .cbv-step-indicator__number {
    background: #2c2c2c;
    color: #fff;
}

.cbv-step-indicator__step--done .cbv-step-indicator__number {
    background: #5a8a3c;
    color: #fff;
}

.cbv-step-indicator__divider {
    flex: 1;
    height: 1px;
    background: #e0e0e0;
    margin: 0 1rem;
}

/* ===================================================================
   Step show/hide — bulletproof: beats any grid rule that might apply.
   =================================================================== */
.cbv-checkout-step.cbv-step-hidden,
.cbv-checkout-step[hidden] {
    display: none !important;
}

/* ===================================================================
   Layout: 2-kolom grid
   =================================================================== */

.cbv-checkout-layout {
    display: grid;
    gap: 2rem;
    align-items: start;
}

/* Stap 1: 70% / 30% */
.cbv-checkout-layout--70-30 {
    grid-template-columns: 7fr 3fr;
}

/* Stap 2: 50% / 50% */
.cbv-checkout-layout--50-50 {
    grid-template-columns: 1fr 1fr;
}

/* Sticky rechterkolom (stap 1) */
.cbv-checkout-col--sticky {
    position: sticky;
    top: 20px;
    align-self: start;
}

/* ===================================================================
   Secties en formulier-elementen
   =================================================================== */

.cbv-checkout-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.cbv-checkout-section:last-child {
    border-bottom: none;
}

.cbv-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #2c2c2c;
}

.cbv-field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: #444;
    font-size: 0.9rem;
}

.cbv-field-label .required {
    color: #c00;
    margin-left: 2px;
}

.cbv-checkout-col--form input[type="text"],
.cbv-checkout-col--form input[type="email"],
.cbv-checkout-col--form input[type="tel"],
.cbv-checkout-col--form input[type="number"],
.cbv-checkout-col--form textarea,
.cbv-checkout-col--form select,
.cbv-addon-select,
input.cbv-datepicker-input,
.cbv-quantity-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #333;
    background: #fff;
    transition: border-color 0.15s;
    box-sizing: border-box;
    height: auto;
}

/* Selects need explicit appearance reset + chevron so their height matches inputs across browsers/OS. */
.cbv-checkout-col--form select,
.cbv-addon-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    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 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.cbv-checkout-col--form input:focus,
.cbv-checkout-col--form textarea:focus,
.cbv-checkout-col--form select:focus,
input.cbv-datepicker-input:focus {
    outline: none;
    border-color: #2c2c2c;
    box-shadow: 0 0 0 2px rgba(44, 44, 44, 0.1);
}

/* Datum-input: kalender-icoon */
input.cbv-datepicker-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23555' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Datum-velden: naast elkaar in stap 1 */
.cbv-dates-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.5rem;
}

.cbv-dates-section .cbv-huurperiode-hint,
.cbv-dates-section #cbv-dates-status {
    grid-column: 1 / -1;
}

p#cbv-dates-status {
    margin-top: 0;
}

/* Helper tekst */
.cbv-checkout-helper {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
    margin-bottom: 0;
}

.cbv-no-options {
    color: #888;
    font-style: italic;
}

/* Inline status onder addon-velden (✓ Toegevoegd, ⏳ Bezig…). */
.cbv-addon-status {
    display: none;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e8e3e;
}

.cbv-addon-status.cbv-status-loading {
    display: block;
    color: #555;
    font-weight: 400;
}

.cbv-addon-status.cbv-status-added {
    display: block;
    color: #1e8e3e;
    animation: cbv-fade-in 0.2s ease;
}

.cbv-addon-status.cbv-status-error {
    display: block;
    color: #c00;
}

@keyframes cbv-fade-in {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Adres-details (straat + woonplaats): ingeklapt tot autofill of handmatige
   onthulling; zachte fade-in bij het tonen. */
.cbv-address-details--hidden {
    display: none;
}

.cbv-address-details--reveal {
    animation: cbv-fade-in 0.25s ease;
}

.cbv-address-hint {
    color: #b26a00;
}

/* Summary pulse — flashes when items change so the user notices the cart updated. */
@keyframes cbv-summary-pulse {
    0%   { background-color: rgba( 253, 206, 7, 0 ); }
    20%  { background-color: rgba( 253, 206, 7, 0.35 ); }
    100% { background-color: rgba( 253, 206, 7, 0 ); }
}

.cbv-order-summary.cbv-pulse {
    animation: cbv-summary-pulse 0.9s ease;
}

/* Loading-staat: order-summary wordt gedimd + spinner terwijl WC de
   bezorgkosten herberekent. Geeft duidelijke "bezig"-feedback die de
   native WC blockUI-overlay in deze custom layout niet biedt. */
.cbv-order-summary {
    position: relative;
}

.cbv-order-summary--loading {
    opacity: 0.55;
    transition: opacity 0.15s ease;
    pointer-events: none;
}

.cbv-order-summary--loading::after {
    content: "";
    position: absolute;
    top: 18px;
    right: 18px;
    width: 22px;
    height: 22px;
    margin: 0;
    border: 3px solid rgba( 0, 0, 0, 0.15 );
    border-top-color: #1e8e3e;
    border-radius: 50%;
    animation: cbv-spin 0.7s linear infinite;
}

@keyframes cbv-spin {
    to { transform: rotate( 360deg ); }
}

/* Kleine spinner in de statusregel onder het adresveld. */
.cbv-addon-status.cbv-status-loading::before {
    content: "";
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 6px;
    vertical-align: -1px;
    border: 2px solid rgba( 0, 0, 0, 0.2 );
    border-top-color: #555;
    border-radius: 50%;
    animation: cbv-spin 0.7s linear infinite;
}

/* Info icoon + custom tooltip (data-cbv-tooltip).
   Werkt op hover, focus (keyboard) en tap (mobiel via :focus).
   Native [title] werkt nog als fallback. */
.cbv-info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #112e51;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    cursor: help;
    margin-left: 0.4rem;
    vertical-align: middle;
    line-height: 1;
}

.cbv-info-icon:focus { outline: 2px solid #fdce07; outline-offset: 2px; }

.cbv-info-icon[data-cbv-tooltip]::after {
    content: attr(data-cbv-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: #112e51;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 400;
    font-style: normal;
    font-family: inherit;
    line-height: 1.35;
    padding: 8px 10px;
    border-radius: 4px;
    white-space: normal;
    width: max-content;
    max-width: 240px;
    text-align: left;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 100;
}

.cbv-info-icon[data-cbv-tooltip]::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%) translateY(2px);
    border: 5px solid transparent;
    border-top-color: #112e51;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 100;
}

.cbv-info-icon[data-cbv-tooltip]:hover::after,
.cbv-info-icon[data-cbv-tooltip]:focus::after,
.cbv-info-icon[data-cbv-tooltip]:hover::before,
.cbv-info-icon[data-cbv-tooltip]:focus::before {
    opacity: 1;
}

/* Addon sectie controls */
.cbv-addon-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.cbv-addon-rekenhulp-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Formulier rijen */
.cbv-form-row--half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cbv-form-field--100 {
    margin-bottom: 1rem;
}

.cbv-form-field--50 {
    /* binnen grid-context */
}

/* Checkbox */
.cbv-checkbox-field {
    border-bottom: none;
    padding-bottom: 0.5rem;
}

label.cbv-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.cbv-checkbox {
    margin-top: 2px;
    flex-shrink: 0;
}

.cbv-conditional-fields {
    margin-top: 1rem;
}

/* File input */
.cbv-file-input {
    display: block;
    margin-bottom: 0.5rem;
}

.cbv-photo-preview {
    margin-top: 0.5rem;
}

.cbv-photo-preview img {
    display: block;
    border-radius: 4px;
    border: 1px solid #ddd;
    margin-bottom: 0.25rem;
}

/* ===================================================================
   Buttons
   =================================================================== */

.cbv-btn-primary,
.cbv-btn-primary.button {
    display: inline-block;
    background: #112e51;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    line-height: 1.3;
}

.cbv-btn-primary:hover,
.cbv-btn-primary.button:hover {
    background: #1c467a;
    color: #fff;
}

.cbv-btn-primary:active {
    transform: scale(0.98);
}

.cbv-btn-secondary {
    display: inline-block;
    background: transparent;
    color: #555;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.cbv-btn-secondary:hover {
    border-color: #2c2c2c;
    color: #2c2c2c;
}

.cbv-btn-full {
    width: 100%;
    display: block;
    box-sizing: border-box;
}

/* Navigatieknoppen stap 2 */
.cbv-nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: none;
}

.cbv-nav-buttons .cbv-btn-primary {
    flex: 1;
    max-width: 250px;
}

/* CTA sectie stap 1 */
.cbv-cta-section {
    border-bottom: none;
}

/* ===================================================================
   Order summary
   =================================================================== */

.cbv-order-summary {
    background: #f5f5f5;
    border-radius: 6px;
    padding: 1.5rem;
}

.cbv-order-summary__title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #ddd;
    color: #2c2c2c;
}

.cbv-order-summary__items {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.cbv-order-summary__item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.35rem 0;
    font-size: 0.9rem;
    gap: 0.5rem;
}

.cbv-order-summary__item-name {
    flex: 1;
    color: #333;
}

.cbv-order-summary__item-price {
    font-weight: 600;
    white-space: nowrap;
    color: #2c2c2c;
}

.cbv-order-summary__fee {
    color: #555;
}

.cbv-qty {
    color: #888;
    font-size: 0.85rem;
}

.cbv-order-summary__total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.75rem 0;
    border-top: 2px solid #ddd;
    font-weight: 700;
    gap: 0.5rem;
}

.cbv-order-summary__total-label {
    font-size: 0.9rem;
    color: #333;
    flex: 1;
}

.cbv-order-summary__total-price {
    font-size: 1.1rem;
    color: #2c2c2c;
    white-space: nowrap;
}

/* Datums recap in stap 2 */
.cbv-order-summary__dates {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #ddd;
    font-size: 0.875rem;
}

.cbv-order-summary__date-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    gap: 0.5rem;
}

.cbv-order-summary__date-label {
    color: #666;
}

.cbv-order-summary__date-value {
    font-weight: 600;
    color: #333;
}

.cbv-edit-dates-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #2c2c2c;
    text-decoration: underline;
    cursor: pointer;
}

.cbv-edit-dates-link:hover {
    color: #555;
}

/* Summary CTA button (stap 1) */
.cbv-order-summary__cta {
    margin-top: 1rem;
}

/* ===================================================================
   Betaalmethode + privacy
   =================================================================== */

.cbv-payment-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.cbv-privacy-text {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #888;
    line-height: 1.5;
}

.cbv-privacy-text a {
    color: #555;
    text-decoration: underline;
}

/* ===================================================================
   WC payment block aanpassing
   =================================================================== */

/* Override Divi/WC default purple-tinted background on the payment block. */
#add_payment_method #payment,
.woocommerce-cart #payment,
.woocommerce-checkout #payment {
    background: #f5f5f5;
    border-radius: 4px;
}

#payment ul.payment_methods {
    padding: 0;
    margin: 0;
}

#payment ul.payment_methods li {
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
}

/* ===================================================================
   Rekenhulp trigger aanpassing in checkout context
   =================================================================== */

.cbv-rh-trigger-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cbv-rh-trigger-label {
    font-size: 0.85rem;
    color: #666;
}

.cbv-rh-link-style {
    background: none;
    border: none;
    color: #2c2c2c;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    text-decoration: underline;
}

.cbv-rh-link-style:hover {
    color: #555;
}

/* ===================================================================
   Contact-modal (zand/tuinaarde boven container-capaciteit)
   =================================================================== */

.cbv-contact-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba( 17, 46, 81, 0.55 );
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 10000;
    animation: cbv-fade-in 0.15s ease;
}

.cbv-contact-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 420px;
    width: 100%;
    padding: 1.75rem 1.75rem 1.5rem;
    box-shadow: 0 10px 40px rgba( 0, 0, 0, 0.25 );
    text-align: left;
}

.cbv-contact-modal__title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #112e51;
    margin: 0 0 0.75rem;
}

.cbv-contact-modal__body {
    font-size: 0.95rem;
    line-height: 1.5;
    color: #333;
    margin: 0 0 1.25rem;
}

.cbv-contact-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cbv-contact-modal__actions .cbv-btn-primary {
    display: inline-block;
    width: auto;
}

/* ===================================================================
   Mobile: < 768px — single-column stack
   =================================================================== */

@media ( max-width: 767px ) {

    .cbv-checkout-layout--70-30,
    .cbv-checkout-layout--50-50 {
        grid-template-columns: 1fr;
    }

    /* Sticky wordt inline op mobiel */
    .cbv-checkout-col--sticky {
        position: static;
        top: auto;
    }

    /* Besteloverzicht ONDERaan op mobiel: de klant vult eerst z'n keuzes/
       gegevens in en ziet daarna pas de samenvatting + de knop naar stap 2. */
    .cbv-checkout-step--1 .cbv-checkout-col--summary {
        order: 1;
    }

    /* Verberg de losse 'Door naar de volgende stap'-knop bóven het overzicht
       op mobiel; de knop ónder het besteloverzicht blijft staan, zodat de
       klant niet meteen kan doorklikken vóór de velden zijn ingevuld. */
    .cbv-checkout-step--1 .cbv-cta-section {
        display: none;
    }

    /* Info-tooltip: op smalle schermen niet meer op het icoon centreren
       (liep buiten beeld), maar over de volle sectiebreedte tonen. */
    .cbv-section-title {
        position: relative;
    }

    .cbv-info-icon {
        position: static;
    }

    .cbv-info-icon[data-cbv-tooltip]::after {
        left: 0;
        right: 0;
        transform: none;
        width: auto;
        max-width: none;
    }

    .cbv-info-icon[data-cbv-tooltip]::before {
        display: none;
    }

    .cbv-dates-section {
        grid-template-columns: 1fr;
    }

    .cbv-addon-controls {
        grid-template-columns: 1fr;
    }

    .cbv-form-row--half {
        grid-template-columns: 1fr;
    }

    .cbv-nav-buttons {
        flex-direction: column;
    }

    .cbv-nav-buttons .cbv-btn-primary,
    .cbv-nav-buttons .cbv-btn-secondary {
        max-width: 100%;
        width: 100%;
    }

    .cbv-step-indicator__label {
        display: none; /* Verberg tekst op heel kleine schermen */
    }
}
