/* Demo specific styles */
body.dark-mode {
  padding-top: 100px;
  background-color: #060E17; /* Very dark blue/black background */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px; /* Graph paper effect */
}

.demo-navbar {
  background: rgba(6, 14, 23, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.demo-navbar .logo-text {
  color: #FFFFFF;
}
.demo-badge {
  font-size: 0.7rem;
  background: var(--neon-red);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  vertical-align: super;
  margin-left: 0.5rem;
  letter-spacing: 1px;
}
.status-indicator {
  display: flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--neon-green);
}
.pulse-dot {
  width: 10px;
  height: 10px;
  background-color: var(--neon-green);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.5);
  margin-right: 8px;
  box-shadow: 0 0 8px var(--neon-green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Dashboard Layout */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 1rem;
}
.dashboard-header h2 {
  font-size: 1.5rem;
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.time-display {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--c-gray-metallic);
  background: rgba(0,0,0,0.5);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.1);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: auto auto;
  gap: 1.5rem;
  padding-bottom: 4rem;
}

/* Panels */
.panel {
  background: rgba(13, 26, 43, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  backdrop-filter: blur(5px);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}
.scada-panel {
  grid-column: 1 / -1; 
}
@media (min-width: 1024px) {
  .scada-panel {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
  }
  .chart-panel {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
  }
  .log-panel {
    grid-column: 1 / -1;
    grid-row: 2 / 3;
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.75rem;
}
.panel-header h3 {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--c-gray-metallic);
  margin: 0;
}
.badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: bold;
}
.status-running {
  color: var(--neon-green);
  text-shadow: 0 0 5px var(--neon-green);
}
.status-stopped {
  color: var(--neon-red);
  text-shadow: 0 0 5px var(--neon-red);
}
.status-warning {
  color: var(--neon-yellow);
  text-shadow: 0 0 5px var(--neon-yellow);
}

/* SCADA Specifics */
.scada-canvas {
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: wrap; /* Allows wrapping on smaller screens */
  min-height: 250px;
  padding: 1rem;
  background: rgba(0,0,0,0.3);
  border-radius: var(--radius-sm);
  position: relative;
  gap: 20px;
}
.tank-container, .motor-container, .pipe-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.tank {
  width: 80px;
  height: 120px;
  border: 3px solid #555;
  border-top: none;
  border-radius: 0 0 10px 10px;
  position: relative;
  background: rgba(255,255,255,0.05);
  margin-bottom: 1rem;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}
.liquid {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(52, 152, 219, 0.7);
  transition: height 1s ease-in-out;
  border-radius: 0 0 7px 7px;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}
.liquid-chemical {
  background: rgba(155, 89, 182, 0.7);
  box-shadow: 0 0 10px rgba(155, 89, 182, 0.5);
}
.motor {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 3px solid var(--neon-green);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: #222;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.motor.stopped {
  border-color: var(--neon-red);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}
.motor-icon {
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 1.5rem;
  color: #fff;
}
.pipe {
  width: 100px;
  height: 12px;
  background: #444;
  margin-bottom: 1rem;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}
.flow-anim {
  position: absolute;
  top: 0;
  left: -10px;
  width: 30px;
  height: 100%;
  background: rgba(255,255,255,0.3);
  filter: blur(2px);
  animation: flowRight 1s linear infinite;
}
@keyframes flowRight {
  0% { left: -30px; }
  100% { left: 100px; }
}

.scada-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--c-gray-metallic);
  margin-bottom: 0.25rem;
}
.scada-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: #FFF;
  font-weight: bold;
  background: #000;
  padding: 0.2rem 0.5rem;
  border: 1px solid #333;
  border-radius: 4px;
}
.scada-micro-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #888;
  margin-top: 0.5rem;
}

/* Chart */
.chart-container {
  height: 250px;
  width: 100%;
  position: relative;
}

/* Alarm Table */
.table-container {
  overflow-x: auto;
  max-height: 250px;
}
.alarm-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.alarm-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--c-gray-metallic);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.5);
  position: sticky;
  top: 0;
  z-index: 10;
}
.alarm-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #E2E8F0;
}
.row-critical { background: rgba(239, 68, 68, 0.1); }
.row-critical td:first-child { border-left: 3px solid var(--neon-red); }
.row-warning { background: rgba(245, 158, 11, 0.1); }
.row-warning td:first-child { border-left: 3px solid var(--neon-yellow); }
.row-normal td:first-child { border-left: 3px solid var(--neon-green); }

/* Animation for new row insert */
@keyframes highlightRow {
  0% { background-color: rgba(255,255,255,0.2); }
  100% { background-color: transparent; }
}
.new-row {
  animation: highlightRow 2s ease-out;
}

/* Mobile Responsiveness for Demo Dashboard */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .scada-panel, .chart-panel, .log-panel {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }
}
@media (max-width: 768px) {
  .scada-canvas {
    flex-direction: column;
    gap: 30px;
  }
  .tank, .motor, .pipe {
    margin-bottom: 0.5rem;
  }
}
