/* Card de temperatura - Classes dinâmicas baseadas na temperatura */
.temperature-card {
  color: white;
  border-radius: 15px;
  transition: all 0.5s ease;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Faixas de temperatura com cores intuitivas */
.temp-freezing {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  box-shadow: 0 8px 25px rgba(30, 60, 114, 0.3);
}

.temp-cold {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.temp-cool {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  box-shadow: 0 8px 25px rgba(17, 153, 142, 0.3);
}

.temp-comfortable {
  background: linear-gradient(135deg, #38ef7d 0%, #11998e 100%);
  box-shadow: 0 8px 25px rgba(56, 239, 125, 0.3);
}

.temp-warm {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  box-shadow: 0 8px 25px rgba(240, 147, 251, 0.3);
}

.temp-hot {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  box-shadow: 0 8px 25px rgba(255, 154, 158, 0.3);
}

.temp-very-hot {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.temp-extreme {
  background: linear-gradient(135deg, #c0392b 0%, #8e44ad 100%);
  box-shadow: 0 8px 25px rgba(192, 57, 43, 0.4);
  animation: pulse-heat 2s ease-in-out infinite;
}

@keyframes pulse-heat {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 25px rgba(192, 57, 43, 0.4);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 12px 35px rgba(192, 57, 43, 0.6);
  }
}

.temperature-value {
  font-size: 3rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.temperature-value:hover {
  transform: scale(1.05);
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
}

.sensor-icon {
  font-size: 4rem;
  color: #f8f9fa;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
  transition: all 0.3s ease;
}

/* Ícones específicos para cada faixa de temperatura */
.sensor-icon.freezing {
  color: #cce7ff;
}

.sensor-icon.cold {
  color: #e1ecf4;
}

.sensor-icon.hot {
  color: #ffe6e6;
  filter: drop-shadow(2px 2px 8px rgba(255, 107, 107, 0.5));
}

.sensor-icon.extreme {
  color: #ffcccc;
  filter: drop-shadow(2px 2px 12px rgba(192, 57, 43, 0.7));
  animation: glow-heat 2s ease-in-out infinite;
}

@keyframes glow-heat {
  0%,
  100% {
    filter: drop-shadow(2px 2px 12px rgba(192, 57, 43, 0.7));
  }
  50% {
    filter: drop-shadow(2px 2px 20px rgba(255, 107, 107, 0.9));
  }
}

.navbar-brand {
  font-weight: bold;
}

.status-badge {
  font-size: 0.9rem;
}

/* Estados de carregamento */
.loading {
  opacity: 0.7;
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
  color: #6c757d;
  font-style: italic;
}

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

/* Card de localização */
.location-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-left: 4px solid #007bff;
}

.location-card:hover {
  transform: translateY(-1px);
  transition: all 0.3s ease;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Cards meteorológicos */
.weather-card:hover {
  transform: translateY(-2px);
  transition: all 0.3s ease;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Animação para carregamento de localização */
.loading-text i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Status de conexão */
.connection-online {
  color: #28a745 !important;
}

.connection-offline {
  color: #ffc107 !important;
}

.connection-error {
  color: #dc3545 !important;
}

/* Cards de estatísticas com hover */
.card:hover {
  transform: translateY(-2px);
  transition: all 0.3s ease;
}

/* Indicador de dados em tempo real */
.realtime-indicator {
  position: relative;
}

.realtime-indicator::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 8px;
  background-color: #28a745;
  border-radius: 50%;
  animation: blink 2s infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0.3;
  }
}

/* ========================================
   TEMA DARK/LIGHT - SISTEMA COMPLETO
   ======================================== */

/* Botão de tema */
#themeToggle {
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#themeToggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

#themeToggle:active {
  transform: scale(0.95);
}

/* Animação do ícone */
#themeIcon {
  font-size: 1.2rem;
  transition: all 0.3s ease;
  transform-origin: center;
}

#themeToggle:hover #themeIcon {
  transform: rotate(15deg) scale(1.1);
}

/* Efeito de pulso sutil */
@keyframes theme-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0);
  }
}

#themeToggle:focus {
  animation: theme-pulse 1.5s infinite;
}

/* Tema dark - ajustar cor do botão */
[data-theme="dark"] #themeToggle {
  border-color: #ffc107;
  color: #ffc107;
}

[data-theme="dark"] #themeToggle:hover {
  background-color: rgba(255, 193, 7, 0.1);
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
}

/* Tema Light (padrão) */
body {
  transition: all 0.3s ease;
}

/* Tema Dark */
[data-theme="dark"] {
  background-color: #1a1a1a !important;
  color: #e0e0e0 !important;
}

[data-theme="dark"] body {
  background-color: #1a1a1a !important;
}

[data-theme="dark"] .bg-light {
  background-color: #2d2d2d !important;
}

[data-theme="dark"] .bg-dark {
  background-color: #1a1a1a !important;
}

[data-theme="dark"] .navbar {
  background-color: #1f1f1f !important;
  border-bottom: 1px solid #444;
}

[data-theme="dark"] .card {
  background-color: #2d2d2d !important;
  color: #e0e0e0 !important;
  border: 1px solid #404040 !important;
}

[data-theme="dark"] .location-card {
  background: linear-gradient(135deg, #2d2d2d 0%, #3a3a3a 100%) !important;
  color: #e0e0e0 !important;
  border-left: 4px solid #007bff !important;
}

[data-theme="dark"] .text-muted {
  color: #b0b0b0 !important;
}

[data-theme="dark"] .text-dark {
  color: #e0e0e0 !important;
}

[data-theme="dark"] .bg-white {
  background-color: #2d2d2d !important;
}

[data-theme="dark"] .card-header {
  background-color: #3a3a3a !important;
  border-bottom: 1px solid #505050 !important;
  color: #e0e0e0 !important;
}

[data-theme="dark"] footer {
  background-color: #1f1f1f !important;
  border-top: 1px solid #404040;
}

/* Sombras mais suaves no tema dark */
[data-theme="dark"] .card {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .shadow-lg {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .shadow-sm {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

/* Cards de temperatura no tema dark - manter gradientes mas com ajuste */
[data-theme="dark"] .temp-freezing {
  box-shadow: 0 8px 25px rgba(30, 60, 114, 0.5);
}

[data-theme="dark"] .temp-cold {
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

[data-theme="dark"] .temp-cool {
  box-shadow: 0 8px 25px rgba(17, 153, 142, 0.5);
}

[data-theme="dark"] .temp-comfortable {
  box-shadow: 0 8px 25px rgba(56, 239, 125, 0.5);
}

[data-theme="dark"] .temp-warm {
  box-shadow: 0 8px 25px rgba(240, 147, 251, 0.5);
}

[data-theme="dark"] .temp-hot {
  box-shadow: 0 8px 25px rgba(255, 154, 158, 0.5);
}

[data-theme="dark"] .temp-very-hot {
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
}

[data-theme="dark"] .temp-extreme {
  box-shadow: 0 8px 25px rgba(192, 57, 43, 0.6);
}

/* Transição suave ao alternar temas */
* {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
}

/* Melhorias específicas para o tema dark */
[data-theme="dark"] .display-4 {
  color: #f8f9fa !important;
}

[data-theme="dark"] .lead {
  color: #c0c0c0 !important;
}

[data-theme="dark"] .navbar-brand {
  color: #ffffff !important;
}

[data-theme="dark"] .navbar-text {
  color: #e0e0e0 !important;
}

/* Badges no tema dark */
[data-theme="dark"] .badge {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ícones no tema dark */
[data-theme="dark"] .text-warning {
  color: #ffc107 !important;
}

[data-theme="dark"] .text-primary {
  color: #0d6efd !important;
}

[data-theme="dark"] .text-danger {
  color: #dc3545 !important;
}

[data-theme="dark"] .text-success {
  color: #198754 !important;
}

[data-theme="dark"] .text-info {
  color: #0dcaf0 !important;
}

/* Melhorias para tablets */
@media (max-width: 992px) {
  .temperature-value {
    font-size: 3rem;
  }

  .sensor-icon {
    font-size: 3.5rem;
  }

  .location-card .card-body {
    padding: 1rem;
  }
}

/* Melhorias para dispositivos móveis */
@media (max-width: 768px) {
  .temperature-value {
    font-size: 2.5rem;
  }

  .sensor-icon {
    font-size: 3rem;
  }

  .display-4 {
    font-size: 2rem;
  }

  .location-card .row {
    text-align: center;
  }

  .location-card .col-auto {
    margin-top: 0.5rem;
  }

  .temperature-card .card-body {
    padding: 2rem 1rem;
  }

  .temperature-card .row {
    align-items: center;
    text-align: center;
  }

  .temperature-card .col-4 {
    margin-bottom: 1rem;
  }

  #iotHumidity {
    font-size: 0.8rem;
    margin-top: 0.5rem;
  }

  .status-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
}

@media (max-width: 576px) {
  .temperature-value {
    font-size: 2rem;
  }

  .sensor-icon {
    font-size: 2.5rem;
  }

  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .card {
    margin-bottom: 1rem;
  }

  .temperature-card .card-body {
    padding: 1.5rem 0.75rem;
  }

  .lead {
    font-size: 1rem;
  }

  .navbar .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .navbar-brand {
    font-size: 1rem;
  }

  #themeToggle {
    width: 35px;
    height: 35px;
    padding: 0;
    font-size: 0.9rem;
  }

  #themeIcon {
    font-size: 0.9rem;
  }
}

/* Melhorias para tema dark no mobile */
@media (max-width: 768px) {
  [data-theme="dark"] .temperature-card .card-body {
    border-radius: 0.5rem;
  }

  [data-theme="dark"] .location-card {
    border: 1px solid #404040;
  }
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
  .temperature-value,
  .sensor-icon,
  #themeToggle,
  .card {
    transition: none;
  }

  .temp-extreme .sensor-icon {
    animation: none;
  }

  @keyframes pulse-heat {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.02);
    }
  }
}

/* Melhor contraste para acessibilidade */
@media (prefers-contrast: high) {
  .temperature-card {
    border: 2px solid rgba(255, 255, 255, 0.3);
  }

  [data-theme="dark"] .card {
    border: 2px solid rgba(255, 255, 255, 0.2);
  }

  .status-badge {
    border: 1px solid rgba(255, 255, 255, 0.3);
  }
}

/* Indicador de bateria */
[data-battery] {
  font-size: 0.8rem;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

[data-battery]:hover {
  opacity: 1;
}

/* Cores para níveis de bateria */
.battery-low {
  color: #dc3545 !important;
}

.battery-medium {
  color: #ffc107 !important;
}

.battery-high {
  color: #28a745 !important;
}

/* Tema dark - ajustar cores da bateria */
[data-theme="dark"] .battery-low {
  color: #ff6b6b !important;
}

[data-theme="dark"] .battery-medium {
  color: #ffd43b !important;
}

[data-theme="dark"] .battery-high {
  color: #51cf66 !important;
}
