/* ==========================================================================
   MODAL.CSS — Component .modal
   Variants: activada amb classe .modal--active
   IDs: #modal-first-appointment (psico/general), #modal-fisio-appointment (fisio)
   ========================================================================== */

.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: flex-start;
    z-index: 2000;
    padding: 2rem 1.5rem;
    overflow-y: auto;
    transition: opacity 0.3s ease;
}

/* Estat actiu */
.modal.active {
    display: flex;
}

/* Targeta interior */
.modal__card {
    background-color: var(--color-white);
    color: var(--color-text-body);
    width: 100%;
    max-width: 540px;
    padding: 3rem;
    border-radius: 16px;
    position: relative;
    box-shadow: var(--shadow-modal);
    animation: modalSlideIn 0.3s ease-out;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

/* Variant amplia per al widget de Doctoralia */
.modal__card--wide {
    max-width: 800px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Botó de tancar */
.modal__close {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    font-size: 1.5rem;
    color: var(--color-grey-hint);
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    transition: color 0.2s ease;
}

.modal__close:hover {
    color: var(--color-black-soft);
}

/* Contingut */
.modal__body {
    text-align: center;
}

.modal__title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-black-soft);
    margin-bottom: 0.5rem;
}

.modal__subtitle {
    font-size: 1rem;
    color: var(--color-grey-muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.modal__trust {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--color-grey-muted, #888);
    margin: 1.25rem 0 1.75rem;
    flex-wrap: wrap;
}

.modal__cta-doctoralia {
    display: block;
    width: 100%;
    font-size: 1.05rem;
    padding: 0.9rem 1.5rem;
    margin-bottom: 1rem;
}

.modal__fine-print {
    font-size: 0.78rem;
    color: var(--color-grey-hint, #bbb);
    margin: 0;
}

.modal__info {
    font-size: 0.85rem;
    color: var(--color-grey-hint);
    margin-bottom: 2rem;
}

/* CRM iframe sizing inside modal forms */
#hubspot-modal-form iframe,
#hubspot-fisio-form iframe,
#hs-form-primera-consulta iframe,
#hs-form-psico iframe,
#hs-form-fisio iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    height: clamp(240px, 34vh, 320px); /* small forms avoid large empty area; can still grow via postMessage */
    border: 0;
    transition: height 0.2s ease;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 600px) {
    .modal {
        padding: 1rem;
    }

    .modal__card {
        padding: 2rem 1.25rem;
        max-height: calc(100vh - 2rem);
    }

    .modal__title {
        font-size: 1.5rem;
    }

    #hubspot-modal-form iframe,
    #hubspot-fisio-form iframe,
    #hs-form-primera-consulta iframe,
    #hs-form-psico iframe,
    #hs-form-fisio iframe {
        height: clamp(220px, 42vh, 300px);
    }
}