/* =====================================================
   SMART PLANT MONITORING - AGRI LIGHT "FROSTED GLASS"
   Terang, transparan, background foto pertanian
===================================================== */

:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: rgba(5, 150, 105, 0.12);
  --accent: #65a30d;

  --glass: rgba(255, 255, 255, 0.5);
  --glass-strong: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.65);
  --card-glass: rgba(255, 255, 255, 0.62);
  --card-glass-dark: rgba(255, 255, 255, 0.5);

  --text: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --border: rgba(15, 23, 42, 0.08);

  --shadow-glass: 0 8px 32px rgba(15, 40, 25, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* =====================================================
   BACKGROUND FOTO + OVERLAY TERANG
===================================================== */
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;

  /* Ganti URL dengan 'bg.jpg' jika pakai foto sendiri */
  background:
    linear-gradient(135deg, rgba(240, 253, 244, 0.68) 0%, rgba(236, 252, 240, 0.55) 50%, rgba(240, 253, 244, 0.72) 100%),
    url('bg.jpg') center/cover fixed;
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(5, 150, 105, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(101, 163, 13, 0.06) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

/* =====================================================
   NAVBAR - FROSTED LIGHT
===================================================== */
.main-navbar {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 30px rgba(15, 40, 25, 0.08);
}

.main-navbar::before { display: none; }
.main-navbar .container { position: relative; z-index: 1; }

.main-navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  text-decoration: none;
}

.brand-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 22px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

.navbar-brand:hover .brand-logo {
  transform: rotate(15deg) scale(1.05);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.45);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: -0.2px; }
.brand-tag {
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Toggler */
.navbar-toggler {
  border: none !important;
  background: rgba(5, 150, 105, 0.1);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}
.navbar-toggler:hover { background: rgba(5, 150, 105, 0.18); }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25); }
.toggler-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--primary-dark);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.navbar-toggler[aria-expanded="true"] .toggler-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-toggler[aria-expanded="true"] .toggler-bar:nth-child(2) { opacity: 0; }
.navbar-toggler[aria-expanded="true"] .toggler-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.navbar-toggler-icon { display: none; }

/* Nav Links */
.main-navbar .navbar-nav { gap: 4px; }
.main-navbar .nav-link {
  color: rgba(15, 23, 42, 0.7) !important;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 16px !important;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}
.main-navbar .nav-link i { font-size: 16px; transition: transform 0.25s ease; }
.main-navbar .nav-link:hover {
  color: var(--primary-dark) !important;
  background: rgba(5, 150, 105, 0.1);
  transform: translateY(-1px);
}
.main-navbar .nav-link:hover i { transform: scale(1.1); }
.main-navbar .nav-link.active {
  color: white !important;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
  font-weight: 600;
}

/* Mobile Status */
.mobile-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  margin-top: 8px;
  margin-left: 0;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px rgba(5, 150, 105, 0.6);
}

/* =====================================================
   WELCOME BANNER - FROSTED HERO
===================================================== */
.welcome-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 30px;
  padding: 36px;
  background: var(--card-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(5, 150, 105, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-content { position: relative; z-index: 1; }

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(5, 150, 105, 0.12);
  border: 1px solid rgba(5, 150, 105, 0.25);
  color: var(--primary-dark);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
  letter-spacing: 0.3px;
}
.welcome-badge i { font-size: 14px; color: #d97706; }

.welcome-title {
  font-size: 34px;
  font-weight: 800;
  margin: 0 0 12px 0;
  letter-spacing: -0.5px;
  line-height: 1.15;
  background: linear-gradient(135deg, #065f46 0%, #65a30d 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.7;
  max-width: 600px;
}
.welcome-subtitle strong { color: var(--primary-dark); font-weight: 600; }

.welcome-status { position: relative; z-index: 1; }

.status-card {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(15px);
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  border: 1px solid var(--glass-border);
  min-width: 240px;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.status-dot-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

.status-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.status-meta i { color: var(--primary); font-size: 14px; }
.status-meta strong { color: var(--text); font-weight: 600; }

/* =====================================================
   CONTAINER
===================================================== */
.dashboard-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 28px 40px;
  position: relative;
  z-index: 1;
}

/* =====================================================
   DASHBOARD HEADER
===================================================== */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  padding: 24px 28px;
  background: var(--card-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
}

.dashboard-header h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dashboard-header h1 i { color: var(--primary); }
.dashboard-header p { margin: 6px 0 0 0; color: var(--text-muted); font-size: 14px; }

/* =====================================================
   SENSOR CARDS - FROSTED
===================================================== */
.sensor-card {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 140px;
  gap: 16px;
  padding: 20px 20px 20px 24px;
  background: var(--card-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sensor-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  background: var(--accent-color, var(--primary));
  border-radius: 0 4px 4px 0;
  transition: all 0.3s ease;
}

.sensor-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glass), 0 0 25px rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.3);
}
.sensor-card:hover::before {
  height: calc(100% - 16px);
  top: 8px;
  bottom: 8px;
  width: 5px;
}

.sensor-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  font-size: 26px;
  background: var(--icon-bg, rgba(5, 150, 105, 0.12));
  color: var(--accent-color, var(--primary));
  transition: all 0.3s ease;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.sensor-card:hover .sensor-icon {
  transform: scale(1.05) rotate(-3deg);
}

.sensor-content { min-width: 0; flex: 1; }
.sensor-title {
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sensor-value {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 26px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}

.sensor-progress {
  width: 100%;
  height: 6px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 10px;
}
.sensor-progress .progress-bar {
  height: 6px;
  border-radius: 10px;
  background: var(--accent-color, var(--primary));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  margin-top: 6px;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Sensor Colors - kontras untuk tema terang */
.sensor-moisture   { --accent-color: #0284c7; --icon-bg: rgba(2, 132, 199, 0.12); }
.sensor-soil-temp  { --accent-color: #dc2626; --icon-bg: rgba(220, 38, 38, 0.10); }
.sensor-ph         { --accent-color: #7c3aed; --icon-bg: rgba(124, 58, 237, 0.10); }
.sensor-nitrogen   { --accent-color: #059669; --icon-bg: rgba(5, 150, 105, 0.12); }
.sensor-phosphorus { --accent-color: #d97706; --icon-bg: rgba(217, 119, 6, 0.12); }
.sensor-potassium  { --accent-color: #db2777; --icon-bg: rgba(219, 39, 119, 0.10); }
.sensor-air-temp   { --accent-color: #ea580c; --icon-bg: rgba(234, 88, 12, 0.12); }
.sensor-humidity   { --accent-color: #0891b2; --icon-bg: rgba(8, 145, 178, 0.12); }

/* =====================================================
   DASHBOARD CARD
===================================================== */
.dashboard-card {
  width: 100%;
  padding: 26px;
  background: var(--card-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  transition: all 0.3s ease;
}
.dashboard-card:hover {
  box-shadow: var(--shadow-glass), 0 0 25px rgba(5, 150, 105, 0.1);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(101, 163, 13, 0.12) 100%);
  color: var(--primary-dark);
  border-radius: var(--radius-md);
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.15);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.section-header p { margin: 3px 0 0 0; color: var(--text-muted); font-size: 13px; }

/* =====================================================
   FORMS
===================================================== */
.form-label { color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 6px; }

.form-control,
.form-select {
  border: 1.5px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}
.form-control:hover,
.form-select:hover { border-color: rgba(5, 150, 105, 0.4); }
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
  outline: none;
  background: rgba(255, 255, 255, 0.85);
}
.form-control::placeholder { color: var(--text-light); }
.form-control-lg,
.form-select-lg { padding: 14px 18px; font-size: 15px; }
.form-select option { background: white; color: var(--text); }

/* =====================================================
   BUTTONS
===================================================== */
.action-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.btn {
  padding: 11px 22px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.btn-success {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}
.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.4);
  color: white;
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-outline-danger {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  padding: 9px 18px;
}
.btn-outline-danger:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.btn-outline-success {
  background: rgba(5, 150, 105, 0.08);
  color: var(--primary-dark);
  border: 1.5px solid rgba(5, 150, 105, 0.3);
  padding: 9px 18px;
}
.btn-outline-success:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* =====================================================
   ACTIVE PLANT
===================================================== */
.active-plant-card { padding-bottom: 24px; }

.active-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}
.active-info:hover {
  border-color: rgba(5, 150, 105, 0.3);
  background: rgba(240, 253, 244, 0.6);
}
.active-info span {
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.active-info strong { color: var(--text); font-size: 15px; font-weight: 600; }

/* =====================================================
   AI RESULT
===================================================== */
.ai-icon {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12) 0%, rgba(139, 92, 246, 0.1) 100%) !important;
  color: #7c3aed !important;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15) !important;
  border: 1px solid rgba(124, 58, 237, 0.2) !important;
}

.ai-result {
  padding: 26px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}

.ai-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-light);
}
.ai-section h3 i { font-size: 15px; color: var(--primary); }

.ai-section p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.8;
  text-align: justify;
}

.ai-condition-box {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
}
.ai-condition-box p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  line-height: 1.8;
  text-align: justify;
}

.ai-list { margin: 0; padding-left: 22px; }
.ai-list li {
  margin-bottom: 10px;
  padding-left: 6px;
  color: #334155;
  font-size: 14px;
  line-height: 1.7;
  text-align: justify;
}
.ai-list li::marker { color: var(--primary-dark); font-weight: 600; }
.ai-list li:last-child { margin-bottom: 0; }

.ai-reco-box > p { margin: 0; color: #334155; font-size: 14px; }

.ai-divider { height: 1px; margin: 22px 0; background: rgba(15, 23, 42, 0.08); }

.ai-time {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  color: var(--text-light);
  font-size: 12px;
}

#aiLoading {
  border-radius: var(--radius-md);
  font-size: 13px;
  padding: 12px 16px;
  border: 1px solid rgba(217, 119, 6, 0.3);
  background: rgba(251, 191, 36, 0.15);
  color: #92400e;
}

/* =====================================================
   HISTORY TABLE
===================================================== */
.history-table-wrapper {
  width: 100%;
  max-height: 450px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  backdrop-filter: blur(10px);
}
.history-table-wrapper::-webkit-scrollbar { width: 8px; height: 8px; }
.history-table-wrapper::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.04); }
.history-table-wrapper::-webkit-scrollbar-thumb { background: rgba(5, 150, 105, 0.3); border-radius: 10px; }
.history-table-wrapper::-webkit-scrollbar-thumb:hover { background: rgba(5, 150, 105, 0.5); }

#historyTable {
  min-width: 950px;
  margin-bottom: 0;
  --bs-table-bg: transparent;
  --bs-table-color: #334155;
  --bs-table-border-color: rgba(15, 23, 42, 0.06);
  --bs-table-striped-bg: rgba(5, 150, 105, 0.04);
  --bs-table-striped-color: #334155;
  --bs-table-hover-bg: rgba(5, 150, 105, 0.07);
  --bs-table-hover-color: #0f172a;
  color: #334155;
  background: transparent;
}

#historyTable th,
#historyTable td { padding: 12px 16px; white-space: nowrap; font-size: 13px; }
#historyTable thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(6, 95, 70, 0.95);
  color: #ecfdf5;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid rgba(5, 150, 105, 0.4);
  padding: 14px 16px;
}
#historyTable tbody td {
  color: #334155 !important;
  background-color: transparent !important;
  vertical-align: middle;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
#historyTable tbody tr { background: transparent !important; }
#historyTable tbody tr:hover td { background-color: rgba(5, 150, 105, 0.06) !important; }

/* =====================================================
   HISTORY CONTROLS
===================================================== */
.history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.history-limit { display: flex; align-items: center; gap: 10px; }
.history-limit label { margin: 0; color: var(--text-muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.history-limit input {
  width: 90px;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  border: 1.5px solid rgba(15, 23, 42, 0.12);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text);
}
.history-limit input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* =====================================================
   ALERTS
===================================================== */
.alert {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 14px;
  display: flex;
  align-items: center;
  border: none;
  backdrop-filter: blur(10px);
}
.alert-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.alert-warning {
  background: rgba(251, 191, 36, 0.15);
  color: #92400e;
  border: 1px solid rgba(217, 119, 6, 0.3);
}

/* =====================================================
   CHARTS
===================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  width: 100%;
  align-items: stretch;
}

.chart-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  height: 320px;
  padding: 18px;
  background: var(--card-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  overflow: hidden;
  transition: all 0.3s ease;
}
.chart-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glass), 0 0 25px rgba(5, 150, 105, 0.12);
  border-color: rgba(5, 150, 105, 0.3);
}

.chart-title {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.chart-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  font-size: 22px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.chart-title > div:last-child { min-width: 0; }
.chart-title h5 { margin: 0; color: var(--text); font-size: 15px; line-height: 1.25; font-weight: 700; }
.chart-title p { margin: 3px 0 0 0; color: var(--text-muted); font-size: 11px; line-height: 1.3; }

.chart-moisture .chart-icon    { color: #0284c7; background: rgba(2, 132, 199, 0.12); }
.chart-soil-temp .chart-icon   { color: #dc2626; background: rgba(220, 38, 38, 0.10); }
.chart-ph .chart-icon          { color: #7c3aed; background: rgba(124, 58, 237, 0.10); }
.chart-nitrogen .chart-icon    { color: #059669; background: rgba(5, 150, 105, 0.12); }
.chart-phosphorus .chart-icon  { color: #d97706; background: rgba(217, 119, 6, 0.12); }
.chart-potassium .chart-icon   { color: #db2777; background: rgba(219, 39, 119, 0.10); }
.chart-air-temp .chart-icon    { color: #ea580c; background: rgba(234, 88, 12, 0.12); }
.chart-humidity .chart-icon    { color: #0891b2; background: rgba(8, 145, 178, 0.12); }

.chart-container {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  height: 0;
  padding: 0;
  margin: 0;
}
.chart-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* =====================================================
   FOOTER
===================================================== */
.dashboard-footer {
  padding: 32px 0 20px 0;
  color: var(--text-light);
  font-size: 12px;
  text-align: center;
  margin-top: 20px;
}

/* =====================================================
   OFFLINE STATE
===================================================== */
.sensor-card.offline-dim {
  opacity: 0.45;
  filter: grayscale(60%);
  transition: opacity 0.4s ease, filter 0.4s ease;
}

.last-update-text { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

/* =====================================================
   PROFILE PAGE
===================================================== */
.profile-card {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  padding: 38px;
}

.profile-photo-wrapper { display: flex; justify-content: center; margin-bottom: 24px; }

.profile-photo {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid rgba(5, 150, 105, 0.4);
  box-shadow:
    0 8px 30px rgba(15, 40, 25, 0.2),
    0 0 0 8px rgba(5, 150, 105, 0.08);
  background: rgba(5, 150, 105, 0.1);
}

.profile-identity { text-align: center; margin-bottom: 32px; }
.profile-identity h2 {
  margin: 0;
  color: var(--text);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.profile-role { margin: 8px 0 0 0; color: var(--text-muted); font-size: 14px; font-weight: 500; }
.profile-role i { color: var(--primary); }

.profile-information {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

.profile-info-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
}
.profile-info-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 8px 20px rgba(15, 40, 25, 0.12);
  border-color: rgba(5, 150, 105, 0.3);
}

.profile-info-icon {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(101, 163, 13, 0.12) 100%);
  color: var(--primary-dark);
  font-size: 19px;
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.profile-info-item span {
  display: block;
  margin-bottom: 2px;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.profile-info-item strong { display: block; color: var(--text); font-size: 14px; font-weight: 600; }

.profile-project { margin-top: 8px; padding-top: 28px; border-top: 1px solid rgba(15, 23, 42, 0.08); }

.profile-project-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-project-header .section-icon { flex: 0 0 48px; width: 48px; height: 48px; }
.profile-project-header h2 { margin: 0; color: var(--text); font-size: 18px; font-weight: 700; }
.profile-project-header p { margin: 4px 0 0 0; color: var(--text-muted); font-size: 13px; }

.profile-project-content {
  padding: 22px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
}
.profile-project-content p {
  margin-bottom: 14px;
  color: #334155;
  font-size: 14px;
  line-height: 1.75;
  text-align: justify;
}

.profile-technologies { margin-top: 28px; padding-top: 25px; border-top: 1px solid rgba(15, 23, 42, 0.08); }
.profile-technologies h3 {
  margin: 0 0 16px 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
}
.profile-technologies h3 i { color: var(--primary); }

.technology-list { display: flex; flex-wrap: wrap; gap: 10px; }
.technology-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.technology-item:hover {
  transform: translateY(-2px);
  border-color: rgba(5, 150, 105, 0.4);
  background: rgba(240, 253, 244, 0.8);
  box-shadow: 0 4px 12px rgba(15, 40, 25, 0.1);
}
.technology-item i { color: var(--primary); font-size: 15px; }

/* =====================================================
   RESPONSIVE - TABLET
===================================================== */
@media (max-width: 1100px) {
  .dashboard-container { padding-left: 22px; padding-right: 22px; }
  .charts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .chart-card { height: 315px; }
  .welcome-banner { grid-template-columns: 1fr; gap: 20px; }
  .welcome-title { font-size: 28px; }
}

/* =====================================================
   RESPONSIVE - MOBILE
===================================================== */
@media (max-width: 767.98px) {
  .dashboard-container { padding: 20px 16px 35px; }

  body { background-attachment: scroll; }

  .navbar-collapse {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    margin: 12px -16px -12px -16px;
    padding: 16px;
    border-top: 1px solid var(--glass-border);
  }
  .main-navbar .navbar-nav { gap: 4px; }
  .main-navbar .nav-item { width: 100%; }
  .main-navbar .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px !important;
    border-radius: 10px;
  }
  .brand-tag { font-size: 10px; }
  .brand-name { font-size: 16px; }

  .welcome-banner { padding: 24px 20px; margin-bottom: 22px; grid-template-columns: 1fr; }
  .welcome-title { font-size: 22px; }
  .welcome-subtitle { font-size: 14px; }
  .status-card { width: 100%; }

  .dashboard-header { flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px; }
  .dashboard-header h1 { font-size: 20px; }

  .sensor-card { min-height: 120px; padding: 16px; padding-left: 20px; gap: 14px; }
  .sensor-icon { flex-basis: 48px; width: 48px; height: 48px; font-size: 22px; }
  .sensor-title { font-size: 11px; }
  .sensor-value { font-size: 22px; margin-bottom: 10px; }

  .dashboard-card { padding: 20px; }
  .section-header { gap: 12px; }
  .section-icon { flex-basis: 42px; width: 42px; height: 42px; font-size: 18px; }
  .section-header h2 { font-size: 16px; }
  .section-header p { font-size: 12px; }

  .action-buttons { flex-direction: column; }
  .action-buttons .btn { width: 100%; justify-content: center; }

  .ai-section p,
  .ai-list li { font-size: 13px; line-height: 1.7; text-align: justify; }

  .history-table-wrapper { max-height: 380px; }
  #historyTable th,
  #historyTable td { padding: 10px 12px; font-size: 12px; }
  .history-controls { align-items: stretch; flex-direction: column; gap: 12px; }
  .history-limit { width: 100%; flex-wrap: wrap; }
  .history-limit input { flex: 1; min-width: 80px; }
  .history-controls > .btn { width: 100%; justify-content: center; }

  .charts-grid { grid-template-columns: 1fr; gap: 16px; }
  .chart-card { width: 100%; height: 310px; min-height: 310px; padding: 16px; }
  .chart-title { min-height: 48px; gap: 10px; }
  .chart-icon { flex-basis: 42px; width: 42px; height: 42px; border-radius: 10px; font-size: 20px; }
  .chart-title h5 { font-size: 14px; }
  .chart-title p { font-size: 11px; }

  .profile-card { padding: 24px 18px; }
  .profile-photo { width: 120px; height: 120px; }
  .profile-identity h2 { font-size: 22px; }
  .profile-information { grid-template-columns: 1fr; gap: 10px; }
  .profile-project-content { padding: 18px; }
  .profile-project-content p { font-size: 13px; text-align: left; }
  .technology-list { gap: 8px; }
  .technology-item { font-size: 12px; padding: 8px 12px; }
}

@media (max-width: 400px) {
  .dashboard-container { padding: 16px 12px 30px; }
  .welcome-banner { padding: 20px 16px; }
  .welcome-title { font-size: 20px; }
  .welcome-badge { font-size: 11px; padding: 5px 10px; }
  .sensor-card { padding: 14px; padding-left: 18px; gap: 12px; min-height: 110px; }
  .sensor-icon { flex-basis: 42px; width: 42px; height: 42px; font-size: 20px; }
  .sensor-title { font-size: 10px; }
  .sensor-value { font-size: 20px; }
  .dashboard-card { padding: 16px; }
  .chart-card { height: 295px; min-height: 295px; }
  .brand-logo { width: 38px; height: 38px; font-size: 18px; }
  .brand-name { font-size: 15px; }
  .brand-tag { font-size: 9px; }
  .navbar-brand { gap: 10px !important; }
  .profile-card { padding: 20px 14px; }
  .profile-photo { width: 100px; height: 100px; }
  .profile-identity h2 { font-size: 19px; }
}

/* =====================================================
   ANIMATIONS
===================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.sensor-card,
.dashboard-card,
.chart-card {
  animation: fadeInUp 0.5s ease-out;
}

.sensor-card:nth-child(2) { animation-delay: 0.05s; }
.sensor-card:nth-child(3) { animation-delay: 0.1s; }
.sensor-card:nth-child(4) { animation-delay: 0.15s; }
.sensor-card:nth-child(5) { animation-delay: 0.2s; }
.sensor-card:nth-child(6) { animation-delay: 0.25s; }

/* =====================================================
   WARNA ANGKA PARAMETER = WARNA IKON SENSOR
===================================================== */
.sensor-value {
  color: var(--accent-color, var(--text));
}

.sensor-title {
  color: var(--accent-color, var(--text-light));
  opacity: 0.75;
}

/* =====================================================
   JUDUL PARAMETER LEBIH TEBAL
===================================================== */
.sensor-title {
  font-weight: 900;          /* 700 = bold, 800 = extra bold */
  letter-spacing: 1px;       /* sedikit renggang biar rapi */
  
}

