:root {
  --bg-primary: #080c14;
  --bg-secondary: rgba(13, 20, 35, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  
  /* Cyber Accent Colors */
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.3);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.3);
  --accent-purple: #a855f7;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  line-height: 1.5;
}

/* Background Cyber Glow Decors */
.cyber-glow-1 {
  position: absolute;
  top: -10%;
  left: 10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(40px);
}

.cyber-glow-2 {
  position: absolute;
  bottom: 10%;
  right: 5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-cyan-glow) 0%, rgba(0,0,0,0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(50px);
}

/* AUTHENTICATION SCREEN */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.auth-active {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.auth-active .auth-card {
  transform: translateY(0);
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 25px;
  color: var(--accent-cyan);
}

.logo-icon {
  margin-bottom: 12px;
  filter: drop-shadow(0 0 8px var(--accent-cyan));
  animation: logo-pulse 4s infinite ease-in-out;
}

.auth-card h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.auth-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 30px;
  line-height: 1.6;
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group input {
  width: 100%;
  padding: 16px 20px;
  background: rgba(8, 12, 20, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1.25rem;
  letter-spacing: 4px;
  text-align: center;
  outline: none;
  transition: var(--transition-smooth);
}

.input-group input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.error-msg {
  color: var(--accent-rose);
  font-size: 0.85rem;
  margin-bottom: 20px;
  display: none;
}

.btn-primary {
  width: 100%;
  padding: 15px;
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3);
  transition: var(--transition-smooth);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(6, 182, 212, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

/* MAIN DASHBOARD PANEL LAYOUT */
#dashboard-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 30px;
  transition: opacity 0.5s ease;
}

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dashboard-hidden {
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
  padding: 0 !important;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}

.header-logo h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.header-logo h1 span {
  color: var(--accent-cyan);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status-pill {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.05);
}

.info-pill {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.2);
}

.btn-secondary {
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

/* SYSTEM METRICS ROW */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.metric-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.metric-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  align-self: flex-start;
  margin-bottom: 15px;
}

.gauge-container {
  position: relative;
  width: 140px;
  height: 140px;
}

.gauge {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 8;
}

.gauge-value {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16; /* Initial empty state */
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.cpu-glow {
  stroke: var(--accent-cyan);
  filter: drop-shadow(0 0 6px var(--accent-cyan-glow));
}

.ram-glow {
  stroke: var(--accent-emerald);
  filter: drop-shadow(0 0 6px var(--accent-emerald-glow));
}

.disk-glow {
  stroke: var(--accent-purple);
  filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.3));
}

.gauge-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
}

.gauge-text .number {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -1px;
}

.gauge-text .unit {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-left: 2px;
}

.card-footer {
  margin-top: 15px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* SYSTEM METADATA BLOCK */
.system-meta-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.meta-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-indicator::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online::before {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* PM2 PROCESS TABLE SECTION */
.process-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 30px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.pulse-indicator {
  width: 6px;
  height: 6px;
  background-color: var(--accent-cyan);
  border-radius: 50%;
  animation: blink 2s infinite;
  box-shadow: 0 0 6px var(--accent-cyan);
}

.table-container {
  overflow-x: auto;
}

.process-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.process-table th {
  padding: 16px 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.process-table td {
  padding: 18px 20px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.process-table tbody tr {
  transition: background-color 0.2s ease;
}

.process-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.loading-row {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px !important;
}

/* PULSING BADGES FOR ONLINE/OFFLINE */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-online {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-online::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-emerald);
  animation: pulse-ring 2.5s infinite;
}

.badge-offline {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge-offline::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent-rose);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-rose);
}

.process-name {
  font-weight: 600;
  color: var(--text-primary);
}

.mono-cell {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* BUTTON CONTROLS IN TABLE */
.action-group {
  display: flex;
  gap: 8px;
}

.btn-ctrl {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-restart {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
}

.btn-restart:hover {
  background: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-cyan-glow);
}

.btn-stop {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--accent-rose);
}

.btn-stop:hover {
  background: var(--accent-rose);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-rose-glow);
}

.btn-start {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
}

.btn-start:hover {
  background: var(--accent-emerald);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-emerald-glow);
}

.btn-logs {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-logs:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* DIALOG / MODAL WINDOW LOGS */
.logs-card {
  background: #060913;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 80vh;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-active .logs-card,
.modal-overlay.auth-active + .modal-overlay .logs-card {
  transform: scale(1);
}

#logs-modal.auth-active {
  opacity: 1;
  pointer-events: auto;
}

#logs-modal.auth-active .logs-card {
  transform: scale(1);
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-color);
}

.logs-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.red-dot { background-color: var(--accent-rose); }
.yellow-dot { background-color: #f59e0b; }
.green-dot { background-color: var(--accent-emerald); }

.logs-title h3 {
  margin-left: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close:hover {
  color: var(--text-primary);
}

.terminal-body {
  padding: 20px;
  background: #02040a;
  overflow-y: auto;
  flex-grow: 1;
  min-height: 350px;
}

#terminal-content {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #38bdf8; /* terminal blue */
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

.logs-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255,255,255,0.02);
  border-top: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.btn-refresh-logs {
  padding: 8px 16px;
  background: var(--accent-cyan);
  border: none;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-cyan-glow);
  transition: var(--transition-smooth);
}

.btn-refresh-logs:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(6, 182, 212, 0.4);
}

/* ANIMATIONS & KEYFRAMES */
@keyframes logo-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px var(--accent-cyan-glow)); }
  50% { filter: drop-shadow(0 0 14px rgba(6, 182, 212, 0.6)); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes pulse-ring {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* RESPONSIVENESS */
@media (max-width: 768px) {
  #dashboard-content {
    padding: 20px 10px;
  }
  .main-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .process-table th:nth-child(4),
  .process-table td:nth-child(4),
  .process-table th:nth-child(5),
  .process-table td:nth-child(5) {
    display: none;
  }
  .action-group {
    flex-direction: column;
    gap: 4px;
  }
}

/* PREMIUM TAB SWITCHER BUTTONS */
.tab-container-buttons {
  display: flex;
  background: rgba(8, 12, 20, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-smooth);
  outline: none;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-cyan-glow);
}

.dot-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.online-dot {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 6px var(--accent-emerald);
  animation: pulse-ring 2.5s infinite;
}

.offline-dot {
  background-color: var(--accent-rose);
  box-shadow: 0 0 6px var(--accent-rose);
}
