/* ── Clusner Technologies IoT Irrigation Dashboard ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

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

:root {
  --green: #16a34a;
  --green-light: #22c55e;
  --green-dark: #15803d;
  --green-bg: #f0fdf4;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-w: 240px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--slate-50);
  color: var(--slate-800);
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--slate-100);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 18px;
}
.sidebar-logo-text h2 { font-size: 13px; font-weight: 800; color: var(--slate-800); line-height: 1.2; }
.sidebar-logo-text p { font-size: 10px; color: var(--slate-400); font-weight: 500; }

.sidebar-nav { padding: 12px 8px; flex: 1; overflow-y: auto; }
.nav-section-label {
  font-size: 10px; font-weight: 700; color: var(--slate-400);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 8px 8px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 500; color: var(--slate-600);
  text-decoration: none; cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--slate-100); color: var(--slate-800); }
.nav-item.active { background: var(--green-bg); color: var(--green-dark); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--slate-100);
  font-size: 11px; color: var(--slate-400);
}

/* ── Main Content ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ── */
.topbar {
  height: 52px;
  background: white;
  border-bottom: 1px solid var(--slate-100);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.status-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
}
.status-badge.online { background: #dcfce7; color: #16a34a; }
.status-badge.offline { background: #fee2e2; color: #dc2626; }
.status-badge.firebase { background: #fff7ed; color: #ea580c; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-dot.green { background: #22c55e; animation: pulse 2s infinite; }
.status-dot.orange { background: #f97316; }
.status-dot.red { background: #ef4444; }

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

.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ── Page Content ── */
.page-content { padding: 24px; flex: 1; }
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 800; color: var(--slate-800); }
.page-header p { font-size: 13px; color: var(--slate-500); margin-top: 2px; }

/* ── Cards ── */
.card {
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--slate-50);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 700; color: var(--slate-700); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 20px; }

/* ── Stat Cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-icon.green { background: #dcfce7; }
.stat-icon.blue { background: #dbeafe; }
.stat-icon.amber { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }
.stat-icon.red { background: #fee2e2; }
.stat-value { font-size: 24px; font-weight: 800; color: var(--slate-800); line-height: 1; }
.stat-label { font-size: 11px; color: var(--slate-500); font-weight: 500; margin-top: 2px; }

/* ── Sensor Cards ── */
.sensor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.sensor-card {
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.sensor-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.sensor-icon { font-size: 28px; margin-bottom: 8px; }
.sensor-value { font-size: 26px; font-weight: 800; color: var(--slate-800); font-family: 'JetBrains Mono', monospace; }
.sensor-unit { font-size: 12px; color: var(--slate-400); font-weight: 500; }
.sensor-label { font-size: 12px; color: var(--slate-500); font-weight: 600; margin-top: 4px; }
.sensor-card.temp { border-top: 3px solid #ef4444; }
.sensor-card.humidity { border-top: 3px solid #3b82f6; }
.sensor-card.ldr { border-top: 3px solid #f59e0b; }
.sensor-card.light { border-top: 3px solid #8b5cf6; }
.sensor-card.raw { border-top: 3px solid #64748b; }

/* ── Pump Cards ── */
.pump-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pump-card {
  background: white;
  border: 2px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all 0.3s;
  box-shadow: var(--shadow);
}
.pump-card.on {
  border-color: #86efac;
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.1), var(--shadow-md);
}
.pump-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pump-name { font-size: 14px; font-weight: 700; color: var(--slate-700); }
.pump-zone { font-size: 11px; color: var(--slate-400); margin-top: 1px; }
.pump-status-badge {
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
}
.pump-status-badge.on { background: #dcfce7; color: #16a34a; }
.pump-status-badge.off { background: var(--slate-100); color: var(--slate-400); }

.pump-btn {
  width: 56px; height: 56px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  transition: all 0.3s;
  position: relative;
  margin: 0 auto 10px;
}
.pump-btn.off { background: var(--slate-200); color: var(--slate-400); }
.pump-btn.on {
  background: var(--green-light);
  color: white;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.4);
  animation: pump-pulse 2s infinite;
}
.pump-btn:hover:not(:disabled) { transform: scale(1.08); }
.pump-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@keyframes pump-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.4); }
  70% { box-shadow: 0 0 0 12px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.pump-firebase-path {
  display: none;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-outline {
  background: transparent; color: var(--slate-600);
  border: 1.5px solid var(--slate-200);
}
.btn-outline:hover:not(:disabled) { background: var(--slate-50); border-color: var(--slate-300); }
.btn-amber { background: var(--amber); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--slate-600); margin-bottom: 5px; }
.form-input {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--slate-200); border-radius: 10px;
  font-size: 13px; font-family: inherit; color: var(--slate-800);
  background: white; outline: none;
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,0.1); }
.form-input::placeholder { color: var(--slate-300); }
.form-select {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--slate-200); border-radius: 10px;
  font-size: 13px; font-family: inherit; color: var(--slate-800);
  background: white; outline: none; cursor: pointer;
}
.form-select:focus { border-color: var(--green); }

/* ── Days Selector ── */
.days-selector { display: flex; gap: 6px; flex-wrap: wrap; }
.day-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--slate-200);
  background: white; font-size: 11px; font-weight: 700;
  color: var(--slate-500); cursor: pointer;
  transition: all 0.15s;
}
.day-btn.selected { background: var(--green); border-color: var(--green); color: white; }
.day-btn:hover:not(.selected) { border-color: var(--green); color: var(--green); }

/* ── Schedule Items ── */
.schedule-item {
  background: var(--slate-50);
  border: 1px solid var(--slate-100);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.schedule-info { flex: 1; }
.schedule-name { font-size: 13px; font-weight: 600; color: var(--slate-700); }
.schedule-details { font-size: 11px; color: var(--slate-400); margin-top: 2px; }
.schedule-actions { display: flex; gap: 6px; align-items: center; }

/* ── Toggle Switch ── */
.toggle {
  position: relative; width: 38px; height: 22px;
  display: inline-block;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--slate-200); border-radius: 22px;
  transition: 0.3s;
}
.toggle-slider:before {
  position: absolute; content: "";
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white; border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ── Firebase Auth Panel ── */
.auth-panel {
  background: white;
  border: 1px solid var(--slate-100);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.auth-panel.connected { border-color: #86efac; background: #f0fdf4; }
.auth-panel.connected .auth-status { color: var(--green); font-weight: 700; }

/* ── Alert / Notice ── */
.notice {
  padding: 10px 14px; border-radius: 10px;
  font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.notice.warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.notice.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.notice.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.notice.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead tr { background: var(--slate-50); }
th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.05em; }
td { padding: 10px 14px; border-top: 1px solid var(--slate-50); color: var(--slate-700); }
tr:hover td { background: var(--slate-50); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge.green { background: #dcfce7; color: #16a34a; }
.badge.red { background: #fee2e2; color: #dc2626; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.slate { background: var(--slate-100); color: var(--slate-500); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white; border-radius: var(--radius-xl);
  padding: 24px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--slate-800); }
.modal-close { width: 28px; height: 28px; border-radius: 8px; border: none; background: var(--slate-100); cursor: pointer; font-size: 16px; color: var(--slate-500); display: flex; align-items: center; justify-content: center; }
.modal-footer { display: flex; gap: 10px; margin-top: 20px; }

/* ── Toast ── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600; color: white;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
  min-width: 200px;
  background: var(--green);
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Hero Banner ── */
.hero-banner {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 60%, #166534 100%);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  color: white;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.hero-banner::after {
  content: '';
  position: absolute; bottom: -60px; right: 60px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
}
.hero-banner h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.hero-banner p { font-size: 13px; opacity: 0.85; }
.hero-banner .hero-meta { font-size: 12px; opacity: 0.7; margin-top: 8px; }

/* ── Section Headers ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-header h2 { font-size: 15px; font-weight: 700; color: var(--slate-700); display: flex; align-items: center; gap: 8px; }

/* ── All Pumps Buttons ── */
.all-pumps-bar {
  display: flex; gap: 10px; margin-bottom: 16px;
}

/* ── Admin User Card ── */
.user-live-card {
  background: white;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}
.user-live-card.has-data { border-color: #86efac; }
.user-live-card.blocked { border-color: #fca5a5; }
.user-card-header {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
}
.user-card-header:hover { background: var(--slate-50); }
.user-avatar-sm {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-avatar-sm.blocked { background: var(--slate-300); }
.user-card-info { flex: 1; min-width: 0; }
.user-card-name { font-size: 13px; font-weight: 700; color: var(--slate-800); }
.user-card-email { font-size: 11px; color: var(--slate-400); }
.user-card-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pump-mini-indicators { display: flex; gap: 4px; }
.pump-mini {
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 8px; font-weight: 700; color: white;
  display: flex; align-items: center; justify-content: center;
}
.pump-mini.on { background: var(--green-light); }
.pump-mini.off { background: var(--slate-200); color: var(--slate-400); }

.user-card-detail {
  border-top: 1px solid var(--slate-100);
  padding: 14px 16px;
  display: none;
}
.user-card-detail.open { display: block; }

/* ── Sensor Mini Gauges ── */
.sensor-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.sensor-mini {
  background: var(--slate-50);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.sensor-mini-val { font-size: 18px; font-weight: 800; color: var(--slate-800); font-family: 'JetBrains Mono', monospace; }
.sensor-mini-unit { font-size: 10px; color: var(--slate-400); }
.sensor-mini-label { font-size: 10px; color: var(--slate-500); font-weight: 600; margin-top: 2px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sensor-grid { grid-template-columns: repeat(2, 1fr); }
  .pump-grid { grid-template-columns: repeat(2, 1fr); }
  .sensor-mini-grid { grid-template-columns: repeat(2, 1fr); }
  .hamburger { display: flex !important; }
}

.hamburger {
  display: none; flex-direction: column; gap: 4px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.hamburger span { width: 20px; height: 2px; background: var(--slate-600); border-radius: 2px; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── Loading Spinner ── */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--slate-200);
  border-top-color: var(--green);
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-state {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 40px; color: var(--slate-400); font-size: 13px;
}

/* ── Tabs ── */
.tabs { display: flex; gap: 2px; background: var(--slate-100); padding: 4px; border-radius: 12px; width: fit-content; margin-bottom: 16px; }
.tab-btn {
  padding: 7px 16px; border-radius: 9px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--slate-500);
  transition: all 0.15s;
}
.tab-btn.active { background: white; color: var(--slate-800); box-shadow: var(--shadow); }

/* ── Chart Bar (CSS only) ── */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 80px; padding: 0 4px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.bar-fill {
  width: 100%; border-radius: 4px 4px 0 0;
  background: var(--green-light);
  transition: height 0.5s ease;
  min-height: 4px;
}
.bar-fill.off { background: var(--slate-200); }
.bar-label { font-size: 10px; color: var(--slate-500); font-weight: 600; }

/* ═══════════════════════════════════════════════════════════
   PLANT + WATER SPRAY ANIMATION
═══════════════════════════════════════════════════════════ */
.pump-plant-wrap {
  position: relative;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 110px; margin: 8px 0;
}
.pump-plant {
  font-size: 52px; line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(22,163,74,0.3));
  transition: transform 0.4s ease;
  position: relative; z-index: 2;
}
.pump-card.on .pump-plant {
  animation: plantSway 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(22,163,74,0.5));
}
@keyframes plantSway {
  0%,100% { transform: rotate(-3deg) scale(1.05); }
  50%      { transform: rotate(3deg) scale(1.1); }
}
.water-spray {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none; overflow: visible; z-index: 1;
}
.water-spray .drop {
  position: absolute; width: 6px; height: 10px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(180deg, #60a5fa, #3b82f6);
  opacity: 0;
}
.pump-card.on .water-spray .drop {
  animation: waterFall var(--dur, 1.2s) ease-in var(--delay, 0s) infinite;
}
@keyframes waterFall {
  0%   { opacity: 0; transform: translate(0, -10px) scale(0.5); }
  20%  { opacity: 0.9; }
  80%  { opacity: 0.6; }
  100% { opacity: 0; transform: translate(var(--dx,0px), 55px) scale(1.2); }
}
.pump-ripple {
  position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 12px; border-radius: 50%;
  background: rgba(59,130,246,0.15); opacity: 0;
}
.pump-card.on .pump-ripple {
  animation: rippleWave 1.5s ease-out infinite;
}
@keyframes rippleWave {
  0%   { opacity: 0.8; transform: translateX(-50%) scale(0.5); }
  100% { opacity: 0; transform: translateX(-50%) scale(2.5); }
}
.pump-card.on {
  box-shadow: 0 0 0 2px rgba(34,197,94,0.4), 0 8px 32px rgba(34,197,94,0.15) !important;
  border-color: rgba(34,197,94,0.4) !important;
}

/* ═══════════════════════════════════════════════════════════
   AI ADVISOR CARD
═══════════════════════════════════════════════════════════ */
.ai-advisor-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  border-radius: 16px; padding: 24px; margin-bottom: 24px;
  border: 1px solid rgba(139,92,246,0.3);
  position: relative; overflow: hidden;
}
.ai-advisor-card::before {
  content: ''; position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(139,92,246,0.08) 0%, transparent 60%),
              radial-gradient(circle at 70% 60%, rgba(59,130,246,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.ai-advisor-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.ai-advisor-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: 0 4px 16px rgba(124,58,237,0.4);
  animation: aiPulse 3s ease-in-out infinite; flex-shrink: 0;
}
@keyframes aiPulse {
  0%,100% { box-shadow: 0 4px 16px rgba(124,58,237,0.4); }
  50%      { box-shadow: 0 4px 24px rgba(124,58,237,0.7), 0 0 40px rgba(59,130,246,0.2); }
}
.ai-advisor-title { color: #e2e8f0; font-size: 18px; font-weight: 700; }
.ai-advisor-subtitle { color: #94a3b8; font-size: 12px; }
.ai-response-box {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 16px;
  min-height: 80px; color: #e2e8f0;
  font-size: 14px; line-height: 1.6;
  margin-bottom: 12px; white-space: pre-wrap;
}
.ai-typing-dots { display: inline-flex; gap: 4px; align-items: center; }
.ai-typing-dots span {
  width: 7px; height: 7px; background: #7c3aed;
  border-radius: 50%; animation: dotBounce 1.2s ease-in-out infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
  0%,80%,100% { transform: scale(0.6); opacity: 0.4; }
  40%          { transform: scale(1.2); opacity: 1; }
}
.ai-btn {
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  color: white; border: none; border-radius: 10px;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.ai-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(124,58,237,0.4); }
.ai-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.ai-quick-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ai-quick-btn {
  background: rgba(139,92,246,0.15);
  border: 1px solid rgba(139,92,246,0.3);
  color: #c4b5fd; border-radius: 20px;
  padding: 5px 12px; font-size: 11px; cursor: pointer; transition: all 0.2s;
}
.ai-quick-btn:hover { background: rgba(139,92,246,0.3); color: #e9d5ff; }

/* ═══════════════════════════════════════════════════════════
   SENSOR HISTORY CHART
═══════════════════════════════════════════════════════════ */
.chart-section {
  background: var(--white); border-radius: 16px;
  padding: 20px; margin-bottom: 24px;
  border: 1px solid var(--slate-100);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.chart-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}
.chart-section-title { font-size: 16px; font-weight: 700; color: var(--slate-800); }
.chart-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.chart-tab {
  padding: 5px 13px; border-radius: 20px;
  border: 1px solid var(--slate-200); background: var(--slate-50);
  font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  color: var(--slate-600);
}
.chart-tab.active { background: #2563eb; color: white; border-color: #2563eb; }
.chart-canvas-wrap { position: relative; height: 200px; width: 100%; }

/* ═══════════════════════════════════════════════════════════
   EXPORT BUTTONS
═══════════════════════════════════════════════════════════ */
.export-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.btn-export {
  background: linear-gradient(135deg, #059669, #10b981);
  color: white; border: none; border-radius: 10px;
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.2s;
}
.btn-export:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(5,150,105,0.3); }
.btn-export-pump { background: linear-gradient(135deg, #d97706, #f59e0b); }
.btn-export-pump:hover { box-shadow: 0 4px 16px rgba(217,119,6,0.3); }

/* ── Pump Usage Table ── */
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.usage-table th {
  background: #f0fdf4;
  color: #15803d;
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid #bbf7d0;
}
.usage-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
}
.usage-table tr:hover td { background: #f9fafb; }
.badge-schedule {
  background: #dcfce7;
  color: #15803d;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-manual {
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
}
