/* ================================================================
   Smart Plant Monitoring — Dashboard & Sensor Cards Styling
   ================================================================ */

/* Welcome / Overview Banner */
.overview-banner {
  background: linear-gradient(135deg, var(--bg-surface), var(--sp-primary-50));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .overview-banner {
  background: linear-gradient(135deg, var(--bg-surface), rgba(5, 150, 105, 0.12));
}

.overview-banner::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.overview-info-col h1 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.overview-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.overview-stats-col {
  display: flex;
  align-items: center;
  gap: 20px;
}

.overview-stat-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.overview-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.overview-stat-val {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-heading);
}

/* ================================================================
   3 Primary Sensor Cards Grid + Pump Relay
   ================================================================ */
.sensor-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.sensor-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.sensor-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.sensor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.sensor-card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sensor-icon-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sensor-icon-box.soil { background-color: rgba(16, 185, 129, 0.15); color: #059669; }
.sensor-icon-box.temp { background-color: rgba(239, 68, 68, 0.15); color: #dc2626; }
.sensor-icon-box.hum  { background-color: rgba(59, 130, 246, 0.15); color: #2563eb; }
.sensor-icon-box.pump { background-color: rgba(16, 185, 129, 0.15); color: #059669; }

.sensor-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.sensor-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sensor-value-group {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.sensor-main-value {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--text-heading);
  letter-spacing: -0.03em;
  line-height: 1;
}

.sensor-unit {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Circular SVG Gauge for Soil Moisture */
.circular-gauge-container {
  position: relative;
  width: 76px;
  height: 76px;
}

.circular-gauge-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.gauge-circle-bg {
  fill: none;
  stroke: var(--bg-surface-alt);
  stroke-width: 6;
}

.gauge-circle-fill {
  fill: none;
  stroke: var(--sp-primary-500);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 226.2;
  stroke-dashoffset: 226.2;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Horizontal Progress Meter for Temperature & Humidity */
.sensor-progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--bg-surface-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 12px;
}

.sensor-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.7s ease, background-color 0.4s ease;
}

.sensor-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.threshold-range {
  font-weight: 500;
}

/* Pump Active Pulse Animation */
.pump-active-pulse {
  animation: pumpPulse 1.6s infinite ease-in-out;
}

@keyframes pumpPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ================================================================
   Health Diagnosis & Alerts Two-Column Layout
   ================================================================ */
.dashboard-two-col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 20px;
  margin-bottom: 24px;
}

.content-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.card-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-heading {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Health Diagnosis Details */
.health-overview-box {
  display: flex;
  align-items: center;
  gap: 24px;
  background-color: var(--bg-surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.health-radial-badge {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 4px solid var(--sp-primary-500);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.health-score-number {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--sp-primary-700);
  line-height: 1;
}

.health-score-caption {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

.health-summary-text {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.care-recommendations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recommendation-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-primary);
  background-color: var(--bg-surface-alt);
  border-left: 3px solid var(--sp-primary-600);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.rec-icon {
  width: 16px;
  height: 16px;
  color: var(--sp-primary-600);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Alerts Feed */
.alerts-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
}

.alert-card {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface-alt);
  transition: var(--transition-smooth);
}

.alert-card.alert-critical {
  border-left: 4px solid var(--status-danger);
  background-color: var(--status-danger-bg);
}

.alert-card.alert-warning {
  border-left: 4px solid var(--status-warning);
  background-color: var(--status-warning-bg);
}

.alert-card.alert-info {
  border-left: 4px solid var(--status-info);
  background-color: var(--status-info-bg);
}

.alert-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.alert-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-heading);
}

.alert-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.alert-msg {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.empty-feed-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px;
  background-color: var(--bg-surface-alt);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.empty-icon {
  width: 32px;
  height: 32px;
  color: var(--sp-primary-600);
}

.empty-text strong {
  display: block;
  font-size: 0.86rem;
  color: var(--text-heading);
  margin-bottom: 2px;
}

.empty-text span {
  font-size: 0.78rem;
}

/* ================================================================
   Chart Containers & Analytics Card
   ================================================================ */
.chart-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.chart-filter-group {
  display: inline-flex;
  background-color: var(--bg-surface-alt);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.chart-filter-btn {
  background: none;
  border: none;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.chart-filter-btn:hover {
  color: var(--text-heading);
}

.chart-filter-btn.active {
  background-color: var(--bg-surface);
  color: var(--sp-primary-700);
  box-shadow: var(--shadow-sm);
}

.chart-canvas-box {
  position: relative;
  height: 300px;
  width: 100%;
  margin-top: 14px;
}

/* ================================================================
   Data Tables (Recent Readings & History Table)
   ================================================================ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.sp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.sp-table th {
  background-color: var(--bg-surface-alt);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.sp-table th:first-child { border-top-left-radius: var(--radius-sm); }
.sp-table th:last-child  { border-top-right-radius: var(--radius-sm); }

.sp-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  vertical-align: middle;
}

.sp-table tr:hover td {
  background-color: var(--bg-surface-alt);
}

.table-time-cell {
  display: flex;
  flex-direction: column;
}

.table-metric-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.metric-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.8rem;
}

.status-bg-success { background: var(--status-success-bg); color: #047857; }
.status-bg-warning { background: var(--status-warning-bg); color: #b45309; }
.status-bg-danger  { background: var(--status-danger-bg);  color: #dc2626; }
.status-bg-info    { background: var(--status-info-bg);    color: #1d4ed8; }
.status-bg-neutral { background: var(--status-neutral-bg); color: #475569; }

/* ================================================================
   History Page Layout & Controls
   ================================================================ */
.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.history-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.history-actions-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.history-search-box {
  position: relative;
  width: 280px;
}

.history-search-box input {
  padding-left: 36px;
}

.history-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  margin-top: 12px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}
