/* ============================================
   ITEMS PRINCIPALES
============================================ */
.sidebar-item {
  width: 100%;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: none;
  color: #374151;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.sidebar-item i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-item:hover {
  background: #f3f4f6;
}

.sidebar-item.active {
  background: #e7f1ff;
  color: #0d6efd;
  font-weight: 600;
}

/* Ocultar texto en mini */
.sidebar.sidebar-mini .sidebar-item span {
  opacity: 0;
  pointer-events: none;
}

.sidebar.sidebar-mini:hover .sidebar-item span {
  opacity: 1;
}

/* Centrar iconos en mini */
.sidebar.sidebar-mini .sidebar-item {
  justify-content: center;
}

.sidebar.sidebar-mini:hover .sidebar-item {
  justify-content: flex-start;
}

/* ============================================
   CHEVRON (colapsables)
============================================ */
.sidebar-collapse-toggle {
  justify-content: left;
}

.sidebar-collapse-toggle .chevron {
  transition: transform 0.2s ease;
}

.sidebar-collapse-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.sidebar.sidebar-mini .chevron {
  opacity: 0;
  pointer-events: none;
}

.sidebar.sidebar-mini:hover .chevron {
  opacity: 1;
}

/* ============================================
   SUBITEMS
============================================ */
.sidebar-subitem {
  padding: 8px 16px 8px 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #4b5563;
  font-size: 0.9rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.sidebar-subitem i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.sidebar-subitem:hover {
  background: #f3f4f6;
}

.sidebar-subitem.active {
  background: #e7f1ff;
  color: #0d6efd;
  font-weight: 600;
}

/* Ocultar texto en mini */
.sidebar.sidebar-mini .sidebar-subitem span {
  opacity: 0;
  pointer-events: none;
}

.sidebar.sidebar-mini:hover .sidebar-subitem span {
  opacity: 1;
}

/* Centrar iconos en mini */
.sidebar.sidebar-mini .sidebar-subitem {
  padding-left: 0 !important;
  justify-content: center !important;
}

.sidebar.sidebar-mini:hover .sidebar-subitem {
  padding-left: 48px !important;
  justify-content: flex-start !important;
}

/* ============================================
   FIX — RESET TOTAL EN MINI
============================================ */
.sidebar.sidebar-mini .sidebar-item,
.sidebar.sidebar-mini .sidebar-subitem,
.sidebar.sidebar-mini .sidebar-collapse-toggle {
  padding-left: 0 !important;
  padding-right: 0 !important;
  gap: 0 !important;
  justify-content: center !important;
}

.sidebar.sidebar-mini .sidebar-item i,
.sidebar.sidebar-mini .sidebar-subitem i {
  margin-right: 0 !important;
}

/* ============================================
   TOOLTIP AUTOMÁTICO EN MODO MINI
============================================ */
.sidebar.sidebar-mini .sidebar-item[title],
.sidebar.sidebar-mini .sidebar-subitem[title] {
  position: relative;
}

.sidebar.sidebar-mini .sidebar-item:hover::after,
.sidebar.sidebar-mini .sidebar-subitem:hover::after {
  content: attr(title);
  position: absolute;
  left: 80px;
  top: 50%;
  transform: translateY(-50%);
  background: #111827;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  opacity: 1;
  pointer-events: none;
}

/* ============================================
   LAYOUT — AJUSTE DEL CONTENIDO
============================================ */
.main-wrapper {
  margin-left: 240px;
  transition: margin-left 0.25s ease;
}

.sidebar.sidebar-mini ~ .main-wrapper {
  margin-left: 72px;
}

.sidebar.sidebar-mini:hover ~ .main-wrapper {
  margin-left: 240px;
}

/* ============================================
   RESPONSIVE — MÓVIL
============================================ */
@media (max-width: 992px) {
  .sidebar {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
}

.container-xl {
  max-width: 100% !important;
}

/* ============================================
   TEMA CORPORATIVO COMPLETO PARA TODO EL ERP
   Estilo B (corporativo, limpio, profesional)
============================================ */

/* ------------------------------
   TIPOGRAFÍA Y BASE
------------------------------ */
body {
  font-family: "Inter", "Segoe UI", Roboto, sans-serif;
  background: #f4f6f9;
  color: #2b2b2b;
  line-height: 1.5;
}

a {
  text-decoration: none;
  color: #0d6efd;
}

a:hover {
  color: #0b5ed7;
}

/* ------------------------------
   TITULARES
------------------------------ */
h1,
h2,
h3,
h4 {
  font-weight: 600;
  color: #1f2937;
}

/* ------------------------------
   BOTONES
------------------------------ */
.btn {
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
}

/* Colores corporativos */
.btn-primary {
  background: #0d6efd;
  border-color: #0d6efd;
}
.btn-primary:hover {
  background: #0b5ed7;
}

.btn-success {
  background: #198754;
  border-color: #198754;
}
.btn-success:hover {
  background: #157347;
}

.btn-info {
  background: #0dcaf0;
  border-color: #0dcaf0;
}
.btn-info:hover {
  background: #31d2f2;
}

.btn-warning {
  background: #ffc107;
  border-color: #ffc107;
  color: #000;
}
.btn-warning:hover {
  background: #ffca2c;
}

.btn-danger {
  background: #dc3545;
  border-color: #dc3545;
}
.btn-danger:hover {
  background: #bb2d3b;
}

/* ------------------------------
   CARDS
------------------------------ */
.card {
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.card-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
}

/* ------------------------------
   TABLAS
------------------------------ */
.table {
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
}

.table thead {
  background: #f1f5f9;
  font-weight: 600;
}

.table tbody tr:hover {
  background: #f8fafc;
}

/* ------------------------------
   FORMULARIOS
------------------------------ */
.form-control,
.form-select {
  border-radius: 6px;
  border: 1px solid #d1d5db;
  padding: 8px 12px;
}

.form-control:focus,
.form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.2);
}

/* ------------------------------
   MODALES
------------------------------ */
.modal-content {
  border-radius: 12px;
  border: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid #e5e7eb;
}

.modal-footer {
  border-top: 1px solid #e5e7eb;
}

/* ------------------------------
   LISTAS
------------------------------ */
.list-group-item {
  border: none;
  border-bottom: 1px solid #e5e7eb;
  padding: 14px 18px;
}

.list-group-item:last-child {
  border-bottom: none;
}

/* ------------------------------
   ALERTAS
------------------------------ */
.alert {
  border-radius: 8px;
  font-size: 0.95rem;
}

/* ------------------------------
   DROPDOWN
------------------------------ */
.dropdown-menu {
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.dropdown-item {
  padding: 10px 14px;
}

.dropdown-item:hover {
  background: #f1f5f9;
}

/* ------------------------------
   ANIMACIONES
------------------------------ */
.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------------
   SEPARADORES
------------------------------ */
hr {
  border-top: 1px solid #e5e7eb;
}

/* ============================================
   HEADER STICKY DEL DASHBOARD
============================================ */
.dashboard-sticky-header {
  /*
    position: sticky;
    top: 0;
    z-index: 50;
    */
  background: #ffffff;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
}

/* ============================================================
   RESPONSIVE THEME FOR MOBILE & TABLETS
   Optimizado para ERP corporativo
============================================================ */

/* ------------------------------
   MOBILE FIRST (max-width: 576px)
------------------------------ */
@media (max-width: 576px) {
  body {
    padding: 0 10px;
  }

  /* Header sticky más compacto */
  .dashboard-sticky-header {
    padding: 12px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .dashboard-sticky-header h1 {
    font-size: 1.2rem;
  }

  .dashboard-sticky-header .btn-group {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  /* Cards apiladas */
  .card {
    margin-bottom: 12px;
  }

  /* KPIs más compactos */
  .card .card-body h3 {
    font-size: 1.4rem;
  }

  /* Tablas convertidas en listas */
  table.table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
  }

  table.table thead {
    display: none;
  }

  table.table tbody tr {
    display: block;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
  }

  table.table tbody tr td {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border: none !important;
  }

  table.table tbody tr td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
  }

  /* Botones full-width */
  .btn,
  .btn-group .btn {
    width: 100%;
    margin-bottom: 8px;
  }

  /* Listas más cómodas */
  .list-group-item {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  /* Formularios */
  .form-control,
  .form-select {
    font-size: 1rem;
    padding: 10px 12px;
  }

  /* Modales */
  .modal-dialog {
    margin: 0;
    width: 100%;
    max-width: none;
  }

  .modal-content {
    border-radius: 0;
    height: 100vh;
  }

  /* Gráficas */
  canvas {
    max-height: 260px !important;
  }
}

/* ------------------------------
   TABLETS (max-width: 768px)
------------------------------ */
@media (max-width: 768px) {
  .dashboard-sticky-header {
    padding: 14px 18px;
  }

  .btn-group .btn {
    flex: 1;
    margin: 0 4px;
  }

  .card .card-body h3 {
    font-size: 1.6rem;
  }

  canvas {
    max-height: 300px;
  }
}

/* ------------------------------
   SMALL LAPTOPS (max-width: 992px)
------------------------------ */
@media (max-width: 992px) {
  .dashboard-sticky-header {
    padding: 16px 20px;
  }

  .btn-group .btn {
    padding: 6px 10px;
  }

  .card {
    margin-bottom: 16px;
  }
}

/* ------------------------------
   LARGE DESKTOPS (min-width: 1400px)
------------------------------ */
@media (min-width: 1400px) {
  .container,
  .dashboard-container {
    max-width: 1400px;
  }

  .card .card-body h3 {
    font-size: 2rem;
  }

  canvas {
    max-height: 360px;
  }
}

a i,
button i {
  margin-right: 10px;
}

.btn-icon i {
  margin-right: 0 !important;
}

/* ============================================
   AUTOCOMPLETE
============================================ */
.autocomplete-list {
  position: absolute;
  background: #f6f6f6;
  border: 1px solid #ccc;
  width: 100%;
  z-index: 9999999;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 8px 10px;
  cursor: pointer;
}

.autocomplete-item:hover {
  background: #f0f0f0;
}
.is-invalid {
  border-color: #dc3545 !important;
}

/* ============================
   FIX TOASTR + BOOTSTRAP 5
   ============================ */

.toast-success {
  background-color: #28a745 !important;
}

.toast-error {
  background-color: #dc3545 !important;
}

.toast-info {
  background-color: #17a2b8 !important;
}

.toast-warning {
  background-color: #ffc107 !important;
  color: #000 !important;
}

.fw-bold {
  font-weight: 600 !important;
}
.fc-h-event {
  color: #fff;
}
.fc-license-message {
  display: none;
}
.fc-event {
  transition: all 0.25s ease-in-out;
}
.fc-event-moving {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  transform: scale(1.03);
  opacity: 0.85;
  transition: all 0.15s ease-out;
}
.fc-event-snap {
  transform: scale(1.02);
  transition: transform 0.12s ease-out;
}
.fc-event-bounce {
  animation: fcBounce 0.25s ease-out;
}
@keyframes fcBounce {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
  }
}
.fc-event-resizing {
  opacity: 0.75;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease-out;
}
.fc-event-ghost {
  opacity: 0.35 !important;
  transform: scale(0.98);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  transition: all 0.15s ease-out;
}
.fc-event-origin {
  opacity: 0.55 !important;
  filter: blur(1px);
  transition: all 0.15s ease-out;
}
.search-item {
  transition: all 0.15s ease-in-out;
  margin-bottom: 6px;
  border-radius: 6px;
}
.search-item:hover {
  background-color: #f8f9fa;
  transform: translateX(4px);
  cursor: pointer;
}
.accordion-button:not(.collapsed) {
  background-color: #e9ecef;
}

.mini-card-accion {
  transition: all 0.2s ease-in-out;
  border-radius: 10px;
  background: #f8f9fa;
}

.mini-card-accion:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.log-error {
  color: #b30000;
  font-weight: bold;
}
.log-warning {
  color: #b36b00;
  font-weight: bold;
}
.log-notice {
  color: #006bb3;
}
.log-fatal {
  color: #8b0000;
  font-weight: bold;
  text-decoration: underline;
}

#frmBuscador {
    flex: 1;
    max-width: 600px;
}

#frmBuscador .form-control {
  height: 42px;
  font-size: 1rem;
}
