/* static/main/css/popup.css */
/* Popup Publicitario — Instituto Superior Tecnológico Tena */
/* Paleta oficial: #005D99 (azul), #A3C947 (verde), #F7D038 (amarillo), #009FD9 (azul claro) */

/* ===== OVERLAY ===== */
.istt-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 30, 60, 0.78);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 10500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: isttFadeIn 0.35s ease;
}

.istt-popup-overlay.istt-hidden {
    display: none;
}

@keyframes isttFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ===== CAJA PRINCIPAL ===== */
.istt-popup-box {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    max-width: 682px;
    width: 100%;
    box-shadow: 0 24px 64px rgba(0, 30, 60, 0.35);
    animation: isttSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-top: 4px solid #A3C947;
}

@keyframes isttSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===== CABECERA ===== */
.istt-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(135deg, #005D99 0%, #009FD9 100%);
}

.istt-popup-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.istt-ad-dot {
    width: 8px;
    height: 8px;
    background: #A3C947;
    border-radius: 50%;
    flex-shrink: 0;
    animation: isttPulse 2s infinite;
}

@keyframes isttPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.75); }
}

/* ===== BOTÓN CERRAR ===== */
.istt-popup-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.istt-popup-close:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
}

.istt-popup-close:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.istt-popup-close .fas {
    font-size: 0.7rem;
}

/* ===== ÁREA DE MEDIA ===== */
.istt-popup-media {
    position: relative;
    width: 100%;
    background: #4b73a3;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.istt-popup-media img {
    width: 100%;
    height: auto;
    max-height: 600px;
    object-fit: contain;
    display: block;
    transition: opacity 0.3s ease;
}

.istt-popup-media video {
    width: 100%;
    height: auto;
    max-height: 600px;
    display: block;
}

/* Placeholder cuando no hay media */
.istt-media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    gap: 12px;
    padding: 3rem;
    min-height: 260px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
}

.istt-media-placeholder .fas {
    font-size: 2.5rem;
    opacity: 0.25;
}

/* ===== BARRA DE TEMPORIZADOR ===== */
.istt-timer-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #A3C947, #F7D038);
    width: 100%;
    transition: width 1s linear;
    z-index: 2;
}

/* ===== PIE DEL POPUP ===== */
.istt-popup-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.istt-popup-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.istt-ad-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.istt-ad-desc {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== BOTÓN CTA ===== */
.istt-popup-cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #005D99 0%, #009FD9 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none !important;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 93, 153, 0.3);
}

.istt-popup-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 93, 153, 0.4);
    opacity: 0.92;
}

.istt-popup-cta .fas {
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.istt-popup-cta:hover .fas {
    transform: translateX(3px);
}

/* ===== NAVEGACIÓN POR PUNTOS (múltiples anuncios) ===== */
.istt-ad-dots {
    display: flex;
    gap: 5px;
    margin-top: 6px;
}

.istt-dot-nav {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.istt-dot-nav.istt-dot-active {
    background: #005D99;
    transform: scale(1.4);
}

.istt-dot-nav:hover:not(.istt-dot-active) {
    background: #009FD9;
}

/* ===== ANIMACIÓN DE TRANSICIÓN ENTRE ANUNCIOS ===== */
@keyframes isttMediaFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.istt-media-enter {
    animation: isttMediaFadeIn 0.3s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 575.98px) {
    .istt-popup-box {
        border-radius: 14px;
        max-width: 100%;
    }

    .istt-popup-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .istt-popup-cta {
        width: 100%;
        justify-content: center;
    }

    .istt-popup-media {
        min-height: 220px;
    }

    .istt-popup-media img,
    .istt-popup-media video {
        max-height: 308px;
    }
}