/* =========================================
   PREMIUM LOGIN STYLE v2 (High Contrast)
   ========================================= */

:root {
    --primary: #00d2d3; /* Cyan Neon */
    --primary-dark: #01a3a4;
    --bg-dark: #0f172a; /* Azul muy oscuro */
    --card-bg: #1e293b; /* Gris azulado sólido */
    --text-white: #ffffff;
    --text-gray: #94a3b8;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', sans-serif; }

body {
    background-color: var(--bg-dark);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* --- FONDO DE PARTÍCULAS (ICONS) --- */
.delivery-particles {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    z-index: 0;
}

.icon-float {
    position: absolute;
    color: rgba(255, 255, 255, 0.1); /* ⬆️ Aumentado de 0.03 a 0.1 para que se vea */
    font-size: 4rem; /* ⬆️ Un poco más grandes */
    left: var(--x);
    top: var(--y);
    animation: floatAnim 10s infinite ease-in-out alternate;
    animation-delay: calc(var(--i) * -2s);
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.1)); /* Brillo sutil */
    z-index: 0; /* Aseguramos que estén detrás */
}

@keyframes floatAnim {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(-30px) rotate(15deg); }
}

/* --- CONTENEDOR --- */
.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
}

/* --- TARJETA PRINCIPAL (Ahora más sólida) --- */
.login-card {
    background: rgba(30, 41, 59, 0.95); /* Casi sólido para contraste */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2); /* Luz arriba */
    width: 100%;
    max-width: 360px;
    padding: 2.5rem 2rem;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); /* Sombra fuerte */
    text-align: center;
    backdrop-filter: blur(10px);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- HEADER --- */
.icon-circle {
    width: 70px; height: 70px;
    background: rgba(0, 210, 211, 0.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    color: var(--primary);
    font-size: 1.8rem;
    box-shadow: 0 0 20px rgba(0, 210, 211, 0.2);
}

.brand-title {
    color: var(--text-white);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.brand-subtitle {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* --- INPUTS --- */
.input-group {
    text-align: left;
    margin-bottom: 1.2rem;
}

.input-group label {
    display: block;
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-bottom: 6px;
    margin-left: 4px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1.1rem;
    transition: color 0.3s;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 14px 14px 48px;
    background: #0f172a; /* Fondo más oscuro que la tarjeta */
    border: 1px solid #334155;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 210, 211, 0.15);
}

.input-wrapper input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

/* --- BOTÓN --- */
.btn-login {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #0f172a; /* Texto oscuro para contraste */
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 1rem;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 210, 211, 0.3);
}

.btn-login:active {
    transform: scale(0.98);
}

/* --- FOOTER --- */
.login-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed rgba(255,255,255,0.1);
}

.whatsapp-btn {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s;
    padding: 8px 16px;
    border-radius: 50px;
    background: rgba(255,255,255,0.03);
}

.whatsapp-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.whatsapp-btn i { color: #25D366; font-size: 1.2rem; }

/* --- ERROR --- */
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- BOTÓN INSTALAR PWA (Android) --- */
.pwa-install-btn {
    display: none; /* Oculto por defecto */
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    z-index: 100;
    cursor: pointer;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- MENSAJE INSTRUCCIONES IOS --- */
.ios-prompt {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    color: white;
    z-index: 999;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    text-align: center;
    backdrop-filter: blur(10px);
}
.ios-prompt p {
    font-size: 0.9rem;
    margin-bottom: 0;
    line-height: 1.4;
}
.ios-icon {
    display: inline-block;
    vertical-align: middle;
    margin: 0 5px;
    font-size: 1.2rem;
    color: #3b82f6; /* Azul iOS */
}
.close-ios {
    position: absolute;
    top: 5px; right: 10px;
    background: none; border: none;
    color: #94a3b8; cursor: pointer;
    font-size: 1.2rem;
}

/* =========================================
   0. CONFIGURACIÓN GLOBAL (Evita pantalla blanca)
   ========================================= */
html, body {
    background-color: #0f172a; /* Fondo oscuro base */
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Outfit', sans-serif;
    overflow-x: hidden; /* Evita scroll lateral */
}

/* =========================================
   1. PRELOADER (PANTALLA DE CARGA)
   ========================================= */
#app-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #0f172a;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

/* Círculo del Logo */
.loader-logo-circle {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
    animation: pulseLogo 2s infinite;
}

.loader-logo-circle i {
    font-size: 35px;
    color: #10b981; /* Verde Appetit */
}

/* Spinner */
.loader-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #10b981;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    margin-top: 15px;
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 1px;
}

/* Clase para ocultar el loader */
.loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Animaciones */
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulseLogo { 
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* =========================================
   FIX: RESPONSIVIDAD Y SCROLL INTERNO
   ========================================= */
.login-card {
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 210, 211, 0.5) transparent;
}

.login-card::-webkit-scrollbar { width: 6px; }
.login-card::-webkit-scrollbar-track { background: transparent; }
.login-card::-webkit-scrollbar-thumb { background: rgba(0, 210, 211, 0.5); border-radius: 10px; }
.login-card::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* =========================================
   INPUTS COMPUESTOS (WHATSAPP FLEX)
   ========================================= */
.input-group-flex {
    display: flex;
    gap: 10px;
    width: 100%;
}

.select-country-code, 
.ts-wrapper.select-country-code {
    width: 110px !important;
    flex: 0 0 110px;
}

.input-group-flex input[name="local_phone"] {
    flex: 1;
}

@media (max-width: 480px) {
    .select-country-code, 
    .ts-wrapper.select-country-code {
        width: 95px !important;
        flex: 0 0 95px;
    }
}

/* =======================================================
   TOM SELECT - DARK MODE (Heredado de Appetit Premium)
   ======================================================= */
.ts-wrapper.driver-select,
.ts-wrapper.select-country-code {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    height: auto !important;
}

.ts-control {
    background-color: #0f172a !important; 
    background-image: none !important;    
    border: 1px solid #334155 !important; 
    border-radius: 12px !important;
    color: #ffffff !important;
    padding: 14px 14px 14px 48px !important;
    min-height: 48px;                     
    display: flex;
    align-items: center;
    box-shadow: none !important;
}

.select-country-code .ts-control {
    padding: 14px !important;
}

.ts-control > input { color: #ffffff !important; font-family: inherit !important; }
.ts-control > .item { color: #ffffff !important; font-weight: 500; }

.ts-dropdown {
    background-color: #1e293b !important; 
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
    border-radius: 12px !important;
    margin-top: 5px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
    z-index: 10000 !important;
}

.ts-dropdown .option { padding: 10px 15px !important; cursor: pointer; }
.ts-dropdown .optgroup-header { background-color: #020617 !important; color: #64748b !important; font-size: 0.75rem; text-transform: uppercase; font-weight: 800; }
.ts-dropdown .active, .ts-dropdown .option:hover { background-color: #00d2d3 !important; color: #0f172a !important; }
.ts-wrapper.focus .ts-control { border-color: #00d2d3 !important; box-shadow: 0 0 0 4px rgba(0, 210, 211, 0.15) !important; }

/* =========================================
   BOTÓN DE REGISTRO (POSTULACIÓN)
   ========================================= */
.register-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    margin: 25px 0 10px 0; /* 25px arriba para separarlo del Submit, 10px abajo para el Footer */
    border-radius: 12px;
    background: rgba(0, 210, 211, 0.08);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid rgba(0, 210, 211, 0.2);
    transition: all 0.3s;
}

.register-link-btn:hover {
    background: rgba(0, 210, 211, 0.15);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 210, 211, 0.1);
}