/* === TIPOGRAFÍAS INSTITUCIONALES INDIVISA === */
@font-face {
    font-family: 'Indivisa Text Sans';
    src: url('Fonts/woff2/indivisa_text_sans-regular.woff2') format('woff2'),
         url('Fonts/woff/indivisa_text_sans-regular.woff') format('woff'),
         url('Fonts/ttf/Indivisa Text Sans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Indivisa Text Sans';
    src: url('Fonts/woff2/indivisa_text_sans-bold.woff2') format('woff2'),
         url('Fonts/woff/indivisa_text_sans-bold.woff') format('woff'),
         url('Fonts/ttf/Indivisa Text Sans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Indivisa Text Sans';
    src: url('Fonts/woff2/indivisa_text_sans-light.woff2') format('woff2'),
         url('Fonts/woff/indivisa_text_sans-light.woff') format('woff'),
         url('Fonts/ttf/Indivisa Text Sans-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Indivisa Display Sans';
    src: url('Fonts/woff2/indivisa_display_sans-regular.woff2') format('woff2'),
         url('Fonts/woff/indivisa_display_sans-regular.woff') format('woff'),
         url('Fonts/ttf/Indivisa Display Sans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Indivisa Display Sans';
    src: url('Fonts/woff2/indivisa_display_sans-heavy.woff2') format('woff2'),
         url('Fonts/woff/indivisa_display_sans-heavy.woff') format('woff'),
         url('Fonts/ttf/Indivisa Display Sans-Heavy.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* === ESTILOS GENERALES === */
body {
  margin: 0;
  font-family: 'Indivisa Text Sans', 'Segoe UI', 'Roboto', Arial, sans-serif;
  background-image: url('Imagenes/Fondo.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: #222;
  min-height: 100vh;
}

/* === ESTILOS DEL HEADER ORIGINAL === */
header {
  background: rgba(0, 0, 0, 0.4); /* Fondo oscuro semi-transparente */
  backdrop-filter: blur(5px); /* Efecto de desenfoque */
  -webkit-backdrop-filter: blur(5px); /* Safari y Samsung Internet */
  min-height: 150px;
  color: white;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  padding: 1rem 3rem; /* Aumentar padding lateral */
  -ms-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  z-index: 100;
}

nav {
  -webkit-box-flex: 0;
  -ms-flex: 0 0 auto;
  flex: 0 0 auto;
  background-color: none;
  font-size: 20px;
  position: relative;
  z-index: 101;
  margin-right: 1rem; /* Dar espacio del borde derecho */
}

.menu-horizontal {
  list-style: none;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  position: relative;
  padding: 0;
  margin: 0;
}

.menu-horizontal > li {
  position: relative;
}

.menu-horizontal > li > a {
  display: block;
  padding: 10px 15px;
  color: white;
  text-decoration: none;
  font-size: 20px;
  font-weight: bold;
  -webkit-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

.menu-horizontal > li:hover {
  background-color: green;
}

/* Soporte para touch en dispositivos móviles */
.menu-horizontal > li:active {
  background-color: green;
}

.menu-vertical {
  position: absolute;
  top: 100%;
  right: 0; /* Alinear a la derecha en lugar de izquierda */
  display: none;
  list-style: none;
  min-width: 220px;
  width: -webkit-max-content;
  width: -moz-max-content;
  width: max-content;
  max-width: 280px;
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  border-radius: 0 0 8px 8px;
  padding: 0;
  margin: 0;
  z-index: 1000;
  overflow: visible;
  /* Asegurar que no se salga de la pantalla */
  -webkit-transform: translateX(0);
  -ms-transform: translateX(0);
  transform: translateX(0);
}

.menu-horizontal li:hover .menu-vertical {
  display: block;
}

/* Para dispositivos táctiles (Samsung Internet) */
.menu-horizontal li:focus-within .menu-vertical {
  display: block;
}

.menu-vertical li {
  margin: 0;
}

.menu-vertical li:hover {
  background-color: green;
}

.menu-vertical li:active {
  background-color: green;
}

.menu-vertical li a {
  display: block;
  color: white;
  padding: 12px 20px;
  text-decoration: none;
  -webkit-transition: all 0.3s ease;
  -o-transition: all 0.3s ease;
  transition: all 0.3s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent; /* Quitar highlight en Samsung */
}

.menu-vertical li a:hover {
  padding-left: 25px;
}

.menu-vertical li a:active {
  padding-left: 25px;
  background-color: rgba(0, 128, 0, 0.2);
}

header h1 {
  font-size: 2.5rem;
  text-align: center;
  margin: 0;
  -webkit-box-flex: 1;
  -ms-flex: 1 1 auto;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  -o-text-overflow: ellipsis;
  text-overflow: ellipsis;
  padding: 0 1rem;
  -webkit-font-smoothing: antialiased; /* Mejor renderizado en móviles */
}

.logo {
  height: 100px;
  margin: 0;
  -ms-flex-negative: 0;
  flex-shrink: 0;
  -webkit-box-ordinal-group: 0;
  -ms-flex-order: -1;
  order: -1; /* Asegurar que el logo sea primero */
}

.logo img {
  height: 100%;
  max-width: 100%;
  -o-object-fit: contain;
  object-fit: contain;
}

/* === ESTILOS DEL CONTENEDOR === */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 80vh;
}

.dashboard-header {
  text-align: center;
  padding: 2rem 1rem 1rem 1rem;
  background: rgba(255, 255, 255, 0.1); /* Fondo muy sutil */
  backdrop-filter: blur(10px); /* Efecto de desenfoque */
  border-radius: 20px 20px 0 0;
  margin: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dashboard-header h1 {
  margin: 0;
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.dashboard-time {
  margin: 0.5rem 0 0 0;
  font-size: 1.2rem;
  color: #666;
  font-weight: 400;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: rgba(255, 255, 255, 0.05); /* Fondo muy sutil */
  border-radius: 0 0 20px 20px;
  margin: 0 1rem 1rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: none;
}

.card {
  background: rgba(255, 255, 255, 0.95); /* Fondo blanco semi-transparente */
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15); /* Sombra más pronunciada */
  backdrop-filter: blur(10px); /* Efecto de desenfoque para modernidad */
  border: 1px solid rgba(255, 255, 255, 0.2); /* Borde sutil */
  padding: 1.5rem 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1.2rem;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-family: 'Indivisa Display Sans', 'Indivisa Text Sans', sans-serif;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.7rem;
}

.metric-label {
  font-size: 1rem;
  color: #555;
}

.metric-value {
  font-size: 1.7rem;
  font-weight: 600;
  color: #222;
}

.metric-unit {
  font-size: 1rem;
  color: #888;
  margin-left: 2px;
}

.card-large {
  /* Ocupa una columna */
}

.card-wide {
  grid-column: span 2;
}

.card-small {
  /* Ocupa una columna */
}

.chart-placeholder {
  width: 100%;
  height: 150px;
  background: #e9ecef;
  border-radius: 8px;
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 1.1rem;
}

/* Estilos para canvas de gráficos */
canvas {
  width: 100% !important;
  height: auto !important;
  max-height: 150px !important;
  min-height: 100px !important;
  margin-top: 1.2rem;
  border-radius: 8px;
  aspect-ratio: 2.5 / 1; /* Proporción 2.5:1 para que no se vean alargadas */
}

.aqi-status {
  margin-bottom: 0.7rem;
}

.aqi-good {
  font-size: 2.2rem;
  color: #28a745;
  font-weight: 700;
}

.aqi-value {
  font-size: 1.2rem;
  color: #28a745;
  font-weight: 500;
}

.pm-main {
  font-size: 1.7rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.pm-label {
  color: #555;
}

.pm-value {
  color: #222;
}

.pm-unit {
  font-size: 1rem;
  color: #888;
  margin-left: 2px;
}

.pm-secondary {
  font-size: 1rem;
  color: #666;
  margin-bottom: 1rem;
}

.gas-main {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.gas-label {
  color: #555;
}

.gas-value {
  color: #222;
}

.gas-unit {
  font-size: 1rem;
  color: #888;
  margin-left: 2px;
}

/* === ESTILOS DEL FOOTER === */
footer {
  background-color: rgb(44, 49, 44);
  padding: 2rem;
  color: white;
  margin-top: 2rem;
}

footer section {
  margin-left: 0px;
}

footer a {
  transition: color 0.3s ease;
  color: white;
  text-decoration: none;
  font-size: 15px;
}

/* === TIPOGRAFÍA ESPECÍFICA INSTITUCIONAL === */
.dashboard-header h1,
h1 {
  font-family: 'Indivisa Display Sans', 'Indivisa Text Sans', sans-serif !important;
  font-weight: 900;
  font-size: 2.5rem;
  color: #1a1a1a;
  letter-spacing: -0.5px;
}

.dashboard-time,
.subtitle {
  font-family: 'Indivisa Text Sans', sans-serif !important;
  font-weight: 300;
  color: #666;
}

.metric-value {
  font-family: 'Indivisa Text Sans', sans-serif !important;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric-label {
  font-family: 'Indivisa Text Sans', sans-serif !important;
  font-weight: 400;
}

nav a {
  font-family: 'Indivisa Text Sans', sans-serif !important;
  font-weight: 700 !important;
}

h2, h3 {
  font-family: 'Indivisa Display Sans', 'Indivisa Text Sans', sans-serif !important;
  font-weight: 700;
}

p, span, td, th {
  font-family: 'Indivisa Text Sans', sans-serif !important;
}

/* === ESTILOS PARA PÁGINAS DE SENSORES === */
.sensor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.sensor-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sensor-card h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: #1a1a1a;
  font-family: 'Indivisa Display Sans', sans-serif !important;
}

/* Información del Sensor */
.sensor-info .info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f0f0f0;
}

.sensor-info .info-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.info-label {
  font-size: 0.9rem;
  color: #666;
  font-weight: 400;
}

.info-value {
  font-size: 0.95rem;
  color: #222;
  font-weight: 600;
}

/* Lectura Actual */
.sensor-reading {
  text-align: center;
}

.current-reading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.main-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Indivisa Display Sans', sans-serif !important;
}

.main-value.green {
  color: #10b981;
}

.main-value.orange {
  color: #f59e0b;
}

.main-value.red {
  color: #ef4444;
}

.main-value.blue {
  color: #3b82f6;
}

.last-reading {
  font-size: 0.9rem;
  color: #666;
  font-weight: 400;
}

/* Principio de Funcionamiento */
.sensor-principle {
  grid-column: span 2;
}

.principle-text {
  font-size: 1rem;
  line-height: 1.6;
  color: #444;
  margin-bottom: 2rem;
}

.resistance-levels {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.resistance-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.resistance-label {
  font-size: 0.95rem;
  color: #555;
  font-weight: 500;
}

.resistance-value {
  font-size: 1rem;
  font-weight: 700;
}

.resistance-value.green {
  color: #10b981;
}

.resistance-value.orange {
  color: #f59e0b;
}

.resistance-value.blue {
  color: #3b82f6;
}

.resistance-value.red {
  color: #ef4444;
}

/* === ESTILOS PARA TABLA DE GASES MQ135 === */
.gas-readings-table {
  margin: 1rem 0;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.sensor-data-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.9rem;
}

.sensor-data-table th {
  background: #f8fafc;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

.sensor-data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.sensor-data-table tr:hover {
  background: #f9fafb;
}

.gas-value {
  font-weight: 600;
  font-size: 1rem;
  color: #1f2937;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.good {
  background: #dcfce7;
  color: #166534;
}

.status-badge.moderate {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.dangerous {
  background: #fecaca;
  color: #991b1b;
}

.status-badge.loading {
  background: #e0f2fe;
  color: #0369a1;
}

/* Responsive para tabla de gases */
@media (max-width: 768px) {
  .sensor-data-table {
    font-size: 0.8rem;
  }
  
  .sensor-data-table th,
  .sensor-data-table td {
    padding: 0.5rem;
  }
  
  .gas-value {
    font-size: 0.9rem;
  }
}

/* === ESTILOS PARA GRID DE REFERENCIAS DE GASES === */
.gas-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.gas-reference-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.2s ease;
}

.gas-reference-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.gas-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 0.75rem 0;
  font-family: 'Indivisa Text Sans', sans-serif !important;
}

.reference-levels {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reference-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
}

.reference-label {
  font-size: 0.85rem;
  color: #6b7280;
  font-weight: 500;
}

.reference-value {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.reference-value.green {
  color: #059669;
  background: #d1fae5;
}

.reference-value.orange {
  color: #d97706;
  background: #fef3c7;
}

.reference-value.red {
  color: #dc2626;
  background: #fecaca;
}

/* Responsive para grid de referencias */
@media (max-width: 768px) {
  .gas-reference-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  
  .gas-reference-card {
    padding: 0.75rem;
  }
  
  .gas-name {
    font-size: 0.9rem;
  }
  
  .reference-item {
    padding: 0.3rem 0.5rem;
  }
  
  .reference-label,
  .reference-value {
    font-size: 0.8rem;
  }
}

/* Estilos para gráficas de sensores */
.chart-container {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(5px);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chart-container canvas {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

/* Animación de entrada para gráficas */
@keyframes chartFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chart-container {
  animation: chartFadeIn 0.8s ease-out;
}

/* Loading state para gráficas */
.chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 280px;
  color: #6b7280;
  font-style: italic;
}

.chart-loading::before {
  content: "📊 ";
  font-size: 1.5rem;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Responsive para sensores */
@media (max-width: 768px) {
  .sensor-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .sensor-principle {
    grid-column: span 1;
  }
  
  .main-value {
    font-size: 1.5rem;
  }
  
  .sensor-card {
    padding: 1.5rem;
  }
  
  /* Gráficas responsive */
  .chart-container {
    height: 220px;
    margin-top: 1.5rem;
    padding: 0.75rem;
  }
  
  .chart-container canvas {
    max-height: 200px;
  }
}

footer a:hover {
  color: rgb(108, 121, 117);
}

/* === RESPONSIVO PARA MÓVILES === */
@media (max-width: 700px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 1rem 0.5rem;
  }
  .card-wide {
    grid-column: span 1;
  }
  
  header {
    min-height: auto;
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
    text-align: center;
    z-index: 100;
    position: relative;
  }
  
  header h1 {
    font-size: 1.5rem;
    white-space: normal;
    padding: 0;
    order: 2; /* Título después del logo */
  }
  
  .logo {
    height: 60px;
    order: 1; /* Logo primero */
  }
  
  nav {
    width: 100%;
    font-size: 16px;
    order: 3; /* Menú al final */
    z-index: 101;
  }
  
  .menu-horizontal {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
  }
  
  .menu-horizontal > li {
    width: 100%;
    text-align: center;
    position: relative;
  }
  
  .menu-horizontal > li > a {
    font-size: 1rem;
    padding: 0.75rem 1rem;
    display: block;
    width: 100%;
  }
  
  .menu-vertical {
    position: relative;
    top: 0;
    left: 0;
    width: 100%;
    min-width: 100%;
    border-radius: 0 0 8px 8px;
    margin-top: 0;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
    background-color: rgba(0, 0, 0, 0.85);
  }
  
  .menu-vertical li a {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }
  
  .container {
    padding: 0.5rem;
    margin-top: 1rem;
  }
  
  /* Asegurar que las tarjetas estén por debajo del menú */
  .dashboard-header {
    margin-top: 1rem;
  }
}

/* === RESPONSIVO PARA TABLETS === */
@media (min-width: 701px) and (max-width: 1024px) {
  header {
    min-height: 120px;
    padding: 1rem 1.5rem;
    gap: 0.75rem;
    z-index: 100;
  }
  
  header h1 {
    font-size: 1.8rem;
    flex: 1 1 auto;
    padding: 0 0.5rem;
  }
  
  .logo {
    height: 70px;
  }
  
  nav {
    font-size: 18px;
    z-index: 101;
  }
  
  .menu-horizontal > li > a {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }
  
  .menu-vertical {
    min-width: 180px;
    width: max-content;
  }
  
  .menu-vertical li a {
    padding: 10px 15px;
    font-size: 0.85rem;
  }
}

/* === RESPONSIVO PARA PANTALLAS MEDIANAS === */
@media (min-width: 1025px) and (max-width: 1400px) {
  header {
    padding: 1rem 2rem;
  }
  
  header h1 {
    font-size: 2rem;
  }
  
  .logo {
    height: 80px;
  }
  
  nav {
    font-size: 18px;
    margin-right: 0.5rem;
  }
  
  .menu-vertical {
    min-width: 200px;
  }
}

/* === ESTILOS ESPECÍFICOS PARA EL DASHBOARD PRINCIPAL === */
.card-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 200px;
  position: relative;
}

/* Asegurar que las tarjetas grandes tengan altura suficiente */
.card-large .card-content {
  min-height: 250px;
}

.card-wide .card-content {
  min-height: 200px;
}

.card-small .card-content {
  min-height: 150px;
}

.aqi-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.aqi-category {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.aqi-value {
  font-size: 1.25rem;
  font-weight: 600;
  opacity: 0.8;
}

.pm-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pm-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.pm-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
}

.pm-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
}

.pm-unit {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.7;
}

.pm-secondary {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: #6b7280;
}

.separator {
  color: #d1d5db;
}

.gas-display {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gas-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.gas-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
}

.gas-value {
  font-size: 2rem;
  font-weight: 700;
  color: #dc2626;
}

.gas-unit {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.7;
}

.gas-secondary {
  font-size: 0.875rem;
  color: #6b7280;
  font-style: italic;
}

.chart-mini {
  flex: 1;
  width: 100%;
  margin-top: auto;
  padding: 1rem 0.5rem;
  position: relative;
  overflow: hidden;
  height: 140px; /* Altura fija adecuada para buena visualización */
}

.chart-mini canvas {
  max-width: 100% !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 120px !important;
}

.precipitation-status {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

/* Footer mejorado */
footer section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.875rem;
}

.footer-divider {
  color: #d1d5db;
}

.footer-info {
  color: #6b7280;
  font-style: italic;
}

#data-source {
  background: rgba(255, 111, 0, 0.1);
  color: #ff6f00;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
}

/* === FIXES ESPECÍFICOS PARA GRÁFICAS DEL DASHBOARD === */

/* Contenedores de canvas específicos */
#tempChart, #pm25Chart, #co2Chart, #aqiChart {
  max-width: 100% !important;
  max-height: 80px !important;
  width: 100% !important;
  height: 80px !important;
}

/* Prevenir overflow en las tarjetas */
.card {
  overflow: hidden;
  position: relative;
}

/* Asegurar que el contenido no se salga */
.card-content {
  overflow: hidden;
  box-sizing: border-box;
}

/* Espaciado específico para diferentes tipos de tarjetas */
.card-large .chart-mini {
  height: 90px;
  padding-top: 0.75rem;
}

.card-wide .chart-mini {
  height: 80px;
  padding-top: 0.5rem;
}

/* Responsive para gráficas en móviles */
@media (max-width: 768px) {
  .chart-mini {
    height: 100px;
    padding: 0.5rem 0.25rem;
  }
  
  .chart-mini canvas {
    max-width: 100% !important;
    height: 100% !important;
    max-height: 80px !important;
  }
  
  .card-content {
    min-height: 180px;
  }
  
  .card-large .card-content {
    min-height: 200px;
  }
}

/* === SENSOR DE VIENTO - ESTILOS ESPECÍFICOS === */

.wind-details {
  margin-top: 1rem;
}

.wind-description {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  padding: 0.75rem;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 8px;
  margin-bottom: 1rem;
  color: #1e40af;
  border-left: 4px solid #3b82f6;
}

.wind-components {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.wind-component {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 6px;
}

.component-label {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.25rem;
}

.component-value {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

/* Rosa de los vientos */
.wind-compass {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.compass-container {
  position: relative;
  width: 120px;
  height: 120px;
  border: 2px solid #e5e7eb;
  border-radius: 50%;
  background: linear-gradient(45deg, #f8fafc 25%, transparent 25%), 
              linear-gradient(-45deg, #f8fafc 25%, transparent 25%), 
              linear-gradient(45deg, transparent 75%, #f8fafc 75%), 
              linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.compass-rose {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.compass-direction {
  position: absolute;
  font-size: 0.75rem;
  font-weight: 600;
  color: #374151;
  transform: translate(-50%, -50%);
}

.compass-direction.north {
  top: 8px;
  left: 50%;
}

.compass-direction.south {
  bottom: 8px;
  left: 50%;
  transform: translate(-50%, 50%);
}

.compass-direction.east {
  right: 8px;
  top: 50%;
  transform: translate(50%, -50%);
}

.compass-direction.west {
  left: 8px;
  top: 50%;
  transform: translate(-50%, -50%);
}

.compass-direction.northeast {
  top: 15px;
  right: 15px;
  transform: translate(50%, -50%);
}

.compass-direction.northwest {
  top: 15px;
  left: 15px;
  transform: translate(-50%, -50%);
}

.compass-direction.southeast {
  bottom: 15px;
  right: 15px;
  transform: translate(50%, 50%);
}

.compass-direction.southwest {
  bottom: 15px;
  left: 15px;
  transform: translate(-50%, 50%);
}

.wind-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 2px;
  background: #ef4444;
  transform-origin: left center;
  transform: translate(0, -50%) rotate(0deg);
  transition: transform 0.5s ease;
  z-index: 10;
}

.arrow-pointer {
  position: absolute;
  right: -8px;
  top: -8px;
  font-size: 16px;
  color: #ef4444;
  transform: rotate(0deg);
  transition: transform 0.5s ease;
}

/* Punto central de la brújula */
.compass-container::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
}

/* Responsive para móviles */
@media (max-width: 768px) {
  .wind-components {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .wind-component {
    flex-direction: row;
    justify-content: space-between;
  }
  
  .compass-container {
    width: 100px;
    height: 100px;
  }
  
  .wind-arrow {
    width: 50px;
  }
}