/* ==========================================
   PTO-Aire - Custom Styles
   ========================================== */

/* Variables CSS para colores AQI */
:root {
  --color-good: #10b981;
  --color-moderate: #fbbf24;
  --color-unhealthy-sg: #f97316;
  --color-unhealthy: #ef4444;
  --color-very-unhealthy: #a855f7;
  --color-hazardous: #7c2d12;
}

/* ==========================================
   Animaciones
   ========================================== */

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

.fade-in-scale {
  animation: fadeInScale 0.3s ease-out;
}

/* ==========================================
   Loading States
   ========================================== */

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.pulse-loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ==========================================
   Badges de Calidad del Aire
   ========================================== */

.badge-good {
  background-color: #d1fae5;
  color: #065f46;
}

.badge-moderate {
  background-color: #fef3c7;
  color: #92400e;
}

.badge-unhealthy-sg {
  background-color: #fed7aa;
  color: #7c2d12;
}

.badge-unhealthy {
  background-color: #fee2e2;
  color: #991b1b;
}

.badge-very-unhealthy {
  background-color: #f3e8ff;
  color: #6b21a8;
}

.badge-hazardous {
  background-color: #fecaca;
  color: #450a0a;
}

/* ==========================================
   Touch Targets Mobile
   ========================================== */

button,
a {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

/* Optimización táctil */
* {
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* ==========================================
   Chart Container
   ========================================== */

.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
}

@media (min-width: 768px) {
  .chart-container {
    height: 300px;
  }
}

/* ==========================================
   Widget de Contaminante
   ========================================== */

.pollutant-widget {
  background: white;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.pollutant-widget:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

/* Barra de progreso del contaminante */
.pollutant-bar {
  height: 4px;
  background-color: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.pollutant-bar-fill {
  height: 100%;
  transition: all 0.5s ease;
  border-radius: 9999px;
}

/* ==========================================
   AQI Circle
   ========================================== */

#aqiCircle {
  transition:
    stroke 0.5s ease,
    stroke-dashoffset 1s ease;
}

/* ==========================================
   Responsive Typography
   ========================================== */

@media (max-width: 640px) {
  #aqiValue {
    font-size: 2.5rem;
  }

  h1 {
    font-size: 1.125rem;
  }

  h2 {
    font-size: 1rem;
  }
}

/* ==========================================
   Utilidades
   ========================================== */

.text-shadow {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur-sm {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
  body {
    background: white;
  }

  header,
  footer {
    display: none;
  }

  .shadow-lg,
  .shadow-md {
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }
}

/* ==========================================
   Accesibilidad
   ========================================== */

/* Focus visible para navegación por teclado */
*:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Movimiento reducido para usuarios sensibles */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================
   Dark Mode (preparado para futuro)
   ========================================== */

@media (prefers-color-scheme: dark) {
  /* Comentado para mantener diseño actual */
  /* body {
    background: linear-gradient(to bottom right, #1e293b, #334155);
    color: #f1f5f9;
  } */
}

/* ==========================================
   Tooltip System
   ========================================== */

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  background-color: #3b82f6;
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  transition: all 0.2s ease;
  position: relative;
}

.info-icon:hover {
  background-color: #2563eb;
  transform: scale(1.1);
}

.tooltip-container {
  position: relative;
  display: inline-block;
}

.tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1f2937;
  color: white;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  width: 280px;
  max-width: 90vw;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  pointer-events: none;
}

.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1f2937 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Responsive tooltips en móvil */
@media (max-width: 640px) {
  .tooltip-text {
    width: 240px;
    font-size: 12px;
    padding: 10px;
  }
}

/* ==========================================
   Time Range Selector
   ========================================== */

.time-range-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.time-range-btn {
  padding: 8px 16px;
  background-color: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.time-range-btn:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

.time-range-btn.active {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: white;
}
