:root {
  --bg-light: #f8f9fa;
  --text-dark: #212529;
}

/* Estructura fija */
body {
  padding-top: 56px;
  padding-bottom: 20px;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.navbar {
  padding: 0.5rem 0;
  transition: background-color 0.3s ease;
}

/* Estilos para la tabla de balance detallado */
#tablaBalance {
  font-size: 0.85rem;
  width: 100%;
  min-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  border-style: hidden;
}

#tablaBalance th, 
#tablaBalance td {
  border: 1px solid #dee2e6;
  padding: 0.5rem;
  white-space: nowrap;
  text-align: center;
}

#tablaBalance .text-end {
  text-align: end !important;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* Ajustes de ancho para columnas específicas */
#tablaBalance th:nth-child(1),
#tablaBalance td:nth-child(1) {
  min-width: 100px;
}

#tablaBalance th:nth-child(n+2):nth-child(-n+10),
#tablaBalance td:nth-child(n+2):nth-child(-n+10) {
  min-width: 80px;
}

#tablaBalance th:nth-last-child(3),
#tablaBalance td:nth-last-child(3),
#tablaBalance th:nth-last-child(2),
#tablaBalance td:nth-last-child(2),
#tablaBalance th:last-child,
#tablaBalance td:last-child {
  min-width: 90px;
}

/* Estilos para gráficas reducidas */
.card-body.p-2 {
  padding: 0.5rem !important;
}

canvas {
  max-height: 180px;
  width: 100% !important;
}

/* Estilos generales */
.card {
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: scale(1.01);
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.card-categoria {
  margin-bottom: 1rem;
}

.toggle-switch {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Modo oscuro */
.dark-mode {
  background-color: #1a1a1a;
  color: #ffffff;
}

.dark-mode .navbar,
.dark-mode .card {
  background-color: #2d2d2d !important;
  color: #ffffff;
  border-color: #444;
}

.dark-mode .card-header {
  background-color: #3d3d3d !important;
  color: #ffffff;
  border-bottom-color: #444;
}

.dark-mode .table {
  color: #ffffff;
}

.dark-mode .table th {
  background-color: #3d3d3d;
  color: #ffffff;
}

.dark-mode .table-hover tbody tr:hover {
  color: #ffffff;
  background-color: #444;
}

.dark-mode .text-muted {
  color: #b3b3b3 !important;
}

.dark-mode .form-control,
.dark-mode .form-select {
  background-color: #333;
  color: #fff;
  border-color: #555;
}

.dark-mode .btn-outline-secondary {
  color: #fff;
  border-color: #666;
}

.dark-mode .btn-outline-secondary:hover {
  background-color: #444;
}

.dark-mode .card-body {
  background-color: #2d2d2d;
}

.dark-mode #tablaBalance th,
.dark-mode #tablaBalance td {
  border-color: #444 !important;
}

/* Responsive */
@media (max-width: 768px) {
  #tablaBalance {
    font-size: 0.75rem;
  }
  
  #tablaBalance th, 
  #tablaBalance td {
    padding: 0.3rem;
  }
  
  #btnRepetirUltimoGasto span {
    display: none;
  }
}

@media (max-width: 576px) {
  .navbar .d-flex {
    gap: 0.3rem;
  }
}