/* =========================================
   1. ESTILOS GENERALES Y FORMULARIOS (FUTURISTA - COLORES MARCA)
   ========================================= */
/* NOTA: Este CSS fuerza fondos oscuros para que el texto blanco sea legible. */

.ruta105-dashboard, .ruta105-login-container {
    max-width: 1000px;
    margin: 30px auto;
    font-family: 'Segoe UI', 'Roboto', Helvetica, Arial, sans-serif;
    color: #00bdf2; /* Texto claro */
    padding: 0 1px;
}

/* Forzar que todos los títulos dentro del dashboard sean visibles */
.ruta105-dashboard h1, 
.ruta105-dashboard h2, 
.ruta105-dashboard h3, 
.ruta105-dashboard h4 {
    color: #00bdf2 !important;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.8); /* Sombra negra para leer sobre cualquier fondo */
}

/* Formularios (Registro y Login) - Efecto Cristal Oscuro */
.ruta105-form {
    background: rgba(15, 23, 42, 0.85) !important; /* Fondo AZUL OSCURO casi opaco para contraste */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), inset 0 0 20px rgba(255, 255, 255, 0.05);
    max-width: 450px;
    margin: 0 auto;
    border: 1px solid rgba(0, 210, 255, 0.2);
}

.ruta105-form h3 {
    color: #00d2ff !important; /* Título CIAN para resaltar */
    margin-bottom: 25px;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.4);
    letter-spacing: 1px;
}

.ruta105-form input[type="text"],
.ruta105-form input[type="email"],
.ruta105-form input[type="password"],
.ruta105-form input[type="number"],
.ruta105-form select {
    width: 100%;
    padding: 14px 15px;
    margin: 8px 0 20px;
    border: 1px solid rgba(0, 210, 255, 0.3);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.4) !important; /* Fondo NEGRO translúcido para inputs */
    color: #fff !important; /* Texto BLANCO forzado */
    transition: all 0.3s;
    caret-color: #00d2ff;
}

.ruta105-form input:focus,
.ruta105-form select:focus {
    background: rgba(0, 0, 0, 0.6) !important;
    border-color: #00d2ff;
    outline: none;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.3);
}

/* Botones Futuristas */
.ruta105-form input[type="submit"] {
    width: 100%;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: white;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ruta105-form input[type="submit"]:hover {
    background: linear-gradient(135deg, #3a7bd5 0%, #00d2ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 210, 255, 0.5);
}

/* =========================================
   2. PANEL DE USUARIO (DASHBOARD FUTURISTA)
   ========================================= */
.perfil-header {
    /* Fondo Oscuro Reforzado */
    background: rgba(10, 20, 35, 0.8) !important; 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 30px 20px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    margin-bottom: 30px;
    border: 1px solid rgba(0, 210, 255, 0.15);
    color: #fff !important; /* Forzar texto blanco */
}

.avatar-ruta105 {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #00d2ff;
    box-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
    margin-bottom: 15px;
    background-color: #000; /* Fondo negro por si la imagen es transparente */
}

.puntos-badge {
    display: inline-block;
    background: linear-gradient(45deg, #b4d300, #fcd802);
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); 
    padding: 8px 22px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 14px;
    margin: 12px 0;
    box-shadow: 0 5px 15px rgba(252, 216, 2, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Link de afiliado box */
.link-box { margin-top: 25px; }
.input-group { display: flex; justify-content: center; gap: 10px; margin-top: 15px; max-width: 550px; margin-left: auto; margin-right: auto; }

.input-group input {
    padding: 12px 15px;
    border: 1px solid rgba(0, 210, 255, 0.3);
    width: 70%;
    text-align: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5) !important; /* Fondo negro */
    color: #00d2ff !important; /* Texto neón */
    font-family: monospace;
    font-weight: bold;
}

.input-group button {
    padding: 12px 25px;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.2);
    transition: all 0.3s;
}

/* Barra de Progreso y Recuadros de Información */
.meta-container {
    background: rgba(15, 25, 40, 0.9) !important;
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(0, 210, 255, 0.15);
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    color: #fff !important; /* Texto forzado a blanco */
}
.barra-fondo {
    background: rgba(255, 255, 255, 0.1) !important;
    height: 14px !important;
    border-radius: 10px !important;
    box-shadow: inset 0 1px 5px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.barra-progreso {
    background: linear-gradient(90deg, #b4d300, #60efff) !important;
    border-radius: 10px;
    transition: width 1s ease-in-out;
    box-shadow: 0 0 15px rgba(180, 211, 0, 0.5);
    position: relative;
    overflow: hidden;
}
.barra-progreso::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer { 100% { left: 100%; } }

/* =========================================
   3. ÁRBOL DE AFILIADOS (SOLUCIÓN DEFINITIVA: SOLO WHATSAPP)
   ========================================= */
.arbol-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding: 60px 10px;
    background: radial-gradient(circle at center, #0f172a 0%, #000000 100%) !important;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid rgba(0, 210, 255, 0.2);
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
}
.arbol-container:active { cursor: grabbing; }

.arbol-container::-webkit-scrollbar { height: 8px; }
.arbol-container::-webkit-scrollbar-track { background: rgba(0,0,0,0.5); border-radius: 5px; }
.arbol-container::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #3a7bd5, #00d2ff); border-radius: 5px; }

.tree { display: inline-block; min-width: 100%; }
.tree ul { 
    padding-top: 20px; 
    position: relative; 
    transition: all 0.5s; 
    display: flex; 
    justify-content: center; 
    white-space: nowrap; 
}

/* REDUCCIÓN DE ESPACIOS EN LA RED */
.tree li { 
    float: left; 
    text-align: center; 
    list-style-type: none; 
    position: relative; 
    padding: 10px 2px;
    transition: all 0.5s;
    min-width: 80px; 
    min-height: 80px; 
}

/* Conectores */
.tree li::before, .tree li::after {
    content: ''; position: absolute; top: 0; right: 50%;
    border-top: 1px solid #00d2ff;
    width: 50%; height: 15px;
    box-shadow: 0 -1px 3px rgba(0, 210, 255, 0.3);
}
.tree li::after {
    right: auto; left: 50%;
    border-left: 1px solid #00d2ff;
    box-shadow: -1px 0 3px rgba(0, 210, 255, 0.3);
}
.tree li:only-child::after, .tree li:only-child::before { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; box-shadow: none; }
.tree li:last-child::before {
    border-right: 1px solid #00d2ff;
    border-radius: 0 10px 0 0;
    box-shadow: 1px -1px 3px rgba(0, 210, 255, 0.3);
}
.tree li:first-child::after {
    border-radius: 10px 0 0 0;
    box-shadow: -1px -1px 3px rgba(0, 210, 255, 0.3);
}
.tree ul ul::before {
    content: ''; position: absolute; top: 0; left: 50%;
    border-left: 1px solid #00d2ff;
    width: 0; height: 15px;
    box-shadow: 0 0 5px rgba(0, 210, 255, 0.4);
}

/* --- ESTADO NORMAL: CÉLULA COMPACTA --- */
.node-content {
    background: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(5px);
    border: 2px solid #00d2ff;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
    
    width: 60px;
    height: 60px;
    
    /* Centrado imagen */
    display: block !important;
    padding: 0 !important;
    margin: 0 auto;
    overflow: hidden;
    box-sizing: border-box;
    
    position: relative;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.node-content img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 0;
    margin: 0 !important;
    padding: 0 !important;
    display: block;
    border: none !important;
}

/* Ocultar datos por defecto */
.nombre-nodo, 
.localidad-nodo, 
.acciones-nodo { 
    display: none; 
}

/* --- ESTADO INTERACTIVO: HOVER / TOUCH (EXPANDIDO) --- */
.node-content:hover {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    
    /* Tarjeta expandida */
    width: 160px;
    height: auto;
    border-radius: 15px;
    padding: 15px !important;
    
    background: rgba(10, 20, 35, 0.95) !important;
    border-color: #fcd802;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(252, 216, 2, 0.4);
    overflow: visible;
    
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) scale(1.1);
    z-index: 999;
}

.node-content:hover img {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    margin: 0 auto 10px auto !important;
    border: 2px solid #fcd802 !important;
    flex-shrink: 0;
}

.node-content:hover .nombre-nodo, 
.node-content:hover .localidad-nodo, 
.node-content:hover .acciones-nodo {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Texto */
.nombre-nodo {
    font-weight: 700;
    font-size: 13px;
    color: #fff !important;
    margin-bottom: 3px;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.localidad-nodo {
    font-size: 11px;
    color: #00d2ff !important;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

/* --- BOTONES DE ACCIÓN (SOLO WHATSAPP) --- */
.acciones-nodo { 
    display: flex; 
    justify-content: center; /* Intenta centrar el contenido */
    align-items: center;
    gap: 0; 
    margin-top: 5px; 
    width: 100%; 
}

.btn-wsp-tree {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white; 
    width: 36px; 
    height: 36px; 
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center; text-decoration: none;
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s;
    
    /* CORRECCIÓN DE CENTRADO FORZADO */
    margin: 0 auto !important; 
}

.btn-wsp-tree:hover {
    transform: scale(1.1);
}

/* OCULTAR BOTÓN MENSAJE INTERNO */
.btn-msg-tree {
    display: none !important;
}

/* Nodo Padre */
.node-content.padre {
    border-color: #fcd802;
    box-shadow: 0 0 20px rgba(252, 216, 2, 0.3);
}

.node-empty {
    color: #94a3b8;
    font-style: italic;
    font-size: 10px;
    border: 1px dashed rgba(0, 210, 255, 0.3);
    padding: 10px;
    border-radius: 50%;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    margin: 0 auto;
}

/* =========================================
   4. LISTADOS Y TABLAS (CONTRASTE CORREGIDO)
   ========================================= */
.lista-referidos h3 {
    color: #fff !important;
    margin-bottom: 20px;
    border-left: 4px solid #00d2ff;
    padding-left: 15px;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}
.table-responsive {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    border: 1px solid rgba(0, 210, 255, 0.1);
    background: rgba(0, 0, 0, 0.4); /* Fondo oscuro contenedor */
}
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    /* CORRECCIÓN: Fondo transparente para quitar el blanco del tema */
    background-color: transparent !important; 
    color: #fff !important;
}
th {
    /* Fondo azul oscuro sólido para cabecera */
    background-color: rgba(10, 25, 45, 0.9) !important;
    color: #00d2ff !important; /* Texto Cyan */
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 18px;
    border-bottom: 2px solid rgba(0, 210, 255, 0.3);
}
td {
    padding: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
    color: #fff !important; /* Texto blanco forzado */
    background-color: rgba(0, 0, 0, 0.2) !important; /* Fondo fila oscuro */
}
tr:last-child td { border-bottom: none; }
tr:hover td {
    background-color: rgba(0, 210, 255, 0.1) !important; /* Hover visible */
    color: #fff !important;
}

/* =========================================
   5. MODALES FUTURISTAS
   ========================================= */
.modal-mensaje {
    position: fixed; z-index: 9999; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Overlay muy oscuro */
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: rgba(15, 23, 42, 0.95) !important; /* Fondo modal opaco */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 0; padding: 25px; width: 90%; max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.6), inset 0 0 20px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 210, 255, 0.2);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    color: #00bdf2 !important;
}
@keyframes slideUp { from { transform: translateY(50px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #94a3b8;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 100;
    line-height: 1;
}
.close:hover { color: #00d2ff; transform: scale(1.2) rotate(90deg); text-shadow: 0 0 10px rgba(0,210,255,0.8); }

.modal-chat-body { height: 480px; display: flex; flex-direction: column; padding: 5px; background: transparent; }
.chat-area-visual {
    flex: 1;
    background: rgba(0, 0, 0, 0.3) !important; /* Fondo chat */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px; overflow-y: auto; margin-bottom: 15px;
    display: flex; flex-direction: column; gap: 12px;
}

.burbuja-chat {
    padding: 12px 18px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 75%;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    color: #fff !important;
}
.msj-mio {
    align-self: flex-end;
    background: linear-gradient(135deg, #00b09b, #b4d300);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msj-otro {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.15); /* Fondo más visible */
    color: #fff;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.hora-msj { font-size: 10px; color: rgba(255,255,255,0.7); text-align: right; margin-top: 5px; display: block; }

.chat-controls { display: flex; gap: 12px; padding-top: 5px; }
.chat-controls textarea {
    height: 50px;
    border-radius: 25px;
    padding: 14px 20px;
    border: 1px solid rgba(0, 210, 255, 0.3);
    resize: none; width: 100%;
    background: rgba(0, 0, 0, 0.5) !important;
    color: #fff !important;
    caret-color: #00d2ff;
}
.chat-controls textarea:focus { outline: none; border-color: #00d2ff; box-shadow: 0 0 15px rgba(0, 210, 255, 0.2); }
.chat-controls button {
    width: 50px; height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d2ff, #3a7bd5);
    color: white; border: none; display: flex; align-items: center; justify-content: center;
    font-size: 20px; box-shadow: 0 5px 15px rgba(0, 210, 255, 0.3); cursor: pointer;
    transition: all 0.3s;
}
.chat-controls button:hover { transform: scale(1.1); box-shadow: 0 8px 25px rgba(0, 210, 255, 0.5); }

/* Bandeja de Mensajes */
.mensaje-item {
    background: rgba(20, 30, 50, 0.9) !important; /* Fondo oscuro sólido */
    backdrop-filter: blur(5px);
    border-left: 5px solid rgba(255, 255, 255, 0.2);
    padding: 18px; margin-bottom: 12px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff !important;
}
.mensaje-item:hover { transform: translateX(5px); background: rgba(30, 45, 70, 0.9) !important; border-left-color: #00d2ff; }
.msg-no-leido {
    border-left-color: #b4d300; /* Verde */
    background: linear-gradient(90deg, rgba(180, 211, 0, 0.1), rgba(20, 30, 50, 0.9)) !important;
    box-shadow: 0 5px 15px rgba(180, 211, 0, 0.2);
}

/* Botones Top Bar */
.dashboard-top-bar button, .dashboard-top-bar a {
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
    margin-bottom: 5px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}
.dashboard-top-bar button:hover, .dashboard-top-bar a:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 210, 255, 0.3);
}

/* =========================================
   6. CORRECCIONES ESPECÍFICAS (INFORMES Y E14)
   ========================================= */

/* Título: Panel administrativo E14 en vivo -> AMARILLO */
.titulo-e14-vivo,
h1.titulo-e14-vivo,
h2.titulo-e14-vivo {
    color: #fcd802 !important;
    text-shadow: 0 0 20px rgba(252, 216, 2, 0.6);
    border-bottom: 2px solid #fcd802;
    display: inline-block;
    padding-bottom: 5px;
}

/* Títulos de Informes, Gráficas, Mapas y Datos de Logística -> AZUL OSCURO */
/* Se aplica a los recuadros blancos que mencionas */
.titulo-azul-oscuro,
.reporte-box h3,
.grafica-box h3,
.mapa-box h3,
.instrucciones-logistica {
    color: #003366 !important; /* Azul oscuro corporativo */
    text-shadow: none !important; /* Sin brillo neón para leer sobre blanco */
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Texto específico de instrucciones de carga (Cédula, Puesto, etc.) */
.texto-instrucciones {
    color: #003366 !important;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.9); /* Fondo blanco suave por si acaso */
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    display: inline-block;
    margin-top: 10px;
}