/* --- Charts --- */
.chart-container {
  position: relative;
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  overflow: visible;
  min-height: 380px;
}
.chart-container canvas {
  min-height: 340px;
}
/* Cards que contienen gráficos necesitan overflow visible para leyendas */
.card-modern.h-100 {
  display: flex;
  flex-direction: column;
}
.card-modern.h-100 .chart-container {
  flex: 1;
  overflow: visible;
}

/* Filter bar for analytics */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4) var(--space-6);
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}
.filter-bar label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}
.filter-bar select,
.filter-bar input {
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--input-text);
  background: var(--input-bg);
}
.filter-bar select:focus,
.filter-bar input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--input-focus-ring);
}

/* --- Alerts / Flash --- */
.alert-modern {
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-size-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.alert-modern.alert-success {
  background: var(--alert-success-bg);
  color: var(--alert-success-text);
  border-left: 4px solid var(--alert-success-border);
}
.alert-modern.alert-danger {
  background: var(--alert-danger-bg);
  color: var(--alert-danger-text);
  border-left: 4px solid var(--alert-danger-border);
}
.alert-modern.alert-warning {
  background: var(--alert-warning-bg);
  color: var(--alert-warning-text);
  border-left: 4px solid var(--alert-warning-border);
}
.alert-modern.alert-info {
  background: var(--alert-info-bg);
  color: var(--alert-info-text);
  border-left: 4px solid var(--alert-info-border);
}

/* --- Footer --- */
.footer-huerto {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--footer-border);
  background: var(--footer-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--footer-text);
  font-size: var(--font-size-sm);
  margin-top: auto;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--text-tertiary);
}
.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}
.empty-state h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}
.empty-state p {
  max-width: 400px;
  margin: 0 auto var(--space-6);
  line-height: 1.7;
}

/* --- Color Picker --- */
.color-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.color-swatch:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-md);
}
.color-swatch.active {
  border-color: var(--text-primary);
  box-shadow:
    0 0 0 2px var(--surface-base),
    0 0 0 4px var(--border-strong);
}

/* --- Progress Bar --- */
.progress-modern {
  height: 8px;
  background: var(--color-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-modern .progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(
    90deg,
    var(--color-primary),
    var(--color-primary-dark)
  );
  transition: width var(--transition-slow);
}

/* --- Loading --- */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-gray-200);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--loading-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  backdrop-filter: blur(4px);
}
/* --- Animations --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.animate-in {
  animation: none;
  opacity: 1;
  transform: none;
}
.delay-1 {
  animation-delay: 0.05s;
}
.delay-2 {
  animation-delay: 0.1s;
}
.delay-3 {
  animation-delay: 0.15s;
}
.delay-4 {
  animation-delay: 0.2s;
}
.delay-5 {
  animation-delay: 0.25s;
}
