/* Scheduler modal (Google Calendar Appointment Scheduling).
   Shared by /request-demo/ and paid LPs with a demo form.
   forms.js creates #wk-calendly-modal after a successful demo submit. */

.wk-calendly-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    /* dvh geeft op iOS de correcte beschikbare hoogte zonder clipping door de adresbalk */
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    box-sizing: border-box;
    padding: 16px;
}

.wk-calendly-modal * {
    box-sizing: border-box;
}

.wk-calendly-modal.active {
    opacity: 1;
    visibility: visible;
}

.wk-calendly-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 1100px;
    height: 100%;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 30px;
    position: relative;
}

.wk-calendly-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: #f1f1f1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px;
    font-weight: bold;
    color: #333;
    transition: background-color 0.2s;
    border: none;
    z-index: 10;
}

.wk-calendly-close:hover {
    background-color: #e0e0e0;
}

.wk-calendly-header {
    text-align: center;
    margin-bottom: 25px;
    flex-shrink: 0;
}

.wk-calendly-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.wk-calendly-subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
}

.wk-calendly-iframe-container {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0; /* Nodig in flex-kolommen zodat de iframe krimpen kan i.p.v. overlopen */
    overflow: hidden;
    -webkit-overflow-scrolling: touch; /* Soepel scrollen op iOS */
}

.wk-calendly-iframe-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: 100%; /* Voorkom horizontale overflow in smalle viewports */
    border: 0;
    display: block;
}

/*
 * Tablet / medium schermen.
 * De ingesloten Google Calendar scheduler heeft een vaste min-breedte (~800px) voor
 * zijn 2-koloms desktoplayout. Tussen ~600px en ~840px iframe-breedte kapt die layout
 * rechts af zonder horizontale scroll. We dwingen daarom de smalle 1-koloms layout af
 * door de modal-breedte te beperken (iframe blijft <= ~580px = 1 kolom). De 2-koloms
 * layout laten we pas toe vanaf >= 993px viewport, waar het iframe ruim genoeg is.
 */
@media (max-width: 992px) {
    .wk-calendly-modal {
        padding: 16px;
    }

    .wk-calendly-container {
        max-width: 600px;
        padding: 24px;
        max-height: 760px;
    }

    .wk-calendly-title {
        font-size: 24px;
    }

    .wk-calendly-subtitle {
        font-size: 16px;
        margin-bottom: 10px;
    }
}

/* Telefoon (portrait) */
@media (max-width: 576px) {
    .wk-calendly-modal {
        padding: 0; /* Modal neemt volledige viewport in */
    }

    .wk-calendly-container {
        max-width: none; /* Volledig scherm op telefoon */
        padding: 15px;
        border-radius: 0;
        max-height: none;
    }

    .wk-calendly-header {
        margin-bottom: 15px;
        padding-right: 40px; /* Ruimte voor de close-knop rechtsboven */
    }

    .wk-calendly-title {
        font-size: 20px;
        margin-bottom: 5px;
    }

    .wk-calendly-subtitle {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .wk-calendly-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}

/* Lage viewports (bv. landscape telefoon), compacte header zodat de iframe voldoende ruimte houdt */
@media (max-height: 600px) {
    .wk-calendly-container {
        padding: 12px 16px;
    }

    .wk-calendly-header {
        margin-bottom: 8px;
    }

    .wk-calendly-title {
        font-size: 16px;
        margin-bottom: 2px;
    }

    .wk-calendly-subtitle {
        font-size: 12px;
        margin-bottom: 0;
    }

    .wk-calendly-close {
        top: 6px;
        right: 6px;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}

/* Loading indicator voor Calendar iframe */
.wk-calendly-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 5;
}

.wk-calendly-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
    border: 4px solid rgba(0, 123, 255, 0.3);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: calendly-spinner 1s ease-in-out infinite;
}

.wk-calendly-loader-text {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

@keyframes calendly-spinner {
    to { transform: rotate(360deg); }
}

/* Verberg loader nadat iframe is geladen */
.wk-calendly-iframe-loaded .wk-calendly-loader {
    display: none;
}
