:root {
  --primary-color: #4361ee;
  --secondary-color: #3f37c9;
  --success-color: #4cc9f0;
  --danger-color: #f72585;
  --warning-color: #f8961e;
  --info-color: #4895ef;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 80px;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: #f5f7fb;
  color: #333;
  overflow-x: hidden;
}

/* Wrapper */
.wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
}

/* Sidebar */
#sidebar {
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: #fff;
  transition: all 0.3s;
  position: fixed;
  height: 100vh;
  z-index: 999;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
}

#sidebar.active {
  min-width: var(--sidebar-collapsed-width);
  max-width: var(--sidebar-collapsed-width);
  text-align: center;
}

#sidebar.active .sidebar-header h3 {
  display: none;
}

#sidebar.active .sidebar-header strong {
  display: block;
}

#sidebar ul li a {
  padding: 15px;
  display: block;
  color: #fff;
  text-decoration: none;
  transition: all 0.3s;
  border-radius: 5px;
  margin: 5px 10px;
}

#sidebar ul li a:hover,
#sidebar ul li.active > a {
  background: rgba(255, 255, 255, 0.2);
}

#sidebar ul li a i {
  margin-right: 10px;
}

#sidebar.active ul li a {
  padding: 15px 10px;
  text-align: center;
}

#sidebar.active ul li a i {
  margin-right: 0;
  display: block;
  font-size: 1.5em;
  margin-bottom: 5px;
}

#sidebar .sidebar-header {
  padding: 20px;
  background: rgba(0, 0, 0, 0.1);
}

#sidebar .sidebar-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 15px;
  text-align: center;
  font-size: 0.8em;
  background: rgba(0, 0, 0, 0.1);
}

/* Content */
#content {
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  transition: all 0.3s;
  position: absolute;
  top: 0;
  right: 0;
  padding: 20px;
}

#content.active {
  width: calc(100% - var(--sidebar-collapsed-width));
}

/* Page Content */
.page-content {
  display: none;
}

.page-content.active {
  display: block;
  animation: fadeIn 0.3s;
}

/* Navbar */
.navbar {
  padding: 15px 10px;
  background: #fff;
  border: none;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

#sidebarCollapse {
  background: var(--primary-color);
  border: none;
}

/* Cards */
.card {
  border: none;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
  transition: transform 0.3s;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card-header {
  background-color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 15px 20px;
}

.card-body {
  padding: 20px;
}

/* Sensor Cards */
.sensor-card {
  height: 100%;
}

.sensor-card .card-body {
  display: flex;
  align-items: center;
}

.sensor-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  color: white;
  font-size: 1.5rem;
}

.sensor-info {
  flex: 1;
}

.sensor-value {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 5px 0;
}

.sensor-value small {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.7;
}

/* Stats */
.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  font-weight: 500;
  color: #666;
}

.stat-value {
  font-weight: 600;
  color: var(--primary-color);
}

/* Table */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  color: #555;
  border-top: none;
}

.table td {
  vertical-align: middle;
}

/* Chart date range */
.chart-date-range {
  font-size: 0.8rem;
  color: #666;
}

/* Air Quality Card */
.air-quality-card {
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #f5f7fa, #e4e7eb);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.air-quality-indicator {
  margin-right: 20px;
}

.indicator-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #4cc9f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  box-shadow: 0 0 15px rgba(76, 201, 240, 0.5);
}

.air-quality-info h3 {
  margin: 0 0 5px 0;
  font-weight: 600;
}

.air-quality-info p {
  margin: 0;
  color: #666;
}

/* Prediction Info */
.prediction-info {
  padding: 15px;
}

.prediction-stat {
  margin: 15px 0;
  padding-bottom: 10px;
  border-bottom: 1px dashed #ddd;
}

.prediction-stat:last-child {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
  #sidebar {
    min-width: var(--sidebar-collapsed-width);
    max-width: var(--sidebar-collapsed-width);
    text-align: center;
    margin-left: calc(-1 * var(--sidebar-collapsed-width));
  }
  
  #sidebar.active {
    margin-left: 0;
  }
  
  #content {
    width: 100%;
  }
  
  #content.active {
    width: calc(100% - var(--sidebar-collapsed-width));
  }
  
  #sidebarCollapse span {
    display: none;
  }
  
  .sensor-card .card-body {
    flex-direction: column;
    text-align: center;
  }
  
  .sensor-icon {
    margin-right: 0;
    margin-bottom: 10px;
  }
  
  .air-quality-card {
    flex-direction: column;
    text-align: center;
  }
  
  .air-quality-indicator {
    margin-right: 0;
    margin-bottom: 15px;
  }
}

/* Animation */
.fade-in {
  animation: fadeIn 0.5s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Status badges */
.badge {
  padding: 5px 10px;
  border-radius: 30px;
  font-weight: 500;
}

/* Chart container */
canvas {
  width: 100% !important;
}

/* Date filter */
.date-filter {
  display: flex;
  align-items: center;
}

/* Page title */
.page-title {
  font-weight: 600;
  color: var(--dark-color);
  margin-bottom: 5px;
}

/* Modal */
.modal-content {
  border-radius: 10px;
  border: none;
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Dark Theme */
body.dark-theme {
  background-color: #1a1a2e;
  color: #f5f5f5;
}

body.dark-theme .card,
body.dark-theme .navbar,
body.dark-theme .modal-content {
  background-color: #16213e;
  color: #f5f5f5;
}

body.dark-theme .card-header {
  background-color: #16213e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-theme .text-muted {
  color: #adb5bd !important;
}

body.dark-theme .table {
  color: #f5f5f5;
}

body.dark-theme .table td,
body.dark-theme .table th {
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .form-control,
body.dark-theme .form-select {
  background-color: #0f3460;
  border-color: #0f3460;
  color: #f5f5f5;
}

body.dark-theme .btn-outline-secondary {
  color: #f5f5f5;
  border-color: #adb5bd;
}

body.dark-theme .air-quality-card {
  background: linear-gradient(135deg, #16213e, #0f3460);
}

body.dark-theme .air-quality-info p {
  color: #adb5bd;
}

body.dark-theme .stat-label {
  color: #adb5bd;
}