@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* ---------- GLOBAL ---------- */
body {
  font-family: 'Poppins', sans-serif;
  background: #0f172a;
  margin: 0;
  padding: 0;
  color: #e2e8f0;
}

* {
  box-sizing: border-box;
  transition: all 0.25s ease;
}

/* ---------- NAVBAR ---------- */
/* ===========================
   🌊 SCADA HEADER STYLE
   =========================== */
.top-nav {
    display: flex;
    justify-content: space-between; /* judul kiri, LIVE kanan */
    align-items: center;
    background: linear-gradient(90deg, #142850, #1e2a47);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 1px solid #1e293b;
    margin-bottom: 1rem;
    position: sticky; /* tetap terlihat saat scroll */
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #f1f5f9;
    letter-spacing: 0.5px;
    margin: 0;
}
/* ===========================
   🌊 ANIMASI EMOJI GELombang
   =========================== */
.wave-emoji {
    display: inline-block;
    animation: waveUpDown 1.5s ease-in-out infinite;
    margin-right: 0.6rem;
}

/* Gerakan naik-turun */
@keyframes waveUpDown {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px); /* naik sedikit */
    }
}
/* ===========================
   🟢 LIVE STATUS INDICATOR
   =========================== */
.status-live {
    position: absolute;
    right: 2rem;  /* pojok kanan */
    top: 50%;
    transform: translateY(-50%); /* tengah secara vertikal */
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    background: rgba(20, 255, 100, 0.1);
    border-radius: 12px;
    border: 1px solid rgb(0, 255, 119);
    box-shadow: inset 0 0 6px rgb(0, 255, 102);
    transition: all 0.3s ease;
}

.status-live:hover {
    background: rgba(20, 255, 100, 0.2);
    box-shadow: 0 0 12px rgba(0, 255, 102, 0.6);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 6px #22c55e;
    animation: pulse 1s infinite;
}

.live-text {
    font-size: 1rem;
    font-weight: 600;
    color: #22c55e;
    letter-spacing: 1px;
}

/* animasi berdenyut */
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}


/* Responsif */
@media (max-width: 600px) {
    .nav-title {
        font-size: 1rem;
    }
    .status-live {
        padding: 0.2rem 0.4rem;
    }
}


/* ---------- LAYOUT ---------- */
.layout-container {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  flex: 0 0 22%;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
  height: fit-content;
  position: sticky;
  top: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar h4 {
  color: #f8fafc;
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.sidebar small, .sidebar div {
  color: #94a3b8;
  font-size: 0.9rem;
}
footer {
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
  background-color: #0f172a;
  width: 100%;
  padding: 12px 0;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---------- SENSOR CARDS GRID ---------- */
.sensors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ---------- CARD ---------- */
.scada-card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  text-align: center;
  color: #f1f5f9;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  align-items: center;
  gap: 1rem;
}

.scada-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scada-card:hover::before {
  opacity: 1;
}

.scada-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.2);
}

.scada-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #cbd5e1;
  margin: 0 0 1.2rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- GAUGE ---------- */
.circular-gauge {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(from 180deg at 50% 50%, #3b82f6 0deg, #8b5cf6 180deg, #ec4899 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.25);
  flex-shrink: 0;
}

.circular-gauge::before {
  content: '';
  position: absolute;
  width: 115px;
  height: 115px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1e293b, #0f172a);
}

.gauge-content {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.gauge-value {
  font-size: 2rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1;
  letter-spacing: -1px;
  font-family: 'Poppins', sans-serif;
}

.gauge-unit {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------- PROGRESS BAR (untuk Flow Meter) ---------- */
.flow-progress-container {
  width: 100%;
  margin-top: 0.8rem;
}

.flow-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
}

.flow-stats span {
  letter-spacing: 0.5px;
}

.flow-current {
  color: #3b82f6;
  font-weight: 600;
}

.flow-max {
  color: #64748b;
}

.progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: #0f172a;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 10px;
  transition: width 0.6s ease;
  position: relative;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}
/* ===============================
   Vertical Tank Bar
   =============================== */
.tank-bar-container {
    position: relative;
    width: 80px;
    height: 200px;
    border-radius: 40px;
    background: linear-gradient(to bottom, #1e293b, #0f172a);
    overflow: hidden;
    border: 2px solid #334155;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
}

.tank-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    border-radius: 40px 40px 0 0;
    background: linear-gradient(to top, #14b8a6, #99f6e4);
    transition: height 0.6s ease-in-out;
}

.tank-label-text {
    margin-top: 10px;
    font-size: 1rem;
    color: #93c5fd;
    font-weight: 500;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-percentage {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-top: 0.4rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ---------- STATUS BADGE ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  border-radius: 25px;
  font-weight: 600;
  font-size: 0.75rem;
  color: white;
  margin: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 100px;
}
.trend-section {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid #334155;
}

.trend-section h2 {
    color: #bfdbfe;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.25rem;
    align-items: stretch; /* ✅ semua kartu punya tinggi sama */
}

.trend-chart-card {
    background: rgba(30, 41, 59, 0.85);
    border-radius: 12px;
    padding: 0.8rem 1rem 1rem 1rem;
    border: 1px solid #334155;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    height: 100%;
    box-shadow: inset 0 0 4px rgba(51, 65, 85, 0.3);
}

.trend-chart-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 4px 14px rgba(96, 165, 250, 0.25);
}

.chart-title {
    color: #93c5fd;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    text-align: center;
}

/* 🔹 Batas tinggi grafik dan pastikan proporsional */
.trend-chart-card canvas,
.trend-chart-card svg {
    width: 100% !important;
    height: 190px !important; /* ✅ tinggi konsisten */
    max-height: 220px;
    border-radius: 8px;
}

/* 🔹 Biar grid lebih adaptif di layar kecil */
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .trend-chart-card canvas,
    .trend-chart-card svg {
        height: 200px !important;
        margin-bottom: -10px;
    }
}

.status-badge.normal {
  background: linear-gradient(135deg, #10b981, #059669);
}

.status-badge.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.status-badge.danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.status-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- TREND CHART ---------- */
.trend-card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  margin-bottom: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.trend-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.trend-card h3 {
  color: #f8fafc;
  font-weight: 600;
  margin-bottom: 1.5rem;
  font-size: 1.3rem;
  letter-spacing: -0.5px;
}

.trend-card .js-plotly-plot {
  height: 400px !important;
  max-height: 400px;
}

/* ---------- MODAL (Dark Theme) ---------- */
.modal-content {
  background: linear-gradient(145deg, #0f172a, #111827);
  color: #e2e8f0;
  border: 1px solid #1e293b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.modal-header,
.modal-footer {
  border-color: #1e293b;
  background: transparent;
}

.modal-title {
  color: #bfdbfe;
}

.modal-body {
  color: #cbd5e1;
}

.modal-footer .btn {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
}

.modal-footer .btn:hover {
  background: #1e3a8a;
  border-color: #1e3a8a;
  color: #e5edff;
}

/* ---------- MAP ---------- */
.leaflet-container {
  border-radius: 16px;
  filter: brightness(0.9) contrast(1.05);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #0f172a;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #475569, #334155);
  border-radius: 10px;
  border: 2px solid #0f172a;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #64748b, #475569);
}

/* =====================================
   🌐 RESPONSIVE SCADA DASHBOARD CSS
   ===================================== */

/* ---------- BASE DESKTOP (≥1200px) ---------- */
@media (min-width: 1200px) {
  .layout-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
  }

  .sidebar {
    flex: 0 0 22%;
    height: fit-content;
  }

  .sensors-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .scada-card {
    min-height: 320px;
    padding: 2rem 1.5rem;
  }

  .circular-gauge {
    width: 140px;
    height: 140px;
  }
}

/* ---------- TABLET (≤1200px) ---------- */
@media (max-width: 1200px) {
  .layout-container {
    flex-direction: column;
    gap: 1.5rem;
  }

  .sidebar {
    width: 100%;
    position: relative;
    top: 0;
    border-radius: 16px;
  }

  .sensors-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
  }

  .scada-card {
    min-height: 280px;
    padding: 1.5rem;
  }

  .scada-card h3 {
    font-size: 0.9rem;
    min-height: 30px;
  }

  .circular-gauge {
    width: 130px;
    height: 130px;
  }

  .trend-chart-card canvas,
  .trend-chart-card svg {
    height: 210px !important;
  }
}

/* ---------- MOBILE (≤768px) ---------- */
@media (max-width: 768px) {
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.2rem;
  }

  .nav-title {
    font-size: 1.3rem;
    font-weight: 700;
  }

  .status-live {
    padding: 0.2rem 0.5rem;
    gap: 0.3rem;
  }

  .layout-container {
    flex-direction: column;
    gap: 1rem;
  }

  .sidebar {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: none;
  }

  .sensors-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .scada-card {
    padding: 1.2rem;
    min-height: 260px;
    gap: 0.8rem;
  }

  .scada-card h3 {
    font-size: 0.85rem;
    text-align: center;
  }

  .circular-gauge {
    width: 120px;
    height: 120px;
  }

  .gauge-value {
    font-size: 1.6rem;
  }

  .gauge-unit {
    font-size: 0.7rem;
  }

  .flow-progress-container {
    margin-top: 0.5rem;
  }

  .trend-section {
    padding: 1rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .trend-chart-card canvas,
  .trend-chart-card svg {
    height: 200px !important;
  }

  .status-badge {
    font-size: 0.7rem;
    padding: 0.4rem 1rem;
    min-width: 80px;
  }
}

/* ---------- SMALL MOBILE (≤480px) ---------- */
@media (max-width: 480px) {
  .nav-title {
    font-size: 1.1rem;
  }

  .scada-card {
    min-height: 240px;
    padding: 1rem;
  }

  .circular-gauge {
    width: 100px;
    height: 100px;
  }

  .gauge-value {
    font-size: 1.4rem;
  }

  .flow-stats {
    font-size: 0.6rem;
  }

  .trend-chart-card canvas,
  .trend-chart-card svg {
    height: 180px !important;
  }
}
