/*
 * AC Email Validator - Frontend Styles v2.2
 * Modern Modal Design - Estilos personalizables
 */

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --ac-primary: #2563eb;
    --ac-primary-hover: #1d4ed8;
    --ac-success: #10b981;
    --ac-error: #ef4444;
    
    --ac-text-primary: #0f172a;
    --ac-text-secondary: #475569;
    
    --ac-bg-overlay: rgba(15, 23, 42, 0.75);
    --ac-bg-modal: #ffffff;
    
    --ac-border: #e2e8f0;
    
    --ac-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --ac-radius: 16px;
    --ac-radius-sm: 8px;
}

/* ============================================
   VALIDATOR PAGE BODY
   ============================================ */
.ac-ev-validator-page {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   OVERLAY
   ============================================ */
.ac-ev-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--ac-bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    animation: fadeIn 0.3s ease-out;
    
    /* Soporte para imagen de fondo */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Si hay imagen de fondo, agregar overlay oscuro */
.ac-ev-overlay[style*="background-image"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    z-index: -1;
}

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

/* ============================================
   MODAL
   ============================================ */
.ac-ev-modal {
    background: var(--ac-bg-modal);
    padding: 40px;
    border-radius: var(--ac-radius);
    max-width: 480px;
    width: 90%;
    box-shadow: var(--ac-shadow-xl);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   MODAL ICON
   ============================================ */
.ac-ev-modal-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ac-ev-modal-icon svg {
    width: 28px;
    height: 28px;
    color: var(--ac-primary);
    stroke-width: 2.5;
}

/* ============================================
   MODAL CONTENT - HEREDA ESTILOS DEL TEMA
   ============================================ */
/* H2 con herencia de estilos del tema */
.ac-ev-modal h2,
.ac-ev-modal-title {
    text-align: center;
    margin: 0 0 8px 0 !important;
    line-height: 1.3;
    /* Solo si el tema no define, usar estos como fallback */
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    font-family: inherit;
}

/* Fallback solo si el tema no sobrescribe */
.ac-ev-validator-page h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--ac-text-primary);
}

.ac-ev-modal-subtitle {
    font-size: 15px;
    color: var(--ac-text-secondary);
    text-align: center;
    margin: 0 0 32px 0;
    line-height: 1.5;
}

/* ============================================
   FORM
   ============================================ */
#ac-ev-form {
    margin-bottom: 0;
}

.ac-ev-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.ac-ev-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--ac-text-secondary);
    pointer-events: none;
    stroke-width: 2;
    z-index: 1;
}

.ac-ev-input {
    width: 100%;
    padding: 14px 16px 14px 60px !important;
    border: 2px solid var(--ac-border);
    border-radius: var(--ac-radius-sm);
    font-size: 15px;
    color: var(--ac-text-primary);
    background: var(--ac-bg-modal);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    box-sizing: border-box;
}

.ac-ev-input:focus {
    outline: none;
    border-color: var(--ac-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.ac-ev-input::placeholder {
    color: #94a3b8;
}

/* ============================================
   BUTTON
   ============================================ */
.ac-ev-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--ac-radius-sm);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
}

.ac-ev-btn-primary {
    background: var(--ac-primary);
    color: white;
}

.ac-ev-btn-primary:hover:not(:disabled) {
    background: var(--ac-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.ac-ev-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.ac-ev-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Botón secundario (Registrarme) - HEREDA ESTILOS DEL TEMA */
.ac-ev-btn-secondary {
    /* Permitir que herede estilos de botones del tema */
    font-family: inherit;
    font-size: inherit;
    /* Solo usar estos si el tema no los define */
    background: #f8fafc;
    color: var(--ac-text-primary);
    border: 1px solid var(--ac-border);
}

/* Permitir que los estilos de botón del tema sobrescriban */
.ac-ev-validator-page a.button,
.ac-ev-validator-page .button,
.ac-ev-validator-page input[type="submit"],
.ac-ev-validator-page .ac-ev-btn-secondary {
    /* El tema puede sobrescribir completamente */
}

.ac-ev-btn-secondary:hover {
    background: #f1f5f9;
    border-color: var(--ac-primary);
    color: var(--ac-primary);
    transform: translateY(-1px);
}

/* ============================================
   BUTTON LOADER
   ============================================ */
.ac-ev-btn-loader svg {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.ac-ev-btn-loader path {
    stroke-linecap: round;
}

/* ============================================
   MESSAGES
   ============================================ */
.ac-ev-msg {
    padding: 12px 16px;
    border-radius: var(--ac-radius-sm);
    font-size: 14px;
    margin-top: 16px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ac-ev-msg-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.ac-ev-msg-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* ============================================
   FAILURE STATE
   ============================================ */
#ac-ev-failure {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--ac-border);
    animation: fadeIn 0.4s ease-out;
}

.ac-ev-failure-content {
    text-align: center;
}

.ac-ev-failure-icon {
    width: 48px;
    height: 48px;
    color: var(--ac-error);
    margin: 0 auto 16px;
    stroke-width: 2;
}

#ac-ev-failure-msg {
    font-size: 15px;
    color: var(--ac-text-secondary);
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* ============================================
   EMBEDDED FORM (Shortcode)
   ============================================ */
.ac-ev-embedded {
    max-width: 500px;
    margin: 32px auto;
}

.ac-ev-embed-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 32px;
    background: var(--ac-bg-modal);
    border-radius: var(--ac-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--ac-border);
}

.ac-ev-embed-form .ac-ev-input {
    padding: 14px 16px;
}

.ac-ev-embed-form .ac-ev-btn {
    margin-top: 8px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media screen and (max-width: 600px) {
    .ac-ev-modal {
        padding: 32px 24px;
        width: 95%;
    }
    
    .ac-ev-modal h2,
    .ac-ev-modal-title {
        font-size: 20px;
    }
    
    .ac-ev-modal-subtitle {
        font-size: 14px;
    }
    
    .ac-ev-modal-icon {
        width: 48px;
        height: 48px;
    }
    
    .ac-ev-modal-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .ac-ev-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

@media screen and (max-width: 400px) {
    .ac-ev-modal {
        padding: 24px 20px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.ac-ev-input:focus-visible,
.ac-ev-btn:focus-visible {
    outline: 2px solid var(--ac-primary);
    outline-offset: 2px;
}
