:root {
    /* PALETA PREMIUM APPETIT */
    --primary: #10b981; /* Verde Esmeralda */
    --primary-dark: #059669;
    --primary-glow: rgba(16, 185, 129, 0.4);
    
    --bg-dark: #020617;
    --bg-gradient: radial-gradient(circle at top center, #1e293b, #020617);
    
    /* EFECTOS VIDRIO (Glassmorphism) */
    --card-glass: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-shine: rgba(255, 255, 255, 0.05);

    --text: #f8fafc;
    --text-muted: #94a3b8;
    --error: #ef4444;
}

/* =========================================
   BASE & LAYOUT
   ========================================= */
body {
    margin: 0;
    background: var(--bg-gradient);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Evita scroll en pantalla completa */
}

/* HEADER SUPERIOR */
.top-bar {
    padding: 20px;
    text-align: center;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    z-index: 10;
    flex-shrink: 0;
}

.logo {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(to right, #fff, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px var(--primary-glow);
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 5px;
    font-weight: 500;
}

/* =========================================
   PASO 1: CONTENEDOR LOGIN EMAIL
   ========================================= */
.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: opacity 0.3s ease;
}

.login-card {
    background: var(--card-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px 30px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

/* Animación de entrada */
.animate-up {
    animation: slideUpFade 0.5s ease-out;
}
@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.icon-header {
    font-size: 48px;
    margin-bottom: 20px;
    display: inline-block;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
}

.login-card h2 {
    margin: 0 0 10px 0;
    font-size: 26px;
    font-weight: 800;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.5;
    font-size: 15px;
}

/* INPUTS Y BOTONES */
.input-group {
    margin-bottom: 25px;
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 18px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: white;
    font-size: 16px;
    text-align: center;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
}

.input-group input:focus {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 5px 10px rgba(16, 185, 129, 0.2);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: wait;
    filter: grayscale(0.5);
}

/* Spinner Loader */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* =========================================
   PASO 2: PIN PAD OVERLAY
   ========================================= */
.pin-pad-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(2, 6, 23, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none; /* JS activa flex */
    flex-direction: column;
    justify-content: flex-end;
    z-index: 999;
    transition: opacity 0.3s ease;
}

.back-btn {
    position: absolute;
    top: 25px; left: 25px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--card-border);
    color: var(--text);
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: background 0.2s;
}
.back-btn:active { background: rgba(255,255,255,0.15); }

/* DISPLAY DEL PIN (Avatar + Dots) */
.pin-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-bottom: 20px;
}

.avatar-preview {
    font-size: 60px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    /* Si fuera imagen real: */
    /* width: 80px; height: 80px; border-radius: 50%; object-fit: cover; */
}

.name-preview {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 15px;
    color: white;
}

.instruction {
    color: var(--text-muted);
    font-size: 15px;
    margin-bottom: 25px;
    font-weight: 500;
}

.pin-dots {
    font-size: 60px;
    letter-spacing: 15px;
    height: 70px;
    line-height: 1;
    color: var(--primary);
    font-weight: 900;
    text-shadow: 0 0 20px var(--primary-glow);
    transition: color 0.2s;
}

/* TECLADO NUMÉRICO (Grid) */
.numpad {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 30px;
    gap: 15px;
    border-top: 1px solid var(--card-border);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

.num-btn {
    background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
    border: 1px solid var(--card-border);
    color: white;
    font-size: 28px;
    font-weight: 600;
    padding: 22px 0;
    border-radius: 18px;
    cursor: pointer;
    touch-action: manipulation; /* Mejor respuesta táctil */
    transition: all 0.1s;
    user-select: none;
}

.num-btn:active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--primary);
    transform: scale(0.95);
}

.action-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.2);
}
.action-btn:active {
    background: rgba(239, 68, 68, 0.3);
}

/* =========================================
   PWA & RESPONSIVE
   ========================================= */

/* Botón Android */
#pwa-install-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    border: none;
    font-weight: bold;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    z-index: 2000;
    cursor: pointer;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-6px); }
}

/* Prompt iOS */
#ios-install-prompt {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 10px; right: 10px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid #334155;
    padding: 20px;
    border-radius: 16px;
    color: white;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    text-align: center;
}
#ios-install-prompt::after {
    content: ''; position: absolute; bottom: -10px; left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(15, 23, 42, 0.95);
}

.ios-content { font-size: 14px; line-height: 1.6; }
.ios-icon { font-size: 18px; margin: 0 4px; }
.ios-close {
    position: absolute; top: 10px; right: 10px;
    background: none; border: none; color: #94a3b8;
    font-size: 20px; cursor: pointer; padding: 5px;
}

/* MEDIA QUERIES PARA PANTALLAS PEQUEÑAS */
@media (max-height: 700px) {
    .login-card { padding: 30px 20px; }
    .icon-header { font-size: 40px; margin-bottom: 10px; }
    .pin-display { padding-bottom: 10px; }
    .avatar-preview { font-size: 50px; margin-bottom: 10px; }
    .numpad { padding: 15px; }
    .num-btn { padding: 15px 0; font-size: 24px; }
}