.sha-hubspot-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    background: transparent;
    border: none;
    margin: 0;
    padding: 0;
}

.sha-hubspot-modal.modal-hubspot-is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

 

.sha-hubspot-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    cursor: pointer;
    pointer-events: none;
    transition: backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
    z-index: 1;
}

.sha-hubspot-modal.modal-hubspot-is-active .sha-hubspot-modal__overlay {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
}

/* Modal HubSpot - Header fijo + scroll en body v2 */
.sha-hubspot-modal__content {
    position: relative;
    background: white;
    border-radius: 0;
    padding: 0;
    max-width: 600px;
    width: 600px;
    height: 100vh !important;
    overflow: hidden !important; /* Sin scroll aquí, solo en el body */
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    z-index: 2;
    opacity: 0;
    transform: translateX(100%);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin: 0;
    display: flex !important;
    flex-direction: column !important;
    
    /* Permitir focus para scroll con teclado */
    outline: none;
}

.sha-hubspot-modal.modal-hubspot-is-active .sha-hubspot-modal__content {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.sha-hubspot-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 40px;
    font-weight: 100;
    color: #666;
    cursor: pointer;
    z-index: 3;
    line-height: 1;
    transition: color 0.2s ease;
    background: transparent;
    border: none;
    margin: 0;
    padding: 10px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sha-hubspot-modal__close:hover {
    color: #333;
}

.sha-hubspot-modal__header {
    display: none; /* Ocultar header, el form ya trae el título */
}

.sha-hubspot-modal__header .title-M,
.sha-hubspot-modal__header .title-S {
    color: #333;
    margin: 0;
}

.sha-hubspot-modal__body {
    flex: 1 1 0 !important; /* Toma el espacio restante */
    min-height: 0 !important; /* Permite que el overflow funcione */
    padding: 80px 40px 40px; /* Más espacio arriba para el botón de cierre */
    overflow-y: scroll !important; /* Scroll siempre visible */
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.sha-hubspot-modal__body::-webkit-scrollbar {
    width: 10px;
}

.sha-hubspot-modal__body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

.sha-hubspot-modal__body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

.sha-hubspot-modal__body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Asegurar que el contenido del form pueda crecer */
.sha-hubspot-modal__body > * {
    max-width: 100%;
    box-sizing: border-box;
}

.sha-hubspot-modal__body .hubspot-form-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.sha-hubspot-modal__body iframe {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 400px;
    box-sizing: border-box;
}

.sha-hubspot-modal__body .hs-form-wrapper,
.sha-hubspot-modal__body form {
    min-height: 400px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Prevenir zoom automático en inputs en mobile (aplica a todos los modales HubSpot) */
.sha-hubspot-modal__body input,
.sha-hubspot-modal__body textarea,
.sha-hubspot-modal__body select {
    font-size: 16px !important; /* iOS no hace zoom si el font-size es >= 16px */
    max-width: 100%;
    box-sizing: border-box;
}

body.modal-hubspot-body-is-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .sha-hubspot-modal {
        justify-content: center;
        height: 100dvh; /* Dynamic viewport height para mobile */
    }
    
    .sha-hubspot-modal__content {
        width: 100%;
        max-width: 100%;
        height: 100dvh !important; /* Dynamic viewport height - se ajusta a la barra del navegador */
        padding: 0;
        border-radius: 0;
    }

    .sha-hubspot-modal__close {
        top: 15px;
        right: 15px;
        font-size: 36px;
        font-weight: 100;
        width: 50px;
        height: 50px;
        padding: 8px;
    }

    .sha-hubspot-modal__header {
        padding: 30px 20px 20px;
        padding-right: 50px;
    }

    .sha-hubspot-modal__header .title-M,
    .sha-hubspot-modal__header .title-S {
        font-size: 20px;
    }

    .sha-hubspot-modal__body {
        padding: 70px 20px 20px; /* Más espacio arriba en mobile */
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: scroll !important;
        overflow-x: hidden !important;
        max-width: 100vw;
        box-sizing: border-box;
    }

    .sha-hubspot-modal__body .hubspot-form-container {
        max-width: 100%;
        overflow: hidden;
    }

    .sha-hubspot-modal__body iframe,
    .sha-hubspot-modal__body .hs-form-wrapper,
    .sha-hubspot-modal__body form {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Prevenir zoom automático en inputs en mobile (refuerzo) */
    .sha-hubspot-modal__body input,
    .sha-hubspot-modal__body textarea,
    .sha-hubspot-modal__body select {
        font-size: 16px !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Asegurar que el contenido no se salga al hacer focus en mobile */
    .sha-hubspot-modal__content {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
}