/* static/css/aulex-tech.css */

/* --- VARIABLES GLOBALES --- */
:root {
    --aulex-black: #050505;
    --aulex-dark-grey: #121212;
    --aulex-blue: #0d6efd;
    --aulex-success: #00ff88; /* Verde Neón */
    --aulex-warning: #ffbd00; /* Amarillo Neón */
    --aulex-danger: #ff0055;  /* Rojo Neón */
    --neon-glow: 0 0 10px rgba(13, 110, 253, 0.5);
    --glass-bg: rgba(20, 20, 20, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* --- BASE & TIPOGRAFÍA --- */
body {
    background-color: var(--aulex-black) !important;
    background-image: radial-gradient(circle at 50% 0%, #1a1e25 0%, var(--aulex-black) 80%);
    background-attachment: fixed;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    color: #ffffff;
    overflow-x: hidden;
}

html, body {
    max-width: 100% !important;
    overflow-x: hidden !important; /* <--- ESTA ES LA CLAVE */
    width: 100vw; /* Asegura que ocupe el ancho de la ventana, no más */
    position: relative; 
    margin: 0;
    padding: 0;
}

.text-muted { color: #8c8c8c !important; }

/* --- NAVBAR TECH --- */
.navbar {
    background: rgba(5, 5, 5, 0.85) !important;
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.nav-link-tech {
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link-tech:hover, .nav-link-tech.active {
    color: #ffffff !important;
    text-shadow: 0 0 8px rgba(13, 110, 253, 0.8);
}

.nav-link-tech::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--aulex-blue);
    transition: all 0.3s ease;
    box-shadow: 0 0 10px var(--aulex-blue);
    transform: translateX(-50%);
}

.nav-link-tech:hover::after { width: 80%; }

/* --- BOTONES TECH --- */
.btn-tech-outline {
    color: var(--aulex-blue);
    border: 1px solid var(--aulex-blue);
    background: transparent;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.btn-tech-outline:hover {
    background: var(--aulex-blue);
    color: white;
    box-shadow: 0 0 15px rgba(13, 110, 253, 0.6);
}

/* --- TARJETAS (CARDS) --- */
.card-tech {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    color: #ffffff !important;
}

.card-tech:hover {
    background: rgba(30, 30, 30, 0.9);
    border-color: var(--aulex-blue);
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(13, 110, 253, 0.2);
}

.card-tech h1, .card-tech h2, .card-tech h3, .card-tech h4, .card-tech h5 {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.tech-icon {
    color: var(--aulex-blue);
    filter: drop-shadow(0 0 5px rgba(13, 110, 253, 0.5));
}

/* --- FORMULARIOS --- */
.form-control-tech, .form-select-tech {
    background-color: rgba(10, 10, 10, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
    backdrop-filter: blur(5px);
}

.form-control-tech:focus, .form-select-tech:focus {
    background-color: rgba(20, 20, 20, 0.9) !important;
    border-color: var(--aulex-blue);
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.25);
    color: #fff;
}

/* --- KPIS --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.kpi-card-tech {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.kpi-value { font-size: 2rem; font-weight: 800; color: var(--aulex-blue); text-shadow: 0 0 10px rgba(13,110,253,0.3); }
.kpi-label { font-size: 0.9rem; color: #aaa; text-transform: uppercase; letter-spacing: 1px; margin-top: 5px; }

/* --- TABLAS --- */
.table-tech {
    color: #fff;
    border-collapse: separate;
    border-spacing: 0 10px;
}
.table-tech thead th {
    border: none;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--aulex-blue);
    letter-spacing: 1px;
    background: transparent;
}
.table-tech tbody tr {
    background: rgba(255,255,255,0.03);
    transition: all 0.2s;
}
.table-tech tbody tr:hover {
    background: rgba(255,255,255,0.08);
    transform: scale(1.01);
}
.table-tech td {
    border: none;
    padding: 15px;
    vertical-align: middle;
}
.table-tech td:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.table-tech td:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

/* --- BADGES --- */
.badge-tech {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.1);
}
.badge-tech-success { background: rgba(0, 255, 136, 0.15); color: var(--aulex-success); border-color: var(--aulex-success); }
.badge-tech-warning { background: rgba(255, 189, 0, 0.15); color: var(--aulex-warning); border-color: var(--aulex-warning); }
.badge-tech-danger { background: rgba(255, 0, 85, 0.15); color: var(--aulex-danger); border-color: var(--aulex-danger); }
.badge-tech-elite { background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%); color: #000; border: none; }

/* --- FILE UPLOAD ZONE --- */
.file-upload-wrapper {
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    background: rgba(0,0,0,0.2);
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
}
.file-upload-wrapper:hover { border-color: var(--aulex-blue); background: rgba(13,110,253,0.05); }
.file-upload-input { position: absolute; top:0; left:0; width:100%; height:100%; opacity:0; cursor: pointer; }

/* --- MAPAS & MODALES --- */
.leaflet-container { border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); }
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(95%) contrast(90%); }

.modal-content { background: #121212; border: 1px solid rgba(255,255,255,0.1); color: #fff; }
.modal-header { border-bottom: 1px solid rgba(255,255,255,0.1); }
.modal-footer { border-top: 1px solid rgba(255,255,255,0.1); }
.btn-close { filter: invert(1); }

/* --- INTERPRETACIONES - CHAT GEMINI --- */
.telemetry-layout {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 1.25rem;
    align-items: start; 
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    min-height: 400px;
    position: sticky;
    top: 20px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* --- NUEVAS CLASES PARA LAS BURBUJAS --- */
.message {
    max-width: 88%;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-self: flex-end;
}

.message.model {
    align-self: flex-start;
}

.message-content {
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.message.user .message-content {
    background: rgba(13, 110, 253, 0.2);
    border: 1px solid rgba(13, 110, 253, 0.55);
    border-bottom-right-radius: 2px;
    color: #ffffff;
}

.message.model .message-content {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom-left-radius: 2px;
    color: #e5e7eb;
}

/* Estilos para el Markdown dentro del chat */
.message-content strong {
    color: var(--aulex-blue);
    font-weight: bold;
}

.message-content em {
    color: var(--aulex-warning);
    font-style: italic;
}
/* --------------------------------------- */

.kpi-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.kpi-item {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
}

.kpi-item .label {
    color: #8c8c8c;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.kpi-item .value {
    color: #e5e7eb;
    font-weight: 700;
    margin-top: 0.35rem;
}

.summary-panel {
    min-height: 130px;
    line-height: 1.55;
}

.sensor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.sensor-item {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
}

.sensor-item strong {
    display: block;
    color: #e5e7eb;
    font-size: 0.95rem;
}

.sensor-item span {
    color: #8c8c8c;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.loading-text {
    color: #9ca3af;
    font-style: italic;
}

@media (max-width: 992px) {
    .telemetry-layout {
        grid-template-columns: 1fr;
    }

    .chat-container {
        height: 65vh;
        min-height: 400px;
        position: relative;
        top: 0;
    }
}
/* --- MÓVIL --- */
@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(10, 10, 10, 0.98);
        padding: 20px;
        margin-top: 15px;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    }
    .nav-link-tech { border-bottom: 1px solid rgba(255,255,255,0.05); padding: 15px 0; }
    .nav-link-tech::after { display: none; }
}