/**
 * Estilos para el popup de Email Collector - Estilo Ropa Revolver
 */

/* Contenedor principal del popup */
.ec-popup-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    display: none !important;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(2px);
}

/* Especificidad alta para anular frontend.css */
body .ec-popup-container {
    position: fixed !important;
    max-width: none !important;
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
}

.ec-popup-container.ec-popup-active {
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Overlay de fondo - Estilo moderno */
.ec-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.6)) !important;
    cursor: pointer;
}

/* Cuerpo del popup - Diseño Ropa Revolver con imagen */
.ec-popup {
    position: relative;
    z-index: 10;
    width: 640px; /* Ancho total del popup */
    height: 350px; /* Altura total del popup */
    max-width: 90vw;
    background-color: #ffffff;
    border-radius: 0; /* Sin bordes redondeados, configurable */
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25), 0 10px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: row;
    transform: scale(0.9) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.ec-popup-container.ec-popup-active .ec-popup {
    transform: scale(1) translateY(0);
}

/* Botón de cierre - Estilo minimalista */
.ec-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    font-size: 20px;
    color: #666;
}

.ec-popup-close:hover {
    opacity: 0.7;
}

.ec-popup-close::before,
.ec-popup-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background-color: #333;
    transition: background-color 0.2s ease;
}

.ec-popup-close::before {
    transform: rotate(45deg);
}

.ec-popup-close::after {
    transform: rotate(-45deg);
}

.ec-popup-close:hover::before,
.ec-popup-close:hover::after {
    background-color: #000;
}

/* Sección de imagen - Estilo moderno */
.ec-popup-image-section {
    width: 320px; /* Ancho de la sección de imagen */
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background-color: #f5f5f5; /* Color de fondo por defecto */
}

/* Sección de contenido - Layout vertical */
.ec-popup-content-section {
    width: 320px; /* Ancho de la sección de contenido */
    padding: 30px;
    text-align: center;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-shrink: 0;
}

/* Sección de éxito que reemplaza al contenido */
.ec-popup-success-section {
    position: absolute; /* Posición absoluta para ocupar el mismo espacio */
    top: 0;
    left: 320px; /* Alineado con la sección de contenido */
    width: 320px; /* Ancho de la sección de éxito */
    height: 100%; /* Altura completa */
    padding: 30px;
    text-align: center;
    background: #fff;
    display: none; /* Oculta por defecto */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    z-index: 15; /* Por encima del contenido */
    animation: ec-fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.ec-popup-success-section.ec-show {
    display: flex !important;
}

/* Título del mensaje de éxito */
.ec-success-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 12px;
    color: #000;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: block !important;
}

/* Mensaje de éxito */
.ec-success-message {
    font-size: 16px;
    margin: 0;
    color: #666;
    line-height: 1.5;
    font-weight: 400;
    display: block !important;
}

/* Títulos - Tipografía moderna */
.ec-popup-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #000;
    line-height: 1.2;
    letter-spacing: -0.5px;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ec-popup-subtitle {
    font-size: 16px;
    margin: 0 0 20px;
    color: #666;
    line-height: 1.5;
    font-weight: 400;
}

/* Formulario - Estilo clean */
.ec-popup-form {
    margin-top: 0;
}

.ec-popup-form .ec-field-group {
    margin-bottom: 16px;
}

.ec-popup-form input[type="email"] {
    width: 100%;
    padding: 13px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 0;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    background: #fff;
    color: #333;
    font-family: inherit;
}

.ec-popup-form input[type="email"]:focus {
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.ec-popup-form input[type="email"]::placeholder {
    color: #999;
    font-weight: 400;
}

/* Botón - Estilo Ropa Revolver */
.ec-popup-form button {
    width: 100%;
    padding: 13px 24px;
    border: none;
    border-radius: 0;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: #000;
    color: #fff;
    font-family: inherit;
}

.ec-popup-form button:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.ec-popup-form button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading spinner - Minimalista */
.ec-loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: ec-spin 0.8s infinite linear;
    margin-right: 10px;
}

@keyframes ec-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mensajes de error del formulario - Solo errores, éxito va en sección separada */
.ec-popup-form .ec-error-message {
    margin-top: 16px;
    padding: 16px 20px;
    border-radius: 0;
    font-size: 14px;
    font-weight: 500;
    animation: ec-fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-align: left;
    background: #fdf2f2;
    color: #8b2635;
    border-left: 4px solid #e53e3e;
}

/* Animación fadeIn moderna */
@keyframes ec-fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(8px);
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* Estilos responsivos - Mobile first con apilado vertical */
@media (max-width: 768px) {
    .ec-popup {
        flex-direction: column;
        width: 380px;
        height: auto;
        margin: 20px;
    }
    
    .ec-popup-image-section {
        width: 100%;
        height: 180px;
        order: 1; /* Imagen arriba en mobile */
    }
    
    .ec-popup-content-section,
    .ec-popup-success-section {
        position: relative; /* Resetear posición en mobile */
        left: auto;
        top: auto;
        width: 100%;
        height: auto;
        padding: 40px 30px 30px;
        order: 2; /* Contenido abajo en mobile */
    }
    
    .ec-popup-title,
    .ec-success-title {
        font-size: 24px;
    }
    
    .ec-popup-subtitle,
    .ec-success-message {
        font-size: 15px;
        margin-bottom: 25px;
    }
}

@media (max-width: 480px) {
    .ec-popup {
        width: 340px;
        margin: 15px;
    }
    
    .ec-popup-image-section {
        height: 150px;
    }
    
    .ec-popup-content-section,
    .ec-popup-success-section {
        position: relative; /* Resetear posición en mobile pequeño */
        left: auto;
        top: auto;
        width: 100%;
        height: auto;
        padding: 35px 25px 25px;
    }
    
    .ec-popup-title,
    .ec-success-title {
        font-size: 22px;
    }
    
    .ec-popup-subtitle,
    .ec-success-message {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .ec-popup-form input[type="email"] {
        padding: 14px 16px;
        font-size: 16px; /* Evita zoom en iOS */
    }
    
    .ec-popup-form button {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 52px;
    }
}

/* Cuando el popup está activo */
body.ec-popup-open {
    overflow: hidden !important;
}

/* Asegurar que el popup esté por encima de elementos comunes */
.ec-popup-container {
    z-index: 999999 !important;
}

/* Para temas que usan z-index altos */
html.ec-popup-active .ec-popup-container,
body.ec-popup-open .ec-popup-container {
    z-index: 9999999 !important;
}

/* Reset para evitar conflictos con temas */
.ec-popup-container * {
    box-sizing: border-box;
}

/* Corregir conflictos con frontend.css */
.ec-popup-container.ec-popup-active {
    position: fixed !important;
    max-width: none !important;
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
}

/* Efectos adicionales para mejor UX */
.ec-popup-form input[type="email"]:valid {
    border-color: #4caf50;
}

.ec-popup-form input[type="email"]:invalid:not(:placeholder-shown) {
    border-color: #e53e3e;
}

/* Estado focus mejorado */
.ec-popup-form input[type="email"]:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* Hover states mejorados */
.ec-popup-form button:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.ec-popup-form button:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
