/**
 * Estilos para el Sistema de Popups
 * Diseño profesional y elegante - Alineado con index.html
 */

/* Variables CSS - Usando las mismas que index.html */
:root {
    --popup-overlay-bg: rgba(0, 0, 0, 0.5);
    --popup-bg: #ffffff;
    --popup-border: #e5e7eb;
    --popup-text-primary: #1f2937;
    --popup-text-secondary: #6b7280;
    --popup-brand: #b11c22;
    --popup-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --popup-shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Overlay base - simple y profesional */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--popup-overlay-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.show {
    opacity: 1;
    visibility: visible;
}

.popup-overlay.hide {
    opacity: 0;
    visibility: hidden;
}

/* Modal base - diseño limpio y profesional */
.popup-modal {
    background: var(--popup-bg);
    border-radius: 16px;
    padding: 40px;
    box-shadow: var(--popup-shadow-lg);
    position: relative;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    border: 1px solid var(--popup-border);
}

.popup-overlay.show .popup-modal {
    transform: scale(1);
}

/* Botón de cerrar - minimalista */
.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: none;
    background: transparent;
    color: var(--popup-text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
    transition: all 0.2s ease;
    z-index: 1;
}

.popup-close:hover {
    background: #f3f4f6;
    color: var(--popup-text-primary);
}

.popup-close:active {
    transform: scale(0.95);
}

/* Elementos comunes */
.popup-image {
    width: 100%;
    max-width: 200px;
    height: auto;
    margin: 0 auto 24px;
    border-radius: 12px;
    display: block;
}

.popup-title {
    margin: 0 0 16px 0;
    color: var(--popup-text-primary);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.popup-subtitle {
    margin: 0 0 16px 0;
    color: var(--popup-text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.popup-message {
    margin: 0 0 32px 0;
    color: var(--popup-text-secondary);
    line-height: 1.6;
    font-size: 1rem;
    font-weight: 400;
}

.popup-button {
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    background: var(--popup-brand);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.popup-button:hover {
    background: #8f161b;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.popup-button:active {
    transform: translateY(0);
}

/* Popup de Bienvenida */
.welcome-popup {
    background: var(--popup-bg);
}

.welcome-popup .popup-title {
    color: var(--popup-text-primary);
}

/* Popup de Promoción */
.promotion-popup {
    background: var(--popup-bg);
}

.promotion-popup .popup-title {
    color: var(--popup-text-primary);
}

.discount-badge {
    background: var(--popup-brand);
    color: white;
    padding: 8px 20px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 1rem;
    letter-spacing: 0.5px;
}

.code-display {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid var(--popup-border);
}

.code-text {
    color: var(--popup-text-primary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-align: center;
}

.promotion-button {
    background: var(--popup-brand);
}

.promotion-button:hover {
    background: #8f161b;
}

/* Popup de Video - MEJORADO */
.video-popup {
    background: var(--popup-bg);
    padding: 0;
    overflow: hidden;
}

.video-popup .popup-title {
    padding: 24px 40px 16px;
    margin: 0;
}

.video-popup .popup-message {
    padding: 0 40px 24px;
    margin: 0;
}

.video-container {
    position: relative;
    width: 100%;
    margin: 0 0 24px 0;
    background: #000;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.video-container::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.video-container video,
.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    color: var(--popup-brand);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2;
    border: 3px solid var(--popup-brand);
}

.play-button:hover {
    background: white;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.play-button:active {
    transform: translate(-50%, -50%) scale(0.95);
}

/* Popup de Anuncio */
.announcement-popup {
    padding: 40px 32px;
}

.announcement-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.announcement-info .popup-title {
    color: #1e40af;
}

.announcement-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.announcement-warning .popup-title {
    color: #92400e;
}

.announcement-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.announcement-success .popup-title {
    color: #166534;
}

.announcement-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.announcement-error .popup-title {
    color: #991b1b;
}

.icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 20px;
    background: #f3f4f6;
}

.announcement-info .icon-circle {
    background: #dbeafe;
    color: #1e40af;
}

.announcement-warning .icon-circle {
    background: #fef3c7;
    color: #92400e;
}

.announcement-success .icon-circle {
    background: #dcfce7;
    color: #166534;
}

.announcement-error .icon-circle {
    background: #fee2e2;
    color: #991b1b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .popup-overlay {
        padding: 16px;
    }
    
    .popup-modal {
        padding: 32px 24px;
        border-radius: 12px;
        max-height: 85vh;
        max-width: 100%;
    }
    
    .popup-title {
        font-size: 1.5rem;
    }
    
    .popup-message {
        font-size: 0.95rem;
    }
    
    .popup-button {
        padding: 10px 24px;
        font-size: 0.95rem;
    }
    
    .icon-circle {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
    
    /* Video responsive */
    .video-popup .popup-title {
        padding: 20px 24px 12px;
        font-size: 1.3rem;
    }
    
    .video-popup .popup-message {
        padding: 0 24px 20px;
        font-size: 0.9rem;
    }
    
    .play-button {
        width: 64px;
        height: 64px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .popup-modal {
        padding: 24px 20px;
        margin: 10px;
    }
    
    .popup-title {
        font-size: 1.25rem;
        margin-bottom: 12px;
    }
    
    .popup-message {
        margin-bottom: 24px;
        font-size: 0.9rem;
    }
    
    .popup-image {
        max-width: 150px;
        margin-bottom: 20px;
    }
    
    /* Video mobile */
    .video-popup {
        padding: 0;
    }
    
    .video-popup .popup-title {
        padding: 16px 20px 12px;
        font-size: 1.2rem;
    }
    
    .video-popup .popup-message {
        padding: 0 20px 16px;
        font-size: 0.85rem;
    }
    
    .play-button {
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }
    
    .video-container::before {
        padding-top: 60%; /* Slightly taller on mobile for better visibility */
    }
}

/* Accesibilidad */
@media (prefers-reduced-motion: reduce) {
    .popup-overlay,
    .popup-modal,
    .popup-close,
    .popup-button,
    .video-container,
    .play-button {
        transition: none;
        animation: none;
    }
    
    .popup-overlay.show .popup-modal {
        transform: none;
    }
}

/* Focus visible para navegación por teclado */
.popup-close:focus-visible,
.popup-button:focus-visible {
    outline: 2px solid var(--popup-brand);
    outline-offset: 2px;
}

/* Mejoras para impresión */
@media print {
    .popup-overlay {
        display: none !important;
    }
}

/* Estilos específicos para videos embebidos */
.video-container iframe {
    border: none;
}

/* Loading state para videos */
.video-container.loading {
    background: #1f2937;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
