:root {
    --popup-bg: #ffffff;
    /* Opacidad leve del fondo oscuro */
    --popup-overlay: rgba(0, 0, 0, 0.3);
    --popup-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    --btn-danger-bg: rgba(239, 68, 68, 0.95);
    --transition-fast: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modal Overlay Centrado con fondo suave */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--popup-overlay);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
    padding: 16px;
    box-sizing: border-box;
}

.popup.show {
    display: flex;
    opacity: 1;
}

/* Tarjeta Principal ajustada al 70% de la pantalla */
.popup-content {
    position: relative;
    background: var(--popup-bg);
    border-radius: 16px;
    box-shadow: var(--popup-shadow);
    /* Ocupa máximo el 70% del ancho y 70% del alto */
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition-smooth);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.popup.show .popup-content {
    transform: scale(1) translateY(0);
}

/* Header Flotante Superior (Botones por encima de la imagen) */
.popup-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    z-index: 30; /* Asegura que siempre esté por encima de la imagen */
    pointer-events: none;
}

.popup-header button {
    pointer-events: auto;
}

/* Botón "No mostrar más" */
.btn-never-show {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(6px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.btn-never-show:hover {
    background: var(--btn-danger-bg);
    border-color: transparent;
}

/* Visibilidad al hacer hover en la imagen */
.btn-never-show.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Botón Cerrar (X) siempre visible */
.btn-close {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1e293b;
    margin-left: auto;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-close:hover {
    background: #ffffff;
    color: #000000;
    transform: rotate(90deg) scale(1.08);
}

/* Contenedor e Imagen adaptables al 70% */
.popup-body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-image {
    max-width: 100%;
    max-height: 80vh; /* Limita la altura de la imagen al 70% */
    width: auto;
    height: auto;
    display: block;
    object-fit: contain; /* Mantiene la proporción sin recortar */
    cursor: pointer;
    transition: transform 0.4s ease;
}

.popup-image:hover {
    transform: scale(1.02);
}

/* Móviles */
@media (max-width: 600px) {
    .popup-content {
        max-width: 85vw; /* En teléfonos da un poco más de espacio para legibilidad */
        max-height: 90vh;
    }

    .btn-never-show {
        font-size: 11px;
        padding: 5px 10px;
    }

    .btn-close {
        width: 30px;
        height: 30px;
    }
}