/* ==========================================================================
   VENTANA EMERGENTE (MODAL) FLOTANTE + SLIDER - IESTP Carlos Salazar Romero
   [FIX-25] Modal centrado sobre la pantalla; slider con autoplay 2 s.
   Convención: prefijo csr- | Metodología BEM
   ========================================================================== */

/* ==========================================================================
   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; }

.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 FLOTANTE CENTRADO
   ========================================================================== */
.csr-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;      /* centrado vertical */
    justify-content: center;  /* centrado horizontal */
    padding: 1.2rem;
}

.csr-modal[hidden] { display: none; }

/* Bloquea el scroll de la página mientras está abierto */
body.csr-modal-open { overflow: hidden !important; }

/* Fondo oscurecido con desenfoque */
.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) flotante */
.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: 0 25px 70px rgba(0, 0, 0, 0.45);
    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: 5;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--csr-radius-full, 999px);
    background-color: var(--csr-color-secondary);
    color: var(--csr-color-white);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    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);
}

/* ==========================================================================
   3. SLIDER INTERNO
   ========================================================================== */
.csr-modal__slider {
    position: relative;
    background-color: #101418;
    overflow: hidden;
}

/* Slides: solo se muestra el activo */
.csr-modal__slide { display: none; margin: 0; }

.csr-modal__slide--active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: csr-modal-fade 0.3s ease;
}

.csr-modal__slide img {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

/* Caja para slides de documentos PDF */
.csr-modal__pdfbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 2rem;
    color: var(--csr-color-white);
    text-align: center;
}

.csr-modal__pdfbox i { font-size: 4.5rem; color: var(--csr-color-secondary); }
.csr-modal__pdfbox span { font-size: 1rem; font-weight: 600; opacity: 0.9; }

/* Flechas (chevron dibujado con CSS) */
.csr-modal__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--csr-radius-full, 999px);
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}

.csr-modal__arrow::before {
    content: '';
    width: 10px;
    height: 10px;
    border-top: 2px solid var(--csr-color-white);
    border-right: 2px solid var(--csr-color-white);
}

.csr-modal__arrow--prev { left: 12px; }
.csr-modal__arrow--prev::before { transform: rotate(-135deg); margin-left: 4px; }
.csr-modal__arrow--next { right: 12px; }
.csr-modal__arrow--next::before { transform: rotate(45deg); margin-right: 4px; }

.csr-modal__arrow:hover {
    background-color: var(--csr-color-secondary);
    border-color: transparent;
    transform: translateY(-50%) scale(1.08);
}

/* Contador superior */
.csr-modal__counter {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 3;
    background-color: rgba(0, 0, 0, 0.55);
    color: var(--csr-color-white);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.8rem;
    border-radius: var(--csr-radius-full, 999px);
}

/* Indicadores (dots) */
.csr-modal__dots {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 6px;
}

.csr-modal__dot {
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: var(--csr-radius-full, 999px);
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.25s ease;
}

.csr-modal__dot--active {
    background-color: var(--csr-color-tertiary);
    transform: scale(1.25);
}

/* ==========================================================================
   4. ACCIONES INFERIORES
   ========================================================================== */
.csr-modal__actions {
    display: flex;
    justify-content: center;
    align-items: 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);
}

.csr-modal__btn[hidden] { display: none; }
