:root {
  /* Tipografía Base */
  --base-font-size: 1rem;

  /* Colores Principales (Modo Oscuro) */
  --bee-yellow: #FFD166;
  /* Amarillo suave para acentos */
  --bee-amber: #F4A261;
  /* Naranja Ámbar */
  --bee-dark-bg: #121212;
  /* Fondo principal de la app */
  --bee-card-bg: #1E1E1E;
  /* Fondo de las tarjetas */
  --bee-sidebar-bg: #181818;
  /* Fondo del menú lateral */

  /* Textos y Bordes */
  --text-main: #FDFDFD;
  --text-muted: #9CA3AF;
  --border-color: rgba(255, 255, 255, 0.08);

  /* Estados y Trazabilidad */
  --pollen-green: #2ECC71;
  --sting-red: #E74C3C;
  --trend-up: #2ECC71;
  --trend-down: #E74C3C;

  --sidebar-width: 250px;
}

/* =========================================================
   RESETEO GLOBAL Y FONDOS
   ========================================================= */
html,
body {
  height: 100%;
  font-size: var(--base-font-size) !important;
  background-color: var(--bee-dark-bg) !important;
  color: var(--text-main) !important;
}

/* Eliminar la imagen de fondo de abejas y forzar color sólido */
.main-content-bg {
  background-image: none !important;
  background-color: var(--bee-dark-bg) !important;
}

/* =========================================================
   HEADER Y SIDEBAR
   ========================================================= */
header,
.main-header {
  background-color: var(--bee-sidebar-bg) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

#sidebar {
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background-color: var(--bee-sidebar-bg) !important;
  border-right: 1px solid var(--border-color);
  transition: all 0.3s;
  overflow-y: hidden;
  height: 100%;
}

#sidebar.is-collapsed {
  flex: 0 0 0;
  min-width: 0;
  max-width: 0;
  width: 0;
  padding: 0 !important;
  border: 0;
}

#sidebar.is-collapsed > * {
  display: none;
}

#sidebar-toggle-container {
  align-self: stretch;
  display: flex;
  flex: 0 0 40px;
  align-items: center;
  height: 100%;
  background-color: var(--bee-sidebar-bg);
  border-right: 1px solid var(--border-color);
}

#sidebarCollapse {
  padding: 8px;
  width: 100%;
  height: 100%;
}

#sidebar .nav.overflow-auto {
  min-height: 0;
  flex-basis: 0;
  overflow-y: auto;
  flex-wrap: nowrap;
}

#sidebar .nav.overflow-auto::-webkit-scrollbar {
  width: 5px;
}

#sidebar .nav.overflow-auto::-webkit-scrollbar-track {
  background: transparent;
}

#sidebar .nav.overflow-auto::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

#sidebar .nav-link {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  transition: all 0.3s;
  font-size: var(--base-font-size) !important;
  border-radius: 8px;
  margin: 4px 12px;
  padding: 10px 15px;
}

#sidebar .nav-link:hover {
  background-color: rgba(255, 209, 102, 0.1);
  color: var(--bee-yellow);
}

#sidebar .nav-link.active {
  background-color: rgba(255, 209, 102, 0.15);
  color: var(--bee-yellow);
  border-left: 4px solid var(--bee-yellow);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  font-weight: bold;
}

#sidebar .collapse .nav-link {
  padding-left: 2.5rem;
}

/* =========================================================
   TARJETAS (CARDS) - Estilo limpio y oscuro
   ========================================================= */
.card {
  background-color: var(--bee-card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15) !important;
  color: var(--text-main) !important;
}

.card-header {
  background-color: transparent !important;
  border-bottom: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
}

.card-header h4,
.card-header h5,
.card-header h6 {
  color: var(--text-main) !important;
}

.card-body,
.card-footer {
  background-color: transparent !important;
  color: var(--text-main) !important;
  border-top: none !important;
}

/* Eliminar bordes gruesos de Bootstrap para un look Stitch más limpio */
.border-left-primary,
.border-left-success,
.border-left-info,
.border-left-warning,
.border-left-danger,
.border-left-secondary {
  border-left: 1px solid var(--border-color) !important;
}

/* =========================================================
   SOBRESCRIBIR TEXTOS Y FONDOS DE BOOTSTRAP
   ========================================================= */
.text-gray-800,
.text-dark,
.text-gray-700 {
  color: var(--text-main) !important;
}

.text-muted,
small.text-muted {
  color: var(--text-muted) !important;
}

.bg-white,
.bg-light {
  background-color: var(--bee-card-bg) !important;
}

.border-bottom {
  border-bottom: 1px solid var(--border-color) !important;
}

/* Dropdown de Temporada y botones genéricos */
.btn-outline-secondary {
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
}

.btn-outline-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--text-main) !important;
}

/* =========================================================
   TABLAS (DataTables y Tablas Generales)
   ========================================================= */
.table-beehive,
table.dataTable,
.table {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px;
  overflow: hidden;
  background-color: transparent !important;
  color: var(--text-main) !important;
}

.table-beehive thead th,
table.dataTable thead th,
.table thead th {
  background-color: rgba(255, 255, 255, 0.02) !important;
  color: var(--text-muted) !important;
  border-bottom: 1px solid var(--border-color) !important;
  border-top: none !important;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.table-beehive tbody tr,
table.dataTable tbody tr,
.table tbody tr {
  background-color: transparent !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.table-beehive tbody tr:nth-of-type(odd),
table.dataTable tbody tr:nth-of-type(odd),
.table tbody tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.02) !important;
}

.table-beehive tbody tr:hover,
table.dataTable tbody tr:hover,
.table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  cursor: pointer;
}

.table-beehive tbody td,
table.dataTable tbody td,
.table tbody td {
  border: none !important;
  border-top: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
}

/* =========================================================
   FORMULARIOS, BOTONES Y SELECT2
   ========================================================= */
.form-control,
.custom-select {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
}

.form-control:focus,
.custom-select:focus {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--bee-yellow) !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 209, 102, 0.25) !important;
  color: var(--text-main) !important;
}

/* Opciones de selectores HTML nativos en Modo Oscuro */
select.form-control option,
select.custom-select option,
select option {
  background-color: var(--bee-card-bg) !important;
  color: var(--text-main) !important;
}

/* Select2 Modo Oscuro (soporta tanto theme="bootstrap4" como theme="default" de django-select2) */
.select2-container--bootstrap4 .select2-selection,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: 0.25rem !important;
}

.select2-container--bootstrap4.select2-container--focus .select2-selection,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--bee-yellow) !important;
  box-shadow: 0 0 0 0.2rem rgba(255, 209, 102, 0.25) !important;
}

.select2-container--bootstrap4 .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--text-main) !important;
}

.select2-container--bootstrap4 .select2-selection__placeholder,
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text-muted) !important;
}

/* Etiquetas/Pills de selección múltiple (Select2 Multiple) */
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice,
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: rgba(255, 209, 102, 0.16) !important;
  border: 1px solid rgba(255, 209, 102, 0.5) !important;
  color: var(--bee-yellow) !important;
  border-radius: 6px !important;
  padding: 2px 10px 2px 26px !important;
  margin-top: 4px !important;
  margin-right: 6px !important;
  position: relative !important;
  font-weight: 500;
}

.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__display,
.select2-container--default .select2-selection--multiple .select2-selection__choice__display {
  color: var(--bee-yellow) !important;
  padding: 0 !important;
}

.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove,
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: var(--bee-yellow) !important;
  background-color: transparent !important;
  border: none !important;
  border-right: 1px solid rgba(255, 209, 102, 0.35) !important;
  border-top-left-radius: 5px !important;
  border-bottom-left-radius: 5px !important;
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: bold !important;
}

.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover,
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  background-color: rgba(231, 76, 60, 0.25) !important;
  color: var(--sting-red) !important;
}

/* Buscador interno de Select2 */
.select2-dropdown {
  background-color: var(--bee-card-bg) !important;
  border: 1px solid var(--border-color) !important;
}

.select2-search--dropdown .select2-search__field {
  background-color: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: 4px !important;
}

.select2-search--inline .select2-search__field {
  background-color: transparent !important;
  border: none !important;
  color: var(--text-main) !important;
}

.select2-results__option {
  color: var(--text-main) !important;
}

.select2-results__option[aria-selected="true"],
.select2-container--default .select2-results__option--selected {
  background-color: rgba(255, 255, 255, 0.12) !important;
  color: var(--bee-yellow) !important;
}

.select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background-color: var(--bee-yellow) !important;
  color: var(--bee-dark-bg) !important;
}

/* Botones Beehive Custom */
.btn-guardar-bee {
  background-color: var(--bee-yellow);
  color: var(--bee-dark-bg);
  border: none;
  font-weight: 600;
}

.btn-guardar-bee:hover {
  background-color: #E6BC5C;
  color: var(--bee-dark-bg);
}

.btn-cancelar-bee {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-cancelar-bee:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* =========================================================
   MISCELÁNEOS Y SCROLLBARS
   ========================================================= */
.material-icons {
  font-size: 1.4em;
  vertical-align: middle;
}

.material-icons-sm {
  font-size: 1rem;
}

/* Scrollbars Globales */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bee-dark-bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Altura Corregida para Select2 en Bootstrap 4 y Default */
.select2-container--bootstrap4 .select2-selection--single,
.select2-container--default .select2-selection--single {
  height: calc(1.5em + .75rem + 2px) !important;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered,
.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder,
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--single .select2-selection__placeholder {
  line-height: calc(1.5em + .75rem) !important;
  padding-top: 2px !important;
}

.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow,
.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: calc(1.5em + .75rem + 2px) !important;
}

.select2-container--bootstrap4 .select2-selection--multiple,
.select2-container--default .select2-selection--multiple {
  min-height: calc(1.5em + .75rem + 2px) !important;
}

/* =========================================================
   BOTONERAS DE EXPORTACIÓN (DATATABLES)
   ========================================================= */
.dt-buttons .btn-light,
.dt-buttons .btn {
  background-color: var(--bee-card-bg) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-muted) !important;
  border-radius: 6px;
  margin-left: 4px;
  transition: all 0.2s ease-in-out;
}

.dt-buttons .btn-light:hover,
.dt-buttons .btn:hover {
  background-color: rgba(255, 209, 102, 0.1) !important;
  /* Reflejo amarillo suave */
  color: var(--bee-yellow) !important;
  border-color: var(--bee-yellow) !important;
}

/* =========================================================
   PAGINACIÓN (BOOTSTRAP / DATATABLES)
   ========================================================= */
.pagination {
  margin-bottom: 0;
}

.page-link {
  background-color: var(--bee-card-bg) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-muted) !important;
  transition: all 0.2s;
}

.page-link:hover {
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: var(--text-main) !important;
}

/* Botón de la página actual (Activo) */
.page-item.active .page-link {
  background-color: rgba(255, 209, 102, 0.15) !important;
  border-color: var(--bee-yellow) !important;
  color: var(--bee-yellow) !important;
  font-weight: bold;
}

/* Botones Anterior/Siguiente desactivados */
.page-item.disabled .page-link {
  background-color: var(--bee-dark-bg) !important;
  color: rgba(255, 255, 255, 0.2) !important;
  border-color: var(--border-color) !important;
}

/* =========================================================
   LISTAS Y ALERTAS (MODO OSCURO)
   ========================================================= */
.list-group-item {
  background-color: transparent !important;
  border-color: var(--border-color) !important;
  color: var(--text-main) !important;
}

/* Para asegurar que los textos de las alertas no se pierdan */
.list-group-item.text-danger {
  color: var(--sting-red) !important;
}

.list-group-item.text-success {
  color: var(--pollen-green) !important;
}

.list-group-item.text-warning {
  color: var(--bee-yellow) !important;
}

.list-group-item.text-info {
  color: #36b9cc !important;
}