/* Reset y configuración base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 50%, #155e75 100%); /* Celeste más claro como WhatsApp */
  color: #333;
  min-height: 100vh;
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background: rgba(8, 145, 178, 0.95); /* Celeste como WhatsApp Dashboard */
  backdrop-filter: blur(10px);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  background: white;
  color: #0891b2; /* Celeste para que coincida con el tema */
  font-weight: bold;
  font-size: 1.5rem;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.logo-subtitle {
  font-size: 0.9rem;
  opacity: 0.8;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.update-time {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

/* Container principal */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header de página */
.page-header {
  text-align: center;
  margin-bottom: 3rem;
  color: white;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.page-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Grid de KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.kpi-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.kpi-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1e3a8a;
}

.kpi-label {
  font-size: 1rem;
  color: #64748b;
  font-weight: 500;
}

/* Colores específicos para KPIs - Basados en WhatsApp Dashboard */
.status-total .kpi-value { 
  color: #0ea5e9; /* Azul como "Total Mensajes" */
}

.status-success .kpi-value { 
  color: #10b981; /* Verde como "Envíos Exitosos" */
}

.status-queue .kpi-value { 
  color: #f97316; /* Naranja como "Envíos Fallidos" */
}

.status-processed .kpi-value { 
  color: #8b5cf6; /* Morado como "Tasa de Éxito" */
}

/* Grid de gráficos */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 2rem;
}

.chart-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease;
}

.chart-card:hover {
  transform: translateY(-2px);
}

.chart-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #1e3a8a;
  margin-bottom: 1.5rem;
  text-align: center;
}

.chart-container {
  position: relative;
  height: 300px;
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-card-wide .chart-container {
  height: 250px;
}

/* Estados de carga y error */
.loading {
  text-align: center;
  color: white;
  font-size: 1.2rem;
  padding: 2rem;
}

.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

/* Footer */
footer {
  background: rgba(8, 145, 178, 0.9); /* Celeste como el navbar */
  color: white;
  text-align: center;
  padding: 1.5rem;
  margin-top: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .logo-section {
    flex-direction: column;
    text-align: center;
  }
  
  .container {
    padding: 1rem;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .charts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .chart-container {
    height: 250px;
  }
  
  .kpi-value {
    font-size: 2rem;
  }
  
  .chart-title {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0.5rem;
  }
  
  .kpi-card {
    padding: 1.5rem;
  }
  
  .chart-card {
    padding: 1.5rem;
  }
  
  .page-title {
    font-size: 1.8rem;
  }
  
  .page-subtitle {
    font-size: 1rem;
  }
}

/* Animaciones adicionales */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.kpi-card, .chart-card {
  animation: fadeIn 0.5s ease-out;
}

/* Mejoras visuales para gráficos */
#mapContainer {
  height: 100%;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.leaflet-container {
  height: 100% !important;
  width: 100% !important;
  border-radius: 8px;
}

canvas {
  border-radius: 8px;
}

/* Estilos para estados hover mejorados */
.kpi-card:hover .kpi-value {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

.chart-card:hover .chart-title {
  color: #3b82f6;
  transition: color 0.2s ease;
}