/* ==========================================================================
   VARIABLES GLOBALES DE COLOR Y ESTILO
   ========================================================================== */
:root {
    /* Fondos */
    --bg-dark: #0b0e14;
    --bg-card: #161b22;
    
    /* Textos */
    --text-main: #ffffff;
    --text-muted: #8b949e;
    
    /* Acentos y Degradados */
    --accent-purple-start: #8a2be2;
    --accent-purple-end: #ba55d3;
    --accent-cyan-start: #00f2ff;
    --accent-cyan-end: #00ced1;
    --accent-magenta: #ff00ff;
    --accent-red: #ff4b4b;
    --accent-purple-full: #7928ca;
    
    /* Bordes de tarjetas de métricas */
    --border-red: #ff4b4b;
    --border-cyan: #00f2ff;
    --border-white: #ffffff;
    --border-purple: #7928ca;

    /* Chatbot */
    --chatbot-bg: #161b22;
    --chatbot-msg-bg: #21262d;
    --chatbot-input-bg: #0b0e14;
    --chatbot-input-border: #30363d;
    --chatbot-avatar-border: #ba55d3;
}

/* ==========================================================================
   ESTILOS BASE
   ========================================================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    height: 100vh;
}

/* ==========================================================================
   LAYOUT DEL DASHBOARD (CSS GRID)
   ========================================================================== */
.dashboard-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 100vh;
    width: 100vw;
}

/* ==========================================================================
   BARRA LATERAL (SIDEBAR)
   ========================================================================== */
.sidebar {
    background-color: var(--bg-card);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #30363d;
    transition: transform 0.3s ease;
    height: 100%;
    box-sizing: border-box;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    align-self: flex-start;
    margin-bottom: 30px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 40px;
}

.avatar-placeholder {
    width: 50px;
    height: 50px;
    background-color: #30363d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-main);
    font-weight: bold;
}

.profile-details {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--accent-cyan-start);
}

.profile-role {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.nav-links li a:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-links i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

/* ==========================================================================
   CONTENIDO PRINCIPAL
   ========================================================================== */
.main-content {
    padding: 30px 40px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ==========================================================================
   TARJETAS DE MÉTRICAS (KPIs)
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    position: relative;
}

.metric-card--red { border-left-color: var(--border-red); }
.metric-card--cyan { border-left-color: var(--border-cyan); }
.metric-card--white { border-left-color: var(--border-white); }
.metric-card--purple { border-left-color: var(--border-purple); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.card-title {
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-value {
    font-size: 2.2rem;
    font-weight: bold;
    margin-top: 15px;
    margin-bottom: 15px;
}

.card-chart-placeholder {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    margin-top: auto;
}

.red-chart { background: linear-gradient(90deg, rgba(255, 75, 75, 0.2) 0%, rgba(255, 75, 75, 0.8) 100%); }
.cyan-chart { background: linear-gradient(90deg, rgba(0, 242, 255, 0.2) 0%, rgba(0, 242, 255, 0.8) 100%); }
.white-chart { background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.8) 100%); }
.purple-chart { background: linear-gradient(90deg, rgba(121, 40, 202, 0.2) 0%, rgba(121, 40, 202, 0.8) 100%); }

/* ==========================================================================
   PANELES Y GRÁFICOS
   ========================================================================== */
.center-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.map-area, .insights-area, .donut-chart-area, .utilization-area, .filters-panel, .data-flow-panel {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Estilos específicos para los menús desplegables (Dropdowns) de Dash */
.Select-control {
    background-color: var(--bg-dark) !important;
    border: 1px solid #30363d !important;
    color: white !important;
    border-radius: 8px;
}

.Select-menu-outer {
    background-color: var(--bg-card) !important;
    border: 1px solid var(--accent-cyan-start) !important;
    color: white !important;
}

.Select-value-label, .Select-placeholder {
    color: var(--text-main) !important;
}

/* ==========================================================================
   CHATBOT FLOTANTE Y AVATAR
   ========================================================================== */
.chat-icon {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-purple-start) 0%, var(--accent-cyan-start) 100%);
    border: none;
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 242, 255, 0.3);
    z-index: 1000;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: float-avatar 3s ease-in-out infinite;
}

.chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(0, 242, 255, 0.5);
    animation-play-state: paused;
}

@keyframes float-avatar {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.chatbot-panel {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    background-color: var(--chatbot-bg);
    border-radius: 20px;
    border: 1px solid #30363d;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    transform: translateY(30px) scale(0.9);
    opacity: 0;
    pointer-events: none;
}

.chatbot-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.chatbot-header {
    padding: 25px 20px 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, rgba(138, 43, 226, 0.1) 0%, transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e1e1e, #2a2a2a);
    border: 3px solid;
    border-image: linear-gradient(135deg, var(--accent-purple-start), var(--accent-cyan-start)) 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-main);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.4);
    position: relative;
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 15px;
    height: 15px;
    background-color: #00ff00;
    border-radius: 50%;
    border: 2px solid var(--chatbot-bg);
}

.chatbot-message {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chatbot-message p {
    background-color: var(--chatbot-msg-bg);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 12px 12px 12px 0;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    align-self: flex-start;
    max-width: 85%;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chatbot-input {
    padding: 15px 20px;
    background-color: var(--bg-dark);
    border-top: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-input input {
    font-size: 0.95rem;
}

.chatbot-input input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: none;
    border: none;
    color: var(--accent-cyan-start);
    font-size: 1.3rem;
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
    padding: 5px;
}

.send-btn:hover {
    transform: translateX(3px) scale(1.1);
    color: var(--accent-purple-start);
}

/* Scrollbar personalizada para áreas con scroll (Insights, Chat) */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

