/* =========================================
   ESTILOS COMPILADOS AUTOMÁTICAMENTE
========================================= */

/* Extraído de Comp_Extraccion.html */
/* Clases Dinámicas de Contraste para el Brandbook Institucional */
  .st-text { color: #284639 !important; }
  .st-bg { background-color: #284639 !important; color: white !important;}
  .st-border-left { border-left-color: #284639 !important; border-left-width: 4px !important; border-left-style: solid !important; }

  /* Adaptación automática a Modo Oscuro (Brillo Alto) */
  [data-bs-theme="dark"] .st-text { color: #52b788 !important; }
  [data-bs-theme="dark"] .st-bg { background-color: #1a2529 !important; color: #52b788 !important; border: 1px solid #373b3e !important; }
  [data-bs-theme="dark"] .st-border-left { border-left-color: #52b788 !important; }
  [data-bs-theme="dark"] .bg-body-tertiary { background-color: #1e1e1e !important; }

/* Extraído de Comp_Reporte.html */
/* Variables Dinámicas para Contraste Institucional */
  :root {
    --color-st-principal: #284639;
    --color-st-borde: #284639;
  }
  [data-bs-theme="dark"] {
    --color-st-principal: #52b788;
    --color-st-borde: #52b788;
  }
  
  .st-title { color: var(--color-st-principal) !important; }
  .st-border { border-color: var(--color-st-borde) !important; }
  .st-border-left { border-left-color: var(--color-st-borde) !important; border-left-width: 4px !important; border-left-style: solid !important;}

  /* Ajustes Panel Oscuro Específicos */
  [data-bs-theme="dark"] #visor-pdf-print .table { color: #e0e0e0 !important; border-color: #373b3e !important; }
  [data-bs-theme="dark"] #visor-pdf-print .table-dark { background-color: #1a2529 !important; border-color: #373b3e !important; }
  [data-bs-theme="dark"] #visor-pdf-print p, 
  [data-bs-theme="dark"] #visor-pdf-print li,
  [data-bs-theme="dark"] #visor-pdf-print td { color: #cccccc !important; }

/* Extraído de Comp_Tomasin.html */
/* Contenedor Flotante Inferior Izquierdo (Respeta el Sidebar de 250px) */
  #tomasin-widget {
    position: fixed;
    bottom: 20px;
    left: 270px; /* 250px del sidebar + 20px de margen */
    z-index: 1050;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: all 0.3s ease;
  }
  
  @media (max-width: 768px) {
    #tomasin-widget { left: 20px; }
  }

  /* Botón Flotante Pop-Up */
  .tomasin-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #284639;
    border: 3px solid #B7BF10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s ease;
  }
  .tomasin-fab:hover { transform: scale(1.05); }

  /* Ventana del Chat */
  #tomasin-chat-window {
    width: 380px;
    height: 500px;
    background-color: var(--bg-tarjeta);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    margin-bottom: 15px;
    border: 1px solid var(--borde-tabla);
    overflow: hidden;
  }

  .tomasin-header {
    background-color: #284639;
    color: #fff;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .tomasin-body {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  .tomasin-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-wrap: break-word;
  }
  .tomasin-msg-bot { background-color: var(--bg-plataforma); color: var(--texto-primario); align-self: flex-start; border-bottom-left-radius: 0; border: 1px solid var(--borde-tabla); }
  .tomasin-msg-user { background-color: #0db14b; color: #fff; align-self: flex-end; border-bottom-right-radius: 0; }

  .tomasin-footer {
    padding: 10px;
    background-color: var(--bg-plataforma);
    border-top: 1px solid var(--borde-tabla);
    display: flex;
    gap: 8px;
  }

  #tomasin-input {
    flex-grow: 1;
    border-radius: 20px;
    border: 1px solid var(--borde-tabla);
    padding: 8px 15px;
    font-size: 0.85rem;
    background-color: var(--bg-tarjeta);
    color: var(--texto-primario);
    outline: none;
  }
  #tomasin-input:focus { border-color: #0db14b; }

/* Extraído de JS_Inteligencia_Core.html */
/* =========================================================
   ESTILOS UX: BOTONES INTELIGENCIA ARTIFICIAL (BRANDBOOK ST)
   ========================================================= */
.btn-ia-st {
    background-color: #284639 !important;
    color: #ffffff !important;
    font-family: Arial, sans-serif !important;
    font-weight: bold !important;
    border: 1px solid #284639 !important;
    border-radius: 4px !important;
    transition: all 0.2s ease-in-out !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
}

.btn-ia-st:hover {
    background-color: #009172 !important;
    border-color: #009172 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    transform: translateY(-1px);
}

.btn-ia-st-outline {
    background-color: transparent !important;
    color: #284639 !important;
    font-family: Arial, sans-serif !important;
    font-weight: bold !important;
    border: 1px solid #284639 !important;
    border-radius: 4px !important;
    transition: all 0.2s ease-in-out !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
}

.btn-ia-st-outline:hover {
    background-color: #284639 !important;
    color: #ffffff !important;
}

.btn-ia-st-outline:hover svg {
    fill: #ffffff !important;
}

/* Extraído de JS_Reporte.html */
.pdf-section { margin-bottom: 25px; page-break-inside: avoid; }
        .pdf-title { color: var(--reporte-titulo); border-bottom: 2px solid var(--reporte-titulo); padding-bottom: 5px; margin-bottom: 15px; font-size: 1.1rem; font-weight: bold; text-transform: uppercase; }
        .pdf-text { font-size: 0.85rem; text-align: justify; margin-bottom: 10px; color: var(--reporte-texto); line-height: 1.5; }
        .pdf-table { width: 100%; border-collapse: collapse; margin-bottom: 15px; font-size: 0.8rem; color: var(--reporte-texto); }
        .pdf-table th, .pdf-table td { border: 1px solid var(--reporte-border); padding: 8px; }
        .pdf-table th { background-color: var(--reporte-table-head); color: var(--reporte-table-head-text); text-align: center; }
        .pdf-table .text-start { text-align: left; }
        .pdf-section ul li { color: var(--reporte-texto); }

/* Extraído de Index.html */
[data-bs-theme="light"] {
      --bg-plataforma: #ffffff;
      --bg-tarjeta: #e4e7eb;
      --texto-primario: #333333;
      --color-corporativo: #284639;
      --bg-sidebar: #284639;
      --borde-tabla: #d0d5dd;
      --reporte-titulo: #284639;
      --reporte-texto: #333333;
      --reporte-muted: #555555;
      --reporte-border: #dddddd;
      --reporte-box-bg: #f9f9f9;
      --reporte-box-border: #0db14b;
      --reporte-table-head: #284639;
      --reporte-table-head-text: #ffffff;
      --bg-highlight: rgba(13, 177, 75, 0.08);
      --border-highlight: #284639;
    }

    [data-bs-theme="dark"] {
      --bg-plataforma: #121212;
      --bg-tarjeta: #1e1e1e;
      --texto-primario: #e0e0e0;
      --color-corporativo: #52b788; 
      --bg-sidebar: #16251f;
      --borde-tabla: #373b3e;
      --reporte-titulo: #0db14b; 
      --reporte-texto: #ffffff;
      --reporte-muted: #ffffff; 
      --reporte-border: #444444;
      --reporte-box-bg: #2a2a2a;
      --reporte-box-border: #b7bf10; 
      --reporte-table-head: #0db14b;
      --reporte-table-head-text: #ffffff;
      --bg-highlight: rgba(82, 183, 136, 0.12);
      --border-highlight: #52b788;
    }

    body {
      font-family: Arial, sans-serif;
      background-color: var(--bg-plataforma);
      color: var(--texto-primario);
      display: flex;
      height: 100vh;
      overflow: hidden;
      transition: background-color 0.3s ease, color 0.3s ease;
    }
    
    #sidebar {
      width: 250px;
      min-width: 250px; 
      flex-shrink: 0;   
      height: 100vh;    
      background-color: var(--bg-sidebar);
      color: white;
      padding: 20px;
      transition: all 0.3s ease;
      overflow-y: auto; 
    }
    
    #sidebar hr { border-color: #0db14b; }
    
    #main-content {
      flex-grow: 1;
      min-width: 0; 
      padding: 30px;
      overflow-y: auto;
      height: 100vh;
    }
    
    .view-section { display: none; }
    .view-section.active { display: block; animation: fadeIn 0.4s; }
    
    .sidebar-link {
      color: #e9ecef;
      text-decoration: none;
      display: block;
      padding: 12px;
      margin-bottom: 8px;
      border-radius: 6px;
      font-weight: bold;
    }
    
    .sidebar-link:hover, .sidebar-link.active {
      background-color: #0db14b;
      color: white;
    }
    
    .text-corporativo { color: var(--color-corporativo) !important; font-weight: bold; }
    
    .btn-outline-corporativo { 
      color: var(--color-corporativo) !important; 
      border-color: var(--color-corporativo) !important; 
      background-color: transparent !important;
      transition: all 0.2s ease-in-out !important;
    }
    .btn-outline-corporativo:hover, 
    .btn-outline-corporativo.active { 
      background-color: var(--color-corporativo) !important; 
      color: #ffffff !important; 
      border-color: var(--color-corporativo) !important;
    }
    .btn-outline-corporativo:hover svg,
    .btn-outline-corporativo.active svg {
      fill: #ffffff !important;
    }

    [data-bs-theme="dark"] .btn-outline-corporativo {
      color: #52b788 !important;
      border-color: #52b788 !important;
      background-color: transparent !important;
    }
    [data-bs-theme="dark"] .btn-outline-corporativo:hover,
    [data-bs-theme="dark"] .btn-outline-corporativo.active {
      background-color: #52b788 !important;
      color: #121212 !important;
      border-color: #52b788 !important;
    }
    [data-bs-theme="dark"] .btn-outline-corporativo:hover svg,
    [data-bs-theme="dark"] .btn-outline-corporativo.active svg {
      fill: #121212 !important;
    }
    
    .card, .bg-white, .modal-content { background-color: var(--bg-tarjeta) !important; }
    .table { color: var(--texto-primario) !important; border-color: var(--borde-tabla) !important; }
    
    .btn-expandir {
      position: absolute;
      top: 10px;
      right: 15px;
      z-index: 10;
      opacity: 0.5;
      transition: opacity 0.2s;
    }
    
    .card:hover .btn-expandir { opacity: 1; }

    .filtro-destacado {
      background-color: var(--bg-highlight);
      border: 2px solid var(--border-highlight);
      border-radius: 8px;
      padding: 6px 10px;
    }

    .bg-icono-inicio {
      background-color: #f8f9fa !important;
    }
    [data-bs-theme="dark"] .bg-icono-inicio {
      background-color: var(--bg-plataforma) !important;
    }
    
    @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
    
    #loading-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      background-color: var(--bg-plataforma);
      z-index: 9999;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    }
    
    .spinner-vcm {
      width: 4rem;
      height: 4rem;
      border: 6px solid #e9ecef;
      border-top-color: var(--color-corporativo);
      border-right-color: #0db14b;
      border-radius: 50%;
      animation: spinVCM 1s linear infinite;
    }
    
    @keyframes spinVCM {
      to { transform: rotate(360deg); }
    }
    
    .cursor-pointer { cursor: pointer; }
    
    @media (max-width: 768px) {
      body { flex-direction: column; }
      #sidebar { 
        width: 100%; 
        min-width: 100%; 
        height: auto; 
        flex-shrink: 1;
        padding: 15px; 
      }
      #main-content { height: auto; }
      .sidebar-link { display: inline-block; margin-bottom: 0; }
    }



/* ==========================================================
   PARCHE AUTOMATIZADO - CORRECCIONES MODO OSCURO CLOUDFLARE
   ================ ========================================== */

/* 1. Fondo blanco de contenedores principales en modo oscuro */
body.dark-mode .card,
body.dark-mode .bg-white,
body.dark-mode .welcome-container,
body.dark-mode div[style*="background-color: white"],
body.dark-mode div[style*="background: white"] {
    background-color: #1e252b !important;
    color: #e0e0e0 !important;
    border-color: #2c343d !important;
}

/* 2. Botón gris para extender gráfico */
body.dark-mode .btn-expand,
body.dark-mode button.expand-btn,
body.dark-mode .card-header button,
body.dark-mode [class*="expand"],
body.dark-mode .fullscreen-btn {
    background-color: #283138 !important;
    color: #b0bec5 !important;
    border: 1px solid #3a4750 !important;
}
body.dark-mode .btn-expand:hover,
body.dark-mode button.expand-btn:hover {
    background-color: #37474f !important;
    color: #ffffff !important;
}

/* 3. Fondo del botón para cambiar ponderado a simplificado */
body.dark-mode .nav-pills,
body.dark-mode .btn-group,
body.dark-mode .switch-container,
body.dark-mode .toggle-switch,
body.dark-mode div[style*="background-color: #e9ecef"],
body.dark-mode div[style*="background: #f8f9fa"] {
    background-color: #161b22 !important;
    border-color: #30363d !important;
}
body.dark-mode .nav-pills .nav-link,
body.dark-mode .btn-group .btn {
    color: #c9d1d9 !important;
}
body.dark-mode .nav-pills .nav-link.active,
body.dark-mode .btn-group .btn.active {
    background-color: #1f6feb !important;
    color: #ffffff !important;
}
