:root {
  --bg-color: #f8f9fa;
  --panel-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.05) 100%);
  --panel-border: rgba(230, 230, 230, 0.7);
  --panel-shadow: rgba(0, 0, 0, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #d1d5db;
  --text-shadow: 0 1px 2px rgba(94, 94, 94, 0.6);

  --accent-temp: #ff635b;
  --accent-hum: #00d2ff;
  --accent-pred: #c77dff;

  --glow-temp: rgba(255, 94, 87, 0.5);
  --glow-hum: rgba(0, 210, 255, 0.5);

  --overlay-sunny: rgba(255, 255, 255, 0.2);
  --overlay-rainy: rgba(255, 255, 255, 0.3);

  --font-family: 'Inter', -apple-system, sans-serif;
  --transition: all 0.3s ease;
}

[data-theme="dark"] {
  --bg-color: #0d1117;
  --panel-bg: linear-gradient(180deg, rgba(30, 36, 43, 0.8) 0%, rgba(16, 20, 24, 0.2) 100%);
  --panel-border: rgba(255, 255, 255, 0.1);
  --panel-shadow: rgba(0, 0, 0, 0.5);
  --text-primary: #ffffff;
  --text-secondary: #d1d5db;
  --text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);

  --accent-temp: #fd483f;
  --accent-hum: #00d2ff;
  --accent-pred: #c77dff;

  --glow-temp: rgba(255, 94, 87, 0.5);
  --glow-hum: rgba(0, 210, 255, 0.5);

  --overlay-sunny: rgba(10, 15, 20, 0.5);
  --overlay-rainy: rgba(10, 15, 20, 0.6);
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  background-image: url('../assets/V3.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 1.5s ease-in-out;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Premium Liquid Glassmorphism */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid var(--panel-border);
  border-top: 1px solid var(--panel-border);
  border-left: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow:
    0 16px 40px var(--panel-shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  position: relative;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, border-radius 0.4s ease, transform 0.1s;
}

/* Dynamic Lighting Reflection tracking the mouse */
.glass-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(800px circle at var(--mouse-x, -1000px) var(--mouse-y, -1000px),
      rgba(255, 255, 255, 0.15),
      transparent 40%);
  z-index: 2;
  transition: opacity 0.3s ease;
}

/* Enhancing Readability with Adaptive Contrast */
.card h2,
.stat-value,
.pred-val,
.gauge-value,
.data-table th,
.data-table td {
  text-shadow: var(--text-shadow);
}

/* Liquid Physics State Styles */
.liquid-draggable {
  cursor: grab;
  will-change: transform;
  z-index: 10;
}

.liquid-draggable.is-dragging {
  cursor: grabbing !important;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.06);
}

.liquid-draggable.is-dragging::after {
  content: '';
  position: absolute;
  inset: -20px;
  border-radius: inherit;
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.2);
  filter: blur(15px);
  z-index: -1;
  pointer-events: none;
}

.liquid-draggable.is-magnetic {
  border-color: rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 0 50px rgba(0, 210, 255, 0.3) !important;
  transform: scale(1.03);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Navigation */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 3rem;
  background: var(--panel-bg);
  backdrop-filter: blur(28px) saturate(200%);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px var(--panel-shadow);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

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

.logo-icon {
  font-size: 1.5rem;
  color: #fbbf24;
}

.navbar h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Connection Status */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  transition: var(--transition);
}

.pulse.connected {
  background-color: #2ea043;
  box-shadow: 0 0 10px rgba(46, 160, 67, 0.6);
  animation: pulse-animation 2s infinite;
}

.pulse.error {
  background-color: #ff5e57;
  box-shadow: 0 0 10px rgba(255, 94, 87, 0.6);
}

@keyframes pulse-animation {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 160, 67, 0.7);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(46, 160, 67, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(46, 160, 67, 0);
  }
}

.clock {
  font-family: monospace;
  font-size: 1rem;
  color: var(--text-secondary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Download Button */
.btn-download {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #dbdbdb;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-download:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}

/* Dashboard Layout */
.dashboard-container {
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  perspective: 1200px;
  transform-style: preserve-3d;
}

.card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.card h2 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Gauges */
.gauges-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex: 1;
}

.gauge-wrapper {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-wrapper canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.gauge-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 15%;
  z-index: 1;
}

#current-temp {
  color: var(--accent-temp);
  text-shadow: 0 0 15px var(--glow-temp);
}

#current-hum {
  color: var(--accent-hum);
  text-shadow: 0 0 15px var(--glow-hum);
}

.gauge-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 1;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1rem;
  flex: 1;
}

.stat-box {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: var(--transition);
}

.stat-box:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.stat-title {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 600;
}

.text-glow-red {
  color: #ff7b72;
  text-shadow: 0 0 10px rgba(255, 123, 114, 0.3);
}

.text-glow-blue {
  color: #79c0ff;
  text-shadow: 0 0 10px rgba(121, 192, 255, 0.3);
}

/* Charts */
.chart-container {
  position: relative;
  height: 350px;
  width: 100%;
}

.pred-chart-container {
  position: relative;
  height: 200px;
  width: 100%;
  margin-top: 1rem;
}

/* Predictions */
.badge {
  background: rgba(157, 78, 221, 0.2);
  color: #c77dff;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pred-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.pred-box {
  background: rgba(157, 78, 221, 0.247);
  border: 1px solid rgba(157, 78, 221, 0.2);
  border-radius: 10px;
  padding: 0.8rem 1.2rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pred-label {
  font-size: 0.8rem;
  color: #d2a8f1;
}

.pred-val {
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
  margin-top: 0.3rem;
}

/* Table */
.table-container {
  overflow-y: auto;
  max-height: 300px;
  padding-right: 0.5rem;
}

.table-container::-webkit-scrollbar {
  width: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.table-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--panel-border);
  z-index: 10;
}

.data-table td {
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.data-table tbody tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.data-table tbody tr:first-child {
  animation: highlight-row 2s ease-out;
}

@keyframes highlight-row {
  0% {
    background: rgba(0, 210, 255, 0.2);
  }

  100% {
    background: transparent;
  }
}

@media (max-width: 1024px) {

  .top-row,
  .bottom-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    padding: 1rem;
  }

  .navbar {
    padding: 1rem;
  }

  .nav-right {
    display: none;
  }

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