/* ==========================================================================
   VENTANA EMERGENTE (MODAL) - IESTP Carlos Salazar Romero
   Muestra el flyer de prevención en una ventana emergente accesible.
   Convención: prefijo csr- | Metodología BEM
   NOTA: los media queries de este componente están en responsive.css
   ========================================================================== */

/* ==========================================================================
   1. DISPARADOR (botón con miniatura)
   ========================================================================== */
.csr-flyer-trigger {
    position: relative;
    display: inline-block;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    border-radius: var(--csr-radius-xl, 20px);
    overflow: hidden;
    box-shadow: var(--csr-shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 320px;
}

.csr-flyer-trigger:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--csr-shadow-xl);
}

.csr-flyer-trigger img {
    display: block;
    width: 100%;
    height: auto;
}

/* Etiqueta inferior del disparador */
.csr-flyer-trigger__label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    background: linear-gradient(to top, rgba(0, 61, 122, 0.95), rgba(0, 61, 122, 0));
    color: var(--csr-color-white);
    font-family: var(--csr-font-heading);
    font-weight: 600;
    font-size: 0.9rem;
}

.csr-flyer-trigger__label i {
    color: var(--csr-color-tertiary);
}

/* ==========================================================================
   2. MODAL (contenedor fijo)
   ========================================================================== */
.csr-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
}

.csr-modal[hidden] { display: none; }

/* Bloquea el scroll de la página mientras el modal está abierto */
body.csr-modal-open { overflow: hidden !important; }

/* ---------- Fondo oscurecido ---------- */
.csr-modal__backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 29, 58, 0.82);
    backdrop-filter: blur(4px);
    animation: csr-modal-fade 0.3s ease;
}

@keyframes csr-modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---------- Diálogo (caja blanca) ---------- */
.csr-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(92vw, 860px);
    max-height: 92vh;
    background-color: var(--csr-color-white);
    border-radius: var(--csr-radius-2xl, 24px);
    overflow: hidden;
    box-shadow: var(--csr-shadow-xl);
    animation: csr-modal-in 0.35s cubic-bezier(0.34, 1.3, 0.64, 1);
}

@keyframes csr-modal-in {
    from { opacity: 0; transform: translateY(30px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Botón cerrar (círculo rojo) ---------- */
.csr-modal__close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    z-index: 3;
    width: 44px;
    height: 44px;
    border-radius: var(--csr-radius-full);
    background-color: var(--csr-color-secondary);
    color: var(--csr-color-white);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35);
    transition: transform 0.25s ease, background-color 0.25s ease;
}

.csr-modal__close:hover {
    background-color: var(--csr-color-secondary-dark);
    transform: rotate(90deg) scale(1.05);
}

/* ---------- Imagen del flyer ---------- */
.csr-modal__figure {
    margin: 0;
    overflow: auto;                 /* permite scroll si la imagen es muy alta */
    background-color: #101418;
    display: flex;
    align-items: center;
    justify-content: center;
}

.csr-modal__figure img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 76vh;
    object-fit: contain;            /* nunca se deforma */
}

/* ---------- Acciones inferiores ---------- */
.csr-modal__actions {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    padding: 0.9rem 1.2rem;
    background-color: var(--csr-color-white);
    border-top: 1px solid var(--csr-color-lighter);
}

.csr-modal__btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.4rem;
    border-radius: var(--csr-radius-xl, 20px);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.25s ease;
}

.csr-modal__btn--primary {
    background: linear-gradient(135deg, var(--csr-color-primary), var(--csr-color-primary-dark));
    color: var(--csr-color-white);
    box-shadow: 0 4px 15px rgba(0, 88, 171, 0.3);
}

.csr-modal__btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 88, 171, 0.4);
    color: var(--csr-color-white);
}

.csr-modal__btn--outline {
    background-color: transparent;
    border-color: var(--csr-color-gray-light);
    color: var(--csr-color-gray);
}

.csr-modal__btn--outline:hover {
    border-color: var(--csr-color-secondary);
    color: var(--csr-color-secondary);
}