:root {
    --bg-dark: #020617;
    --primary: #0ea5e9; /* AZUL APPETIT */
    --primary-hover: #0284c7;
    --primary-glow: rgba(14, 165, 233, 0.4);
    
    --surface: #0f172a;
    --surface-light: #1e293b;
    --border: #334155;
    
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --error: #ef4444;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0; height: 100vh; overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    display: flex; flex-direction: column;
}

/* FONDO AMBIENTAL */
.app-background {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background: radial-gradient(circle at 50% 0%, #172554 0%, #020617 80%);
}

/* =========================================
   PANTALLA 1: EMAIL
   ========================================= */
.login-wrapper {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 20px;
    position: relative;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    
    /* Estilo Pastilla de Vidrio */
    background: rgba(30, 41, 59, 0.6); 
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px; /* Bordes totalmente redondos */
    padding: 10px 25px;
    
    /* Tipografía */
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: white;
    
    /* Separación y Sombra */
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.brand-badge i { 
    color: var(--primary); 
    font-size: 1.2rem;
}

.highlight { color: var(--primary); }

/* --- MODIFICACIÓN: TARJETA INVISIBLE / MINIMALISTA --- */
.glass-card {
    width: 100%; 
    max-width: 400px;
    background: transparent; /* Sin fondo */
    border: none;            /* Sin borde */
    box-shadow: none;        /* Sin sombra */
    padding: 0;              /* Sin relleno */
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

/* En móviles pequeños, la tarjeta se expande más */
@media (max-width: 380px) {
    .glass-card { padding: 2rem 1.5rem; }
}

.welcome-text h1 { margin: 0 0 8px 0; font-size: 1.6rem; }
.welcome-text p { margin: 0 0 30px 0; color: var(--text-muted); font-size: 1rem; }

/* Input Email */
.input-container { position: relative; margin-bottom: 25px; }
.input-icon {
    position: absolute; left: 18px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 1.2rem;
}

/* Ajustamos los inputs para que resalten sobre el fondo oscuro */
#emailInput {
    width: 100%; 
    padding: 18px 18px 18px 50px;
    background: rgba(30, 41, 59, 0.6); /* Fondo semi-transparente para el input */
    border: 1px solid var(--border);
    border-radius: 16px; 
    color: white; 
    font-size: 1.1rem;
    outline: none; 
    transition: 0.3s;
    backdrop-filter: blur(10px);
}

#emailInput:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

/* Botón Continuar */
.btn-hero {
    width: 100%; padding: 18px;
    background: var(--primary); color: white;
    border: none; border-radius: 16px;
    font-size: 1.1rem; font-weight: 700; letter-spacing: 0.5px;
    cursor: pointer; transition: 0.2s;
    box-shadow: 0 8px 20px -5px var(--primary-glow);
}
.btn-hero:active { transform: scale(0.98); opacity: 0.9; }

.version-tag { position: absolute; bottom: 20px; color: #334155; font-size: 0.8rem; font-weight: 600; }

/* =========================================
   BOTONES DE INSTALACIÓN PWA ( DIFERENCIADOS )
   ========================================= */

/* ANDROID: Botón flotante azul */
.install-pill-android {
    position: absolute; bottom: 70px;
    background: var(--primary); color: #fff; /* Azul y blanco */
    border: none;
    padding: 12px 24px; border-radius: 50px;
    font-size: 1rem; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; gap: 8px;
    box-shadow: 0 10px 25px var(--primary-glow);
    z-index: 50; animation: float Android 3s ease-in-out infinite;
}
@keyframes floatAndroid { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }


/* iOS: Toast estilo notificación nativa */
.ios-toast-container {
    position: fixed; bottom: 20px; left: 15px; right: 15px;
    background: rgba(30, 41, 59, 0.85); /* Más oscuro y translúcido */
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px; z-index: 2000;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3);
}
.ios-toast-content { display: flex; align-items: flex-start; gap: 15px; }
.ios-icon-box {
    font-size: 1.8rem; color: #007AFF; /* Azul iOS nativo */
}
.ios-instructions { flex: 1; font-size: 0.95rem; color: #e2e8f0; line-height: 1.4; }
.ios-instructions strong { display: block; margin-bottom: 4px; font-size: 1rem; }
.ios-close-btn {
    background: rgba(255,255,255,0.1); border: none; 
    color: #94a3b8; font-size: 1.2rem; 
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* =========================================
   PANTALLA 2: PIN PAD (OVERLAY)
   ========================================= */
.pin-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-dark); z-index: 100;
    display: flex; flex-direction: column;
}

.pin-top-bar { padding: 20px; }
.btn-text-back {
    background: transparent; border: none; color: var(--text-muted);
    font-size: 1rem; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500;
}
.btn-text-back i { font-size: 0.9rem; }

.pin-content {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding-bottom: 20px;
}

/* 🔥 CORRECCIÓN CENTRADO 🔥 */
.centered-profile {
    text-align: center; /* Asegura centrado horizontal */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-circle {
    width: 90px; height: 90px; background: var(--surface-light);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; color: var(--primary); border: 3px solid var(--border);
    margin-bottom: 20px; box-shadow: 0 0 30px var(--primary-glow);
}
#selectedName { margin: 0; font-size: 1.8rem; color: white; font-weight: 800; }
.pin-instruction { margin: 8px 0 25px 0; color: var(--text-muted); font-size: 1.1rem; }

/* Dots del PIN */
.pin-dots-container {
    height: 40px; display: flex; gap: 18px;
    font-size: 50px; line-height: 0; color: var(--primary);
    text-shadow: 0 0 20px var(--primary); margin-top: 10px;
}

/* =========================================
   TECLADO NUMÉRICO
   ========================================= */
.numpad-wrapper {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-top-left-radius: 30px; 
    border-top-right-radius: 30px;
    
    /* Agregamos padding extra abajo para evitar toques accidentales */
    padding: 25px 20px 50px 20px; 
    /* Soporte para 'Safe Area' de iPhone (la barra inferior) */
    padding-bottom: calc(30px + env(safe-area-inset-bottom)); 
    
    box-shadow: 0 -20px 50px rgba(0,0,0,0.5);
}

.numpad-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 12px; max-width: 400px; margin: 0 auto;
}

.num-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: white; font-size: 1.8rem; font-weight: 500;
    padding: 20px 0; border-radius: 18px;
    cursor: pointer; transition: background 0.1s;
    user-select: none;
}
.num-btn:active { background: rgba(255, 255, 255, 0.1); transform: scale(0.96); }

.action-btn.delete { color: var(--error); background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.2); }
.action-btn.secondary { color: var(--text-muted); background: transparent; font-size: 1.3rem; font-weight: bold; border: none; }

/* Animaciones */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 1s infinite linear; margin-left: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================
   🤖 ANDROID: PASTILLA FLOTANTE (Material Design)
   ========================================= */
.android-install-pill {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary); /* Azul Appetit */
    color: white;
    border: none;
    padding: 8px 20px 8px 8px; /* Padding asimétrico para el icono */
    border-radius: 50px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.4);
    z-index: 2000;
    cursor: pointer;
    animation: bounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.android-install-pill .icon-circle {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

@keyframes bounceIn {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* =========================================
   🍎 iOS: BOTTOM SHEET (Estilo Apple)
   ========================================= */
.ios-install-sheet {
    position: fixed;
    bottom: 20px; /* Un poco elevado */
    left: 15px;
    right: 15px;
    background: rgba(30, 41, 59, 0.95); /* Gris oscuro estilo iOS */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 20px;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: slideUpIOS 0.4s ease-out;
}

.ios-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.ios-header span {
    font-weight: 700;
    color: white;
    font-size: 1rem;
}

.ios-close {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    color: #94a3b8;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

.ios-body p {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.ios-steps {
    font-size: 0.85rem;
    color: #94a3b8;
    line-height: 1.6;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 10px;
}

.ios-steps i {
    color: var(--primary);
}

/* Flecha decorativa apuntando al botón compartir de Safari (abajo al centro) */
.ios-arrow-down {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; 
    height: 0; 
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(30, 41, 59, 0.95);
}

@keyframes slideUpIOS {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}