:root {
  --primary-color: #4361ee;
  --secondary-color: #3f37c9;
  --accent-color: #4895ef;
  --grid-gap: 1rem;
  --transition-speed: 0.3s;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #f8f9fa;
  color: #2b2d42;
  transition: all var(--transition-speed) ease;
  font-size: 16px;
  /* padding: 0 10px; */
}

/* Ajustes para responsividad */
.chart-container {
  width: 100%;
  height: 300px;
  aspect-ratio: 16/9;
  text-align: center;
}

@media (max-width: 768px) {
  .chart-container {
    aspect-ratio: 4/3;
  }
}

/* DataTables: configuración base y wrapper */
.dataTables_wrapper {
  overflow-x: auto;
  min-width: 100%;
  padding: 20px;
  background: #ffffff; /* Modo claro */
  color: #2b2d42;      /* Modo claro */
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

body.dark-mode .dataTables_wrapper {
  background: #1e293b;
  color: #f8fafc;
}

/* Encabezados de la tabla y filtros */
table.dataTable thead {
  background-color: #2c3e50;
  color: #ffffff;
}
body.dark-mode table.dataTable thead {
  color: #f8fafc;
}

table.dataTable thead input {
  background-color: #ffffff;
  color: #2b2d42;
  border: 1px solid #ccc;
}
body.dark-mode table.dataTable thead input {
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid #2c3e50;
}

/* Filas y hover en la tabla */
table.dataTable tbody tr {
  background-color: #ffffff;
  color: #2b2d42;
}
body.dark-mode table.dataTable tbody tr {
  background-color: #1e293b;
  color: #f8fafc;
}

table.dataTable tbody tr:hover {
  background-color: #f8f9fa !important;
}
body.dark-mode table.dataTable tbody tr:hover {
  background-color: #2c3e50 !important;
}

/* Paginación */
.dataTables_wrapper .paginate_button {
  color: #2b2d42 !important;
  background: transparent;
}
body.dark-mode .dataTables_wrapper .paginate_button {
  color: #f8fafc !important;
  background: #1e293b !important;
}

/* Preloader Global */
.global-preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.preloader {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Encabezado Full Width */
.header-section {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  background: white;
  padding: 1rem 0;
  border-top: 1px solid #b1b1b1;
  border-bottom: 1px solid #b1b1b1;
  display: flex;
  justify-content: center;
}

.header-content {
  width: 65%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Panel de búsqueda */
.search-panel {
  background: white;
  padding: 1.5rem; /* Se reemplaza el padding previo de 1rem */
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  margin-top: 0.5rem;
}

.search-panel-header {
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.3rem;
  margin-bottom: 1rem;
}

@media (max-width: 576px) {
  .search-panel .col-md-3,
  .search-panel .col-md-4 {
    flex: 100%;
    max-width: 100%;
  }
}

/* Ajuste para que el select tenga la misma altura que los inputs */
.select2-container .select2-selection--single {
  height: 33px !important;
  padding: 0.375rem 0.75rem;
  display: flex;
  align-items: center;
}

.select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
}

/* Cards e info boxes */
.dashboard-grid {
  width: 100%;
  margin: 2rem auto;
  gap: var(--grid-gap);
}

.info-box {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: transform var(--transition-speed) ease;
  min-height: 180px;
}

.info-box .card-header {
  font-weight: 600;
  font-size: 1rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
}

.info-box .card-body {
  padding: 0;
}

.card-body p {
  font-size: 1rem;
}

.badge-red {
  color: rgb(180, 50, 27);
  font-weight: bold;
}

/* Botón Buscar */
#searchButton {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#searchButton .material-icons {
  vertical-align: middle;
  margin-right: 5px;
}

/* Estilo de botones de acciones */
.info-box[aria-label="Acciones"] button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.9rem;
  padding: 0.4rem 0.6rem;
}

.info-box[aria-label="Acciones"] button .material-icons {
  font-size: 1.2rem;
}

@media (max-width: 576px) {
  .info-box[aria-label="Acciones"] button span.btn-text {
    display: none;
  }
}

/* Botones flotantes */
.floating-buttons {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.floating-buttons button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Modo Oscuro general */
body.dark-mode {
  background: #0f172a;
  color: #f8fafc;
}

body.dark-mode .header-section {
  background: #1e293b;
  border-color: #b1b1b1;
}

body.dark-mode #docPosition{
  color: #cbd5e1;
}

body.dark-mode #personasPanel{
  color: #cbd5e1;
}

body.dark-mode .search-panel,
body.dark-mode .info-box {
  background: #1e293b;
}

body.dark-mode .global-preloader {
  background: rgba(30, 41, 59, 0.9);
}

body.dark-mode .select2-container .select2-selection--single {
  background-color: #1e293b;
  color: #f8fafc;
  border: 2px solid #34495e !important;
}

body.dark-mode .select2-container--default .select2-selection--single .select2-selection__rendered,
body.dark-mode .select2-container--default .select2-results__option {
  color: #f8fafc;
  background-color: #1e293b;
}

body.dark-mode .select2-container--default .select2-results__option--highlighted {
  background-color: var(--accent-color);
}

/* Ajustes para filas */
.row {
  margin-left: 0;
  margin-right: 0;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    padding: 0 15px;
  }
  .floating-buttons {
    right: 10px;
  }
}

/* Encabezado de la tabla */
.table thead th {
  background: #6c757d;
  color: white;
}

/* Estilo para paginación y celdas en modo oscuro ya se encuentran integrados en los bloques anteriores */

/* Otros ajustes */
#documentosTable tbody tr td:first-child {
  cursor: pointer;
}

ul {
  list-style: none; /* Oculta los puntos de la lista */
  padding: 0; /* Elimina el relleno predeterminado */
}

ul li {
  cursor: pointer; /* Cambia el cursor a puntero al pasar sobre los elementos */
}

.info-box {
  font-size: 0.9em;
}

.info-box .card-body {
  font-size: 0.9em;
}

.search-panel {
  font-size: 0.9em;
}


.form-control, .form-select, .btn {
  font-size: 0.9em;
}

.btn.btn-outline-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem; /* Espacio entre icono y texto */
  text-align: center;
  /* Opcional: Si necesitas forzar una altura */
  /* height: 40px; */
}

.grupo-toggle {
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.grupo-toggle:hover {
    background-color: #e9ecef !important;
}

.current-doc {
    background-color: rgba(25, 135, 84, 0.1);
    border-left: 3px solid #198754;
    padding-left: 10px;
    border-radius: 0 4px 4px 0;
}

#capitulosPanel {
    scroll-behavior: smooth;
}

.cursor-pointer {
    cursor: pointer;
}

.current-highlight {
    background-color: rgba(25, 135, 84, 0.1) !important;
    border-left: 3px solid #198754 !important;
    padding-left: 12px !important;
    transition: all 0.3s ease;
}

.current-document {
    border-left: 3px solid #198754;
    background-color: rgba(25, 135, 84, 0.05);
    border-radius: 0 4px 4px 0;
}

#capitulosPanel {
    scroll-behavior: smooth;
}

.grupo-contenido {
    max-height: 500px;
    overflow-y: hidden;
}

.material-icons {
    font-size: 16px;
}

/* --- Alternar Logo para Modo Oscuro --- */

.main-header .main-header-content .logo img {
  opacity: 0;
  height: 0; 
  width: auto; 
  display: block;
}

.main-header .main-header-content .logo {
  background-image: url("../img/consello-logo.png");
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain;
  width: 250px; 
  height: 70px;
}

body.dark-mode .main-header .main-header-content .logo {
  background-image: url("../img/consello-logo-dark.png");
}

.logo-container {
  background-image: url("../img/logo.png");
  background-repeat: no-repeat;
  background-position: left center;
  background-size: contain; 
  
  width: 200px;
  height: 80px;
  

  margin-bottom: 5px; 
}

.logo-container img {
  opacity: 0;
  height: 0;
  width: 0;
  display: block; 
}

body.dark-mode .logo-container {
  background-image: url("../img/logo-dark.png");
}


body.dark-mode .user-section span {
    color: #f8fafc;
}