/* =========================
   RESET Y BASE
========================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

body {
  background-color: #f4f6f8;
  color: #1f2937;
}
.last-update .material-icons {
  font-size: 15px;   /* aquí controlas el tamaño */
  vertical-align: middle;
  opacity: 0.85;
  margin: 0 2px;
}
/* =========================
   HEADER
========================= */
header {
  background-color: #14532d;
  color: white;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left h1 {
  font-size: 22px;
  font-weight: 600;
}

.header-left span {
  font-size: 13px;
  opacity: 0.9;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-center img {
  height: 34px;
}

.header-right {
  text-align: right;
  font-size:13px;
}

.header-right .status {
  font-weight: 600;
  color: #22c55e;
}

.header-right .last-update {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =========================
   CONTENEDOR GENERAL
========================= */
.container {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 16px;
}

/* =========================
   TARJETAS DE FASES
========================= */
.cards {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  background: white;
  border-radius: 14px;
  padding: 20px;
  width: 320px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.card h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 6px;
}

/* Texto dentro de tarjetas */
.card p {
  font-size: 14px;
  margin: 6px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Íconos dentro de tarjetas */
.card .material-icons {
  font-size: 15px;
  color: #166534;
  opacity: 0.7;
}

/* =========================
   REGISTROS HISTÓRICOS
========================= */
.history-card {
  background: white;
  border-radius: 14px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  padding: 18px;
}

/* Header de registros */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.history-header h2 {
  font-size: 16px;
  font-weight: 600;
}

/* Botón descarga */
.download-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1.5px solid #166534;
  background: white;
  color: #166534;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.download-btn .material-icons {
  font-size: 20px;
}

.download-btn:hover {
  background: #166534;
  color: white;
}

/* =========================
   TABLA
========================= */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead {
  background-color: #f9fafb;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
}

th {
  font-weight: 600;
  color: #374151;
}

td {
  color: #1f2937;
}

tbody tr:hover {
  background-color: #f3f4f6;
}

/* Íconos en encabezados */
th .material-icons {
  font-size: 14px;
  vertical-align: middle;
  margin-right: 4px;
  color: #166534;
  opacity: 0.8;
}

/* =========================
   CARDS (SIEMPRE VISIBLES)
========================= */
.cards-section {
  margin-bottom: 32px;
}

/* =========================
   NAVEGACIÓN POR TABS
========================= */
.tabs-navigation {
  display: flex;
  justify-content: center;
  gap: 0;
  background: white;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 0;
  overflow: hidden;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: white;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.3s ease;
  position: relative;
}

.tab-btn:hover {
  background: #f9fafb;
  color: #166534;
}

.tab-btn.active {
  color: #166534;
  border-bottom-color: #166534;
  background: #f0fdf4;
}

.tab-btn .material-icons {
  font-size: 20px;
}

.tab-label {
  font-weight: 600;
}

/* =========================
   CONTENIDO DE TABS
========================= */
.tabs-content {
  background: white;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 32px;
  min-height: 400px;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.4s ease-in-out;
}

.tab-panel.active {
  display: block;
}

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

/* =========================
   SECCIONES DEL DASHBOARD
========================= */
.dashboard-section {
  margin-bottom: 0;
}

.section-alt {
  background-color: #f9fafb;
  padding: 32px 24px;
  margin-left: -24px;
  margin-right: -24px;
  border-radius: 12px;
}

.section-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header h2 .material-icons {
  font-size: 24px;
  color: #166534;
}

.section-subtitle {
  font-size: 13px;
  color: #6b7280;
  font-weight: 400;
}

/* =========================
   CONTENEDORES DE GRÁFICAS
========================= */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 24px;
}

.chart-container {
  background: white;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chart-full {
  grid-column: 1 / -1;
  margin-bottom: 24px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f3f4f6;
}

.chart-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-header h3 .material-icons {
  font-size: 20px;
  color: #166534;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-info {
  font-size: 12px;
  color: #9ca3af;
}

/* Placeholder para gráficas */
.chart-placeholder {
  height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  color: #9ca3af;
}

.chart-placeholder .material-icons {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.chart-placeholder p {
  font-size: 14px;
  font-weight: 500;
}

/* Canvas para gráficas reales */
.chart-wrapper {
  position: relative;
  height: 320px;
  width: 100%;
}

.chart-wrapper canvas {
  max-height: 320px;
}

/* =========================
   KPI CARDS (TAB PANEL)
========================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.kpi-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease;
}

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

.kpi-icon {
  font-size: 40px;
  color: #166534;
  opacity: 0.8;
}

.kpi-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

/* =========================
   SECTION DIVIDER
========================= */
.section-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, #e5e7eb, transparent);
  margin: 32px 0;
}

.section-subheader {
  margin-bottom: 20px;
}

.section-subheader h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subheader h3 .material-icons {
  font-size: 22px;
  color: #166534;
}

/* =========================
   CONTENEDORES DE GRÁFICAS (continuación)
========================= */

/* =========================
   CONTENEDOR DE GAUGES
========================= */
.gauges-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.gauge-wrapper {
  background: white;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Placeholder para gauges */
.gauge-placeholder {
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  color: #9ca3af;
}

.gauge-placeholder .material-icons {
  font-size: 64px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.gauge-placeholder p {
  font-size: 14px;
  font-weight: 600;
}

/* Canvas para gauges reales */
.gauge-title {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
  margin-bottom: 12px;
}

.gauge-canvas-wrapper {
  position: relative;
  height: 180px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-canvas-wrapper canvas {
  max-width: 200px;
  max-height: 180px;
}

.gauge-value {
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  color: #1f2937;
  margin-top: 12px;
}

/* ================= FOOTER ================= */
.footer {
  width: 100%;
  box-sizing: border-box;
  margin-top: 60px;
  padding: 22px 20px;

  background-color: #f4f6f8; /* mismo verde del header */
  color: #2c2e2d;

  font-size: 14px;
  font-weight: 400;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;

  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;

  gap: 8px;
  line-height: 1.6;
  text-align: center;
}

.footer-separator {
  opacity: 0.6;
}


/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
  .cards {
    flex-direction: column;
    align-items: center;
  }

  .card {
    width: 100%;
    max-width: 400px;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .gauges-container {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-alt {
    margin-left: -16px;
    margin-right: -16px;
    padding: 24px 16px;
  }

  .tabs-content {
    padding: 24px 16px;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .header-right {
    text-align: center;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .chart-placeholder,
  .gauge-placeholder {
    height: 250px;
  }

  /* Tabs en móvil - solo íconos */
  .tab-btn {
    flex-direction: column;
    padding: 12px 8px;
    gap: 4px;
  }

  .tab-label {
    font-size: 11px;
  }

  .tab-btn .material-icons {
    font-size: 22px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .tabs-content {
    padding: 20px 12px;
  }
}

@media (max-width: 480px) {
  .tab-label {
    display: none;
  }

  .tab-btn {
    padding: 14px 8px;
  }

  .tabs-content {
    padding: 16px 8px;
  }
}
