/**
 * Block Modal (hs-modal)
 * Shared modal styles for ACF blocks (hero-slider, cta-banner, cta-image, etc.)
 * Diseño basado en Figma: fondo blanco, border-radius 24px, header con título + X
 *
 * @package Menudos_Theme
 */

/* ===========================
   MODAL (hs-modal)
   =========================== */

.hs-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    /* Estado oculto */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s;
    pointer-events: none;
}

.hs-modal[aria-hidden="false"] {
    visibility: visible;
    opacity: 1;
    pointer-events: all;
}

/* Backdrop */
.hs-modal__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

/* Contenedor del modal */
.hs-modal__container {
    position: relative;
    z-index: 1;
    background-color: var(--wp--preset--color--white);
    border-radius: var(--wp--custom--border-radius--xl);
    padding: 24px;
    width: 100%;
    max-width: var(--hs-modal-max-width, 360px);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: var(--wp--custom--shadow--lg);
    box-sizing: border-box;
    /* Animación de entrada */
    transform: translateY(12px);
    transition: transform 0.25s ease;
}

.hs-modal[aria-hidden="false"] .hs-modal__container {
    transform: translateY(0);
}

/* Cabecera: título + botón cerrar */
.hs-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Título del modal */
.hs-modal__title {
    font-family: var(--wp--preset--font-family--inter);
    font-weight: 700;
    font-size: var(--wp--preset--font-size--normal);
    line-height: 1.21;
    color: var(--wp--preset--color--text-dark);
    margin: 0;
}

/* Botón cerrar (X) */
.hs-modal__close {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--wp--preset--color--text-dark);
    border-radius: var(--wp--custom--border-radius--md);
    transition: background-color 0.2s ease;
    padding: 4px;
    box-sizing: border-box;
}

.hs-modal__close:hover {
    background-color: var(--wp--preset--color--light-gray);
}

.hs-modal__close:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 2px;
}

/* Cuerpo del modal (scrollable) */
.hs-modal__body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Estilos básicos para contenido HTML dentro del modal */
.hs-modal__body p {
    margin-bottom: 1em;
    font-family: var(--wp--preset--font-family--inter);
    font-size: var(--wp--preset--font-size--normal);
    color: var(--wp--preset--color--text-gray);
    line-height: 1.6;
}

.hs-modal__body p:last-child {
    margin-bottom: 0;
}

/* ===========================
   CF7 INSIDE MODAL
   =========================== */

.hs-modal__body .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hs-modal__body .wpcf7-form p {
    margin-bottom: 0;
}

.hs-modal__body input[type="text"],
.hs-modal__body input[type="email"],
.hs-modal__body input[type="tel"],
.hs-modal__body input[type="url"],
.hs-modal__body textarea,
.hs-modal__body select {
    border: 1px solid var(--wp--preset--color--secondary, #787878);
    background-color: var(--wp--preset--color--white, #fff);
    color: var(--wp--preset--color--text-dark, #333);
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: var(--wp--custom--border-radius--sm, 4px);
    font-size: var(--wp--preset--font-size--small, 14px);
    line-height: 1.5;
    box-sizing: border-box;
}

.hs-modal__body input[type="text"]:focus,
.hs-modal__body input[type="email"]:focus,
.hs-modal__body input[type="tel"]:focus,
.hs-modal__body textarea:focus,
.hs-modal__body select:focus {
    border-color: var(--wp--preset--color--primary, #D50032);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(213, 0, 50, 0.15);
}

.hs-modal__body input[type="submit"],
.hs-modal__body .wpcf7-submit {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--wp--preset--color--primary, #D50032);
    color: var(--wp--preset--color--white, #fff);
    border: none;
    border-radius: var(--wp--custom--border-radius--sm, 4px);
    font-size: var(--wp--preset--font-size--normal, 16px);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.hs-modal__body input[type="submit"]:hover,
.hs-modal__body .wpcf7-submit:hover {
    background-color: var(--wp--preset--color--primary-hover, #B0002A);
}

.hs-modal__body .wpcf7-not-valid-tip {
    font-size: var(--wp--preset--font-size--tiny, 12px);
    color: var(--wp--preset--color--primary, #D50032);
    margin-top: 4px;
    display: block;
}

.hs-modal__body .wpcf7-response-output {
    font-size: var(--wp--preset--font-size--small, 14px);
    padding: 8px 12px;
    border-radius: var(--wp--custom--border-radius--sm, 4px);
    margin-top: 8px;
}

/* Responsive */
@media (max-width: 480px) {
    .hs-modal__container {
        max-height: 90vh;
        padding: 20px;
        border-radius: var(--wp--custom--border-radius--lg);
    }
}
