/* ==========================================================================
   GREEN FARM - Smart Agriculture IoT Dashboard Stylesheet
   Modern, Interactive, Glassmorphism & High-Performance UI
   ========================================================================== */

:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(16, 185, 129, 0.25);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --primary: #10b981;
  --primary-glow: rgba(16, 185, 129, 0.4);
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;

  --glass-blur: blur(16px);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 25px -5px var(--primary-glow);
}

[data-theme="light"] {
  --bg-primary: #f0fdf4;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(16, 185, 129, 0.3);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --shadow-card: 0 10px 25px -5px rgba(16, 185, 129, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.06) 0%, transparent 40%);
  background-attachment: fixed;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism Card Base */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  transform: translateY(-2px);
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.glass-card:hover::before {
  opacity: 1;
}

/* Compass & Wind Rose Widget */
.compass-dial {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
  border: 3px solid rgba(16, 185, 129, 0.3);
  background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, rgba(15, 23, 42, 0.8) 75%);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6), 0 0 15px rgba(16, 185, 129, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.compass-cardinal {
  position: absolute;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  user-select: none;
}

.compass-n { top: 6px; left: 50%; transform: translateX(-50%); color: #ef4444; font-weight: 800; }
.compass-e { right: 8px; top: 50%; transform: translateY(-50%); }
.compass-s { bottom: 6px; left: 50%; transform: translateX(-50%); }
.compass-w { left: 8px; top: 50%; transform: translateY(-50%); }

.compass-needle-wrapper {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-needle {
  position: absolute;
  width: 6px;
  height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.needle-north {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 50px solid #ef4444;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.7));
}

.needle-south {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 50px solid #94a3b8;
}

.compass-center-hub {
  position: absolute;
  width: 22px;
  height: 22px;
  background: #1e293b;
  border: 2px solid #10b981;
  border-radius: 50%;
  z-index: 5;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

/* Anemometer Propeller Animation */
.anemometer-blade {
  transform-origin: center center;
  animation: spin 3s linear infinite;
}

@keyframes spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Soil pH Gradient Spectrum Bar */
.ph-scale-bar {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(
    to right,
    #ef4444 0%,    /* Asam Sangat Kuat (pH 0-3) */
    #f97316 25%,   /* Asam Sedang (pH 4-5) */
    #eab308 40%,   /* Asam Lemah (pH 5.5-6) */
    #10b981 50%,   /* Netral/Optimal (pH 6.5-7.2) */
    #06b6d4 65%,   /* Sedikit Basa (pH 7.5-8) */
    #3b82f6 80%,   /* Basa Kuat (pH 8.5-10) */
    #8b5cf6 100%   /* Sangat Basa (pH > 11) */
  );
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ph-pointer {
  position: absolute;
  top: -6px;
  width: 24px;
  height: 26px;
  transform: translateX(-50%);
  transition: left 0.6s cubic-bezier(0.34, 1.3, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ph-pointer-badge {
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.ph-pointer-triangle {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #ffffff;
}

/* Pulse Beacon */
.pulse-beacon {
  position: relative;
  display: inline-flex;
  width: 10px;
  height: 10px;
}

.pulse-beacon::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #10b981;
  animation: beacon-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.pulse-beacon::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #10b981;
}

.pulse-beacon.warning::before,
.pulse-beacon.warning::after {
  background-color: #f59e0b;
}

.pulse-beacon.offline::before,
.pulse-beacon.offline::after {
  background-color: #ef4444;
  animation: none;
}

@keyframes beacon-ping {
  75%, 100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(16, 185, 129, 0.4);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.7);
}

/* Badge Glow */
.badge-glow {
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

/* Value transition */
.val-transition {
  transition: color 0.4s ease, transform 0.2s ease;
}

.val-transition.updated {
  transform: scale(1.05);
}

/* Modal Backdrop */
.modal-overlay {
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(8px);
}

/* ==========================================================================
   RELAY SWITCHBOARD & FRIENDLY MONITORING STYLES
   ========================================================================== */

/* Modern iOS-Style Toggle Switch */
.relay-toggle-switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 30px;
}

.relay-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.relay-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.relay-slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input:checked + .relay-slider {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #34d399;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

input:checked + .relay-slider:before {
  transform: translateX(24px);
  background-color: #ffffff;
}

/* Equipment Status Animations */
.fan-running {
  animation: spin 1.2s linear infinite;
}

.pump-pulsing {
  animation: pump-pulse 1.8s ease-in-out infinite;
}

@keyframes pump-pulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 2px rgba(59, 130, 246, 0.4));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.9));
  }
}

.mist-animating {
  animation: mist-float 2.5s ease-in-out infinite alternate;
}

@keyframes mist-float {
  0% {
    opacity: 0.6;
    transform: translateY(0);
  }
  100% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* Friendly Status Card Border Glow */
.friendly-card-optimal {
  border-left: 5px solid #10b981 !important;
}

.friendly-card-warning {
  border-left: 5px solid #f59e0b !important;
}

.friendly-card-danger {
  border-left: 5px solid #ef4444 !important;
}

/* Relay Card Active Glow */
.relay-card-active {
  border-color: rgba(16, 185, 129, 0.4) !important;
  background: radial-gradient(circle at 90% 10%, rgba(16, 185, 129, 0.12) 0%, rgba(17, 24, 39, 0.85) 60%) !important;
}

/* Friendly Mini Wind Direction Compass Arrow */
.wind-arrow-compass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 6px rgba(6, 182, 212, 0.5));
}

/* Data Logger Download Button Hover Glow */
.btn-logger-download {
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.2);
  transition: all 0.25s ease;
}

.btn-logger-download:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

/* Logger Table Preview Styles */
.logger-table-wrapper {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: auto;
  border-radius: 0.75rem;
}

.logger-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #0f172a;
  backdrop-filter: blur(8px);
}

[data-theme="light"] .logger-table thead th {
  background-color: #f1f5f9;
}




