/* ═════════════════════════════════════════════════════════════════════════
   EstilosCuentas.css — AESPA Crear Cuenta
   Estilo: Moderno, profesional con glassmorphism y micro-interacciones
   Versión: 2.0
═════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── RESET Y VARIABLES ──────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Paleta de colores principal */
    --primary-dark: #0a1120;
    --primary: #1e3a8a;
    --primary-light: #3b5fb0;
    --primary-soft: #e8f0fe;
    --accent: #7c3aed;
    --accent-light: #8b5cf6;
    
    /* Neutros */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Estados */
    --success: #059669;
    --success-light: #d1fae5;
    --error: #dc2626;
    --error-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    
    /* Sombras */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0,0,0,0.06);
    --shadow-glow: 0 0 0 3px rgba(30, 58, 138, 0.15);
    
    /* Transiciones */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--white) 100%);
    color: var(--gray-900);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── UTILIDADES ─────────────────────────────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ─── PASOS ──────────────────────────────────────────────────────────── */
.paso {
    display: none;
    min-height: 100vh;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.paso.activo {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
}

/* ─── HEADER CON GLASSMORPHISM ──────────────────────────────────────── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    height: 72px;
    background: rgba(10, 17, 32, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-titulo {
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    letter-spacing: 2px;
}

.boton-volver {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 40px;
    cursor: pointer;
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    min-height: 40px;
    transition: all var(--transition-fast);
}

.boton-volver:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

.boton-volver:active {
    transform: translateX(0);
}

.boton-volver svg {
    width: 18px;
    height: 18px;
}

/* ─── FORMULARIO CON DISEÑO MODERNO ──────────────────────────────────── */
.contenedor-form {
    flex: 1;
    padding: 40px 24px 48px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
}

.titulo-form {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 32px;
    letter-spacing: -0.5px;
    position: relative;
}

.titulo-form::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 4px;
}

/* ─── ALERTA MEJORADA ────────────────────────────────────────────────── */
.alerta {
    display: none;
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 24px;
    line-height: 1.5;
    animation: slideInDown var(--transition-fast);
}

@keyframes slideInDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alerta.visible {
    display: block;
}

.alerta.error {
    background: var(--error-light);
    border-left: 4px solid var(--error);
    color: var(--error);
    box-shadow: var(--shadow-sm);
}

.alerta.exito {
    background: var(--success-light);
    border-left: 4px solid var(--success);
    color: var(--success);
    box-shadow: var(--shadow-sm);
}

/* ─── CAMPOS CON DISEÑO CONTEMPORÁNEO ────────────────────────────────── */
.campo-input {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: 16px;
    height: 56px;
    margin-bottom: 16px;
    transition: all var(--transition-fast);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.campo-input:hover {
    border-color: var(--gray-300);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.campo-input:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.campo-input svg {
    width: 20px;
    height: 20px;
    margin: 0 16px;
    color: var(--gray-400);
    transition: color var(--transition-fast);
}

.campo-input:focus-within svg {
    color: var(--primary);
}

.campo-input input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0 16px 0 0;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-900);
    background: transparent;
    min-width: 0;
    height: 100%;
}

.campo-input input::placeholder {
    color: var(--gray-400);
    font-weight: 400;
}

/* ─── SELECTOR MEJORADO ──────────────────────────────────────────────── */
.campo-selector {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.campo-selector::after {
    content: '';
    position: absolute;
    right: 16px;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--gray-400);
    border-bottom: 2px solid var(--gray-400);
    transform: rotate(45deg);
    transition: all var(--transition-fast);
}

.campo-selector:hover::after {
    border-color: var(--primary);
    transform: rotate(45deg) translateY(-2px);
}

.texto-selector {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--gray-400);
    font-family: 'Inter', sans-serif;
}

.texto-selector.seleccionado {
    color: var(--gray-900);
    font-weight: 500;
}

/* ─── BOTÓN OJO MEJORADO ─────────────────────────────────────────────── */
.boton-ojo {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 16px;
    color: var(--gray-400);
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.boton-ojo::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--primary-soft);
    transition: all var(--transition-base);
    transform: translate(-50%, -50%);
    z-index: 0;
}

.boton-ojo:hover::before {
    width: 40px;
    height: 40px;
}

.boton-ojo:hover {
    color: var(--primary);
}

.boton-ojo svg {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
}

/* ─── BOTÓN PRINCIPAL CON ANIMACIÓN ──────────────────────────────────── */
.boton-primario {
    width: 100%;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: var(--white);
    border: none;
    border-radius: 16px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 24px 0 20px;
    transition: all var(--transition-base);
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.boton-primario::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left var(--transition-slow);
}

.boton-primario:hover::before {
    left: 100%;
}

.boton-primario:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.boton-primario:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.boton-primario:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    display: none;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── TÉRMINOS CON ESTILO ────────────────────────────────────────────── */
.terminos {
    font-size: 0.85rem;
    color: var(--gray-500);
    text-align: center;
    line-height: 1.6;
}

.terminos a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: color var(--transition-fast);
}

.terminos a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition-fast);
}

.terminos a:hover {
    color: var(--accent);
}

.terminos a:hover::after {
    width: 100%;
}

/* ─── PASO CÁMARA CON EFECTO MODERNO ─────────────────────────────────── */
#paso-camara {
    background: linear-gradient(135deg, var(--gray-900) 0%, #000 100%);
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    position: relative;
    overflow: hidden;
}

#paso-camara::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(124,58,237,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.face-titulo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    text-align: center;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.face-subtitulo {
    font-size: 0.9rem;
    color: var(--gray-400);
    text-align: center;
    margin-bottom: 32px;
    padding: 0 16px;
    max-width: 320px;
    position: relative;
    z-index: 1;
}

.face-nota {
    font-size: 0.8rem;
    color: var(--gray-600);
    text-align: center;
    margin-top: 20px;
    padding: 0 20px;
    max-width: 320px;
    position: relative;
    z-index: 1;
}

.camara-contenedor {
    position: relative;
    width: min(300px, calc(100vw - 48px));
    aspect-ratio: 3/4;
    border-radius: 24px;
    overflow: hidden;
    background: #000;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: var(--shadow-xl), 0 0 0 2px rgba(124,58,237,0.2);
    position: relative;
    z-index: 1;
}

#videoCamara {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    display: block;
}

#canvasCaptura {
    display: none;
}

.guia-ovalo {
    position: absolute;
    top: 15%;
    left: 15%;
    width: 70%;
    height: 70%;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    pointer-events: none;
    transition: all var(--transition-base);
    box-shadow: 0 0 30px rgba(124,58,237,0.3);
}

.guia-ovalo.activo {
    border: 3px solid var(--accent);
    box-shadow: 0 0 50px rgba(124,58,237,0.5);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.8; }
}

.camara-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--white);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 10;
}

.camara-overlay.visible {
    display: flex;
    animation: fadeIn var(--transition-fast);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spinner-face {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.boton-foto {
    margin-top: 32px;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--white) 0%, var(--gray-200) 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-bounce);
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.boton-foto::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: -1;
}

.boton-foto:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.boton-foto:hover::before {
    opacity: 1;
}

.boton-foto:active {
    transform: scale(0.95);
}

.boton-foto-interior {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--white), var(--gray-200));
    border: 2px solid var(--primary);
}

/* ─── PANTALLAS DE RESULTADO ─────────────────────────────────────────── */
#paso-listo,
#paso-error {
    background: linear-gradient(135deg, var(--gray-900) 0%, #000 100%);
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.icono-resultado {
    font-size: 5rem;
    margin-bottom: 24px;
    animation: bounceIn var(--transition-bounce);
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.95);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.fila-botones {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
    justify-content: center;
}

.face-boton-principal {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: var(--white);
    border: none;
    border-radius: 40px;
    padding: 12px 28px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
}

.face-boton-principal:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.face-boton-principal:active {
    transform: translateY(0);
}

.face-boton-secundario {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--white);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 40px;
    padding: 12px 28px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 48px;
    transition: all var(--transition-base);
}

.face-boton-secundario:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.face-boton-secundario:active {
    transform: translateY(0);
}

/* ─── MODALES CON DISEÑO CONTEMPORÁNEO ───────────────────────────────── */
.modal-fondo {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-fondo.visible {
    display: flex;
    animation: fadeInModal var(--transition-fast);
}

@keyframes fadeInModal {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

.modal-contenido {
    background: var(--white);
    border-radius: 32px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-base);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--gray-200);
    flex-shrink: 0;
}

.modal-titulo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-cerrar {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-500);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-cerrar:hover {
    background: var(--gray-100);
    color: var(--gray-900);
    transform: rotate(90deg);
}

.modal-cerrar svg {
    width: 20px;
    height: 20px;
}

.modal-lista {
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.modal-lista::-webkit-scrollbar {
    width: 6px;
}

.modal-lista::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 10px;
}

.modal-lista::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}

.modal-lista::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

.modal-item {
    padding: 16px 12px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-800);
    min-height: 56px;
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
    border-radius: 12px;
}

.modal-item:hover {
    background: var(--gray-100);
    transform: translateX(4px);
    color: var(--primary);
}

.modal-item:last-child {
    border-bottom: none;
}

.modal-vacio {
    text-align: center;
    color: var(--gray-500);
    padding: 32px 20px;
    font-size: 0.9rem;
    font-style: italic;
}

/* ─── RESPONSIVO Y SAFE AREA ────────────────────────────────────────── */
@media (max-width: 640px) {
    .contenedor-form {
        padding: 24px 20px 40px;
    }
    
    .titulo-form {
        font-size: 1.75rem;
    }
    
    .app-header {
        padding: 0 20px;
    }
}

@media (max-width: 380px) {
    .titulo-form {
        font-size: 1.5rem;
    }
    
    .face-titulo {
        font-size: 1.25rem;
    }
    
    .fila-botones {
        flex-direction: column;
        width: 100%;
    }
    
    .face-boton-principal,
    .face-boton-secundario {
        width: 100%;
        justify-content: center;
    }
}

/* Safe area para dispositivos con notch */
@supports (padding: env(safe-area-inset-top)) {
    .app-header {
        padding-top: max(0px, env(safe-area-inset-top));
        height: calc(72px + env(safe-area-inset-top));
    }
    
    .contenedor-form {
        padding-bottom: max(48px, env(safe-area-inset-bottom));
    }
    
    #paso-camara,
    #paso-listo,
    #paso-error {
        padding-bottom: max(40px, env(safe-area-inset-bottom));
    }
    
    .modal-fondo {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Animaciones adicionales */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.loading-shimmer {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, var(--gray-200) 4%, var(--gray-300) 25%, var(--gray-200) 36%);
    background-size: 1000px 100%;
}