/* Ubicación: static/css/style.css */

/* Variables globales */
:root {
    --primary:#283649;
    --primary-dark: #1d2026;
    --secondary: #6c757d;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #5a5c69;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);

    /* Paleta extendida funcional */
    --brand-main: #127369;
    --brand-main-dark: #10403B;
    --brand-accent: #8AA6A3;

    --neutral-600: #4C5958;
    --neutral-300: #BFBFBF;

    /* Estados derivados */
    --brand-main-hover: #0f5e55;
    --brand-main-dark-hover: #0c332f;
    --neutral-600-hover: #3f4a49;
    --neutral-300-hover: #d4d4d4;

  }
  
  /* Estilos generales */
  body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f8f9fc;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
  }
  
  main {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  

  /* Animaciones */
  .fade-in {
    animation: fadeIn 0.5s ease-in-out;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* Estilos para la barra de navegación */
  .navbar {
    padding: 0.75rem 1rem;
    background-color: #1a73e8;
    color: white;
  }
  
  .navbar-brand {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    color: white;
  }
  
  /* Estilos para las tarjetas */
  .card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    margin-bottom: 1.5rem;
  }
  
  .card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    padding: 1.25rem 1.5rem;
  }
  
  /* Estilos para los bordes de color en las tarjetas */
  .border-left-primary {
    border-left: 0.25rem solid #4e73df;
  }
  
  .border-left-success {
    border-left: 0.25rem solid #1cc88a;
  }
  
  .border-left-info {
    border-left: 0.25rem solid #36b9cc;
  }
  
  .border-left-warning {
    border-left: 0.25rem solid #f6c23e;
  }
  
  .border-left-danger {
    border-left: 0.25rem solid #e74a3b;
  }
  
  
  
  /* NUEVOS ESTILOS PARA HEADER Y SIDEBAR */
  /* Header estilo blue */
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--primary);
    color: #fff;
    height: 60px;
    position: fixed;
    width: calc(100% - 264px);
    /* margin-left: 264px; */
    top: 0;
    z-index: 1010;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.35s ease-in-out;
  }

  .header.sidebar-collapsed {
    width: 100%;
    margin-left: 0;
  }
  
  .header h2 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
  }
  
  .header a {
    color: white;
    text-decoration: none;
  }
  
  #navbtn {
    font-size: 24px;
    cursor: pointer;
    margin-left: 15px;
    transition: transform 0.3s;
  }
  
  #navbtn:hover {
    transform: scale(1.1);
  }
  
  .user-icon {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
  }

  .user-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
  }

  .user-icon span {
    margin-left: 8px;
  }

  .user-name {
    display: inline-block;
  }

  /* User dropdown menu styles */
  .user-menu {
    position: relative;
  }

  .user-menu .dropdown-menu {
    margin-top: 8px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
  }

  .user-menu .dropdown-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
  }

  .user-menu .dropdown-item i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
  }

  .user-menu .dropdown-item:hover {
    background-color: #f8f9fa;
  }

  .user-menu .dropdown-item.text-danger:hover {
    background-color: #fee;
  }

  /* Sidebar colapsable */
  .side-bar {
    position: fixed;
    top: 60px;
    left: 0;
    width: 250px;
    height: calc(100vh - 60px);
    background: #262931;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  .side-bar.collapsed {
    width: 60px;
  }
  
  .user-p {
    text-align: center;
    padding: 20px 10px;
    border-bottom: 1px solid #444;
  }
  
  .user-p i {
    font-size: 2.5rem;
    color: #ddd;
    margin-bottom: 10px;
  }
  
  .user-p h4 {
    color: #eee;
    font-size: 14px;
    margin: 5px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .sidebar-title {
    font-size: 12px;
    text-transform: uppercase;
    color: #888;
    padding: 15px 20px 5px;
    letter-spacing: 1px;
  }
  
  .side-bar.collapsed .sidebar-title {
    padding: 15px 0 5px;
    text-align: center;
    font-size: 8px;
  }
  
  .side-bar ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  
  .side-bar ul li {
    position: relative;
  }
  
  .side-bar ul li a {
    display: flex;
    align-items: center;
    color: #eee;
    padding: 12px 20px;
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
  }
  
  .side-bar ul li a:hover {
    background: #333;
  }
  
  .side-bar ul li a.active {
    background: #1a4b8bb3;
    border-left: 3px solid #1a73e8;
  }
  
  .side-bar ul li a i {
    font-size: 18px;
    min-width: 25px;
    margin-right: 10px;
  }
  
  .side-bar.collapsed ul li a {
    padding: 12px 20px;
    text-align: center;
  }
  
  .side-bar.collapsed ul li a i {
    margin-right: 0;
  }
  
  .side-bar.collapsed ul li a span {
    opacity: 0;
    position: absolute;
    left: -9999px;
  }
  
  .side-bar.collapsed .user-p h4 {
    opacity: 0;
    position: absolute;
    left: -9999px;
  }
  
  /* Contenido principal */
  .content {
    /* margin-top: 60px; */
    padding: 20px;
    transition: all 0.3s ease;
  }
  
  .content.expanded {
    margin-left: 60px;
  }
  
  /* Dashboard cards */
  .dashboard-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
  }
  
  .dashboard-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .dashboard-body {
    padding: 20px;
  }


  /* Ajustes para dispositivos móviles */
  @media (max-width: 768px) {
    .header {
      width: 100% !important;
      margin-left: 0 !important;
    }

    /* User menu responsive */
    .user-name {
      display: none;
    }

    .user-menu .dropdown-menu {
      right: 0;
      left: auto;
      min-width: 180px;
    }

    .side-bar {
      transform: translateX(-100%);
      box-shadow: 0 0 10px rgba(0,0,0,0.1);
    }
    
    .side-bar.mobile-view {
      width: 250px;
    }
    
    .side-bar.mobile-view.show-mobile {
      transform: translateX(0);
    }
    
    .side-bar.mobile-view span,
    .side-bar.mobile-view .sidebar-title,
    .side-bar.mobile-view .user-p h4 {
      opacity: 1;
      display: inline;
      position: static;
    }
    
    .content.mobile-expanded {
      margin-left: 0;
    }
    
    .side-bar ul li a span {
      display: inline;
      opacity: 1;
      position: static;
    }
    
    .side-bar.collapsed ul li a span {
      position: absolute;
      left: -9999px;
      opacity: 0;
    }
  }
  
  /* Estilos para el overlay del sidebar en móvil */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 999;
  }
  
  @media (max-width: 768px) {
    .sidebar-overlay {
      display: none;
    }
    
    .side-bar.show-mobile ~ .sidebar-overlay {
      display: block;
    }
    
    /* Fix específico para el texto del sidebar */
    .side-bar:not(.collapsed) ul li a span {
      display: inline;
      opacity: 1;
      position: static;
    }
    
    .side-bar:not(.collapsed) .sidebar-title,
    .side-bar:not(.collapsed) .user-p h4 {
      display: block;
      opacity: 1;
      position: static;
    }
  }

  @media (max-width: 576px) {
    /* Ocultar el sidebar por defecto en celulares */
    .side-bar {
      transform: translateX(-100%);
      width: 100%;
      z-index: 1050;
    }
    
    /* Cuando se muestra en móvil, ocupar más espacio */
    .side-bar.show-mobile {
      transform: translateX(0);
      width: 80%;
      max-width: 280px;
    }
    
    /* Asegurar que todos los textos sean visibles */
    .side-bar ul li a span,
    .sidebar-title,
    .user-p h4 {
      display: inline-block !important;
      opacity: 1 !important;
      position: static !important;
      width: auto !important;
      height: auto !important;
      overflow: visible !important;
    }
    
    /* Mejorar la visualización de los iconos y textos */
    .side-bar ul li a {
      display: flex !important;
      align-items: center !important;
      padding: 15px 20px !important;
    }
    
    .side-bar ul li a i {
      margin-right: 15px !important;
      font-size: 18px !important;
    }
    
    /* Contenido principal a pantalla completa */
    .content {
      margin-left: 0 !important;
      width: 100% !important;
      padding: 15px !important;
    }
    
    /* Mejorar contraste del texto */
    .sidebar-title {
      color: #aaa !important;
    }
    
    .user-p h4 {
      color: white !important;
    }
  }
  
  /* Ocultar el overlay cuando se cierra el sidebar */
  .sidebar-overlay {
    transition: opacity 0.3s;
  }

  /* ============================================
     ALERTAS ESTÁTICAS - Sistema de Alertas
     ============================================ */

  /* Alertas estáticas que permanecen en su contexto */
  .alert-static {
    border-left: 4px solid currentColor;
    background-color: rgba(var(--bs-alert-bg-rgb), 0.95);
    position: relative;
  }

  .alert-static.alert-warning {
    border-left-color: #f6c23e;
  }

  .alert-static.alert-danger {
    border-left-color: #e74a3b;
  }

  .alert-static.alert-info {
    border-left-color: #36b9cc;
  }

  .alert-static.alert-success {
    border-left-color: #1cc88a;
  }

  /* Evitar que AlertSystem o scripts las procesen */
  .alert-static.processed-alert {
    display: block !important; /* Forzar visibilidad */
  }

  /* Indicador visual de alerta permanente */
  .alert-static::before {
    content: '\f5c7'; /* Bootstrap Icons: pin-fill */
    font-family: 'bootstrap-icons';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    opacity: 0.3;
    font-size: 0.875rem;
  }

  /* Footer de la aplicación */
  .app-footer {
    background-color: #f8f9fc;
    border-top: 1px solid #e3e6f0;
    padding: 1rem 0;
    margin-top: auto;
    color: #858796;
    font-size: 0.875rem;
  }

  .app-footer p {
    margin: 0;
  }

  /* Asegurar que el wrapper tenga flexbox para el footer sticky */
  #wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  .content {
    flex: 1;
  }

  /* ============================================
    ESTILOS DE CORRECCIÓN DE ETIQUETAS
     ============================================ */
  .dropdown-menu .show {
    z-index: 1060 !important;
  }

  /* ============================================
     VARIABLES GLOBALES PARA DATATABLES COMPACTAS
     ============================================ */
  :root {
    /* Tamaños de fuente */
    --dt-table-font-size: 0.8125rem;        /* 13px - Tablas compactas */
    --dt-breadcrumb-font-size: 0.875rem;    /* 14px - Breadcrumbs */
    --dt-header-font-size: 0.9375rem;       /* 15px - Títulos de cards */
    --dt-code-font-size: 0.875rem;          /* 14px - Códigos monospace */
    --dt-badge-font-size: 0.75rem;          /* 12px - Badges */
    --dt-btn-action-size: 0.875rem;         /* 14px - Botones de acción */
    --dt-help-text-size: 0.75rem;           /* 12px - Texto de ayuda */

    /* Espaciados de tabla */
    --dt-table-padding-y: 0.375rem;         /* 6px - Padding vertical celdas */
    --dt-table-padding-x: 0.5rem;           /* 8px - Padding horizontal celdas */

    /* Espaciados de componentes */
    --dt-card-header-py: 0.625rem;          /* 10px - Card header padding vertical */
    --dt-card-header-px: 1rem;              /* 16px - Card header padding horizontal */
    --dt-card-body-p: 0.75rem;              /* 12px - Card body padding */
    --dt-btn-action-padding: 0.25rem 0.5rem; /* Padding botones acción */
    --dt-filter-gap: 0.5rem;                /* Gap entre campos de filtro */
    --dt-container-py: 1rem;                /* Padding vertical contenedor */

    /* Colores de badges */
    --badge-dig-bg: #6c757d;                /* Gris - Digitada */
    --badge-imp-bg: #17a2b8;                /* Cyan - Impresa */
    --badge-fir-bg: #28a745;                /* Verde - Firmada */
    --badge-esc-bg: #0d6efd;                /* Azul - Escaneada */
    --badge-estado-b-bg: #28a745;           /* Verde - Bueno */
    --badge-estado-r-bg: #ffc107;           /* Amarillo - Regular */
    --badge-estado-m-bg: #dc3545;           /* Rojo - Malo */
    --badge-activo-bg: #28a745;             /* Verde - Activo */
    --badge-inactivo-bg: #6c757d;           /* Gris - Inactivo */
    --badge-retq-si-bg: #28a745;            /* Verde - Reetiquetado */
    --badge-retq-no-bg: #ffc107;            /* Amarillo - No reetiquetado */
    --badge-obs-si-bg: #dc3545;             /* Rojo - Con observación */
    --badge-obs-no-bg: #28a745;             /* Verde - Sin observación */

    /* Colores de texto para badges */
    --badge-light-text: #ffffff;
    --badge-dark-text: #212529;
  }