:root {
  --bg-base: #07080d;
  --bg-gradient: linear-gradient(135deg, #07080d 0%, #0e111d 100%);
  --panel-bg: rgba(25, 28, 47, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --glow-light: rgba(139, 92, 246, 0.15);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --terminal-bg: rgba(5, 7, 16, 0.8);
  --card-shadow: rgba(0, 0, 0, 0.5);

  --cpu-accent: #8b5cf6; /* Neon Violet */
  --ram-accent: #06b6d4; /* Cyan */
  --net-accent: #10b981; /* Emerald */
  --disk-accent: #f59e0b; /* Amber */
  --error-accent: #ef4444; /* Coral Red */
  
  --font-title: 'Space Grotesk', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

:root[data-theme="light"] {
  --bg-base: #f8fafc;
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
  --panel-bg: rgba(255, 255, 255, 0.65);
  --panel-border: rgba(15, 23, 42, 0.1);
  --glow-light: rgba(139, 92, 246, 0.06);
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --terminal-bg: rgba(241, 245, 249, 0.9);
  --card-shadow: rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Glass Container Layout */
.glass-container {
  width: 100%;
  max-width: 1300px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: 0 20px 50px var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-logo h1 {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(90deg, #fff 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pulse-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
}

.status-live {
  background-color: var(--net-accent);
  box-shadow: 0 0 12px var(--net-accent);
  animation: pulse 1.8s infinite;
}

.status-disconnected {
  background-color: var(--error-accent);
  box-shadow: 0 0 12px var(--error-accent);
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

.server-badge {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-title);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.control-label {
  font-size: 0.9rem;
  color: #94a3b8;
}

/* Glass Inputs / Selects / Buttons */
.glass-select, .glass-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  font-family: var(--font-body);
  outline: none;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.glass-select:focus, .glass-input:focus {
  border-color: var(--cpu-accent);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.glass-select option {
  background: #0f1224;
  color: #fff;
}

.glass-btn {
  background: linear-gradient(90deg, #6d28d9 0%, #8b5cf6 100%);
  border: none;
  color: #fff;
  padding: 0.5rem 1.25rem;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(109, 40, 217, 0.3);
}

.glass-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.4);
}

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

.glass-btn.warning-btn {
  background: linear-gradient(90deg, #d97706 0%, #f59e0b 100%);
  box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}

.glass-btn.warning-btn:hover {
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.4);
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.metric-card {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.5rem;
  overflow: hidden;
  transition: all 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 255, 255, 0.15);
}

.card-glow {
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, var(--glow-light) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.metric-card:hover .card-glow {
  opacity: 1;
}

.card-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.card-content h3 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  letter-spacing: 1px;
  color: #94a3b8;
  width: 100%;
  text-align: left;
}

/* Radial Gauge Styling */
.radial-gauge-container {
  position: relative;
  width: 120px;
  height: 120px;
}

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

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

.gauge-progress {
  fill: none;
  stroke-width: 8px;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-cpu .gauge-progress {
  stroke: var(--cpu-accent);
  filter: drop-shadow(0 0 6px var(--cpu-accent));
}

.card-ram .gauge-progress {
  stroke: var(--ram-accent);
  filter: drop-shadow(0 0 6px var(--ram-accent));
}

.gauge-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 700;
}

.gauge-footer {
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
}

/* Network Stats */
.network-stats-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  padding: 0.5rem 0;
}

.net-direction {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.net-arrow {
  font-size: 1.5rem;
  font-weight: 800;
}

.net-arrow.download { color: var(--net-accent); }
.net-arrow.upload { color: var(--ram-accent); }

.net-detail {
  display: flex;
  flex-direction: column;
}

.net-detail .label {
  font-size: 0.75rem;
  color: #64748b;
}

.net-detail .value {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
}

/* Disk Stats */
.disk-progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
}

.disk-bar-wrapper {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.disk-bar {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
  transition: width 0.8s ease;
}

.disk-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
}

.disk-details .total {
  color: #64748b;
}

/* Dashboard Body (Chart + Processes) */
.dashboard-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .dashboard-body {
    grid-template-columns: 1fr;
  }
}

.chart-container, .process-monitor {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 1.75rem;
  overflow: hidden;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.chart-legend {
  display: flex;
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

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

.svg-chart-wrapper {
  position: relative;
  width: 100%;
  height: 240px;
}

.empty-chart-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #64748b;
  font-size: 0.95rem;
}

/* Table Style */
.process-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.process-table th {
  text-align: left;
  font-family: var(--font-title);
  font-size: 0.8rem;
  letter-spacing: 1px;
  color: #64748b;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.process-table td {
  padding: 0.75rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.process-table tr:last-child td {
  border-bottom: none;
}

.align-right {
  text-align: right;
}

.no-data {
  text-align: center;
  color: #64748b;
  padding: 2rem 0 !important;
}

/* Logs Console Terminal */
.logs-container {
  position: relative;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 1.75rem;
  overflow: hidden;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.logs-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.log-terminal {
  background: var(--terminal-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  height: 300px;
  overflow-y: auto;
  padding: 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.log-line {
  display: block;
  word-break: break-all;
}

.log-line.info { color: #38bdf8; }
.log-line.warning { color: #f59e0b; font-weight: 600; }
.log-line.error { color: #f43f5e; font-weight: 600; }
.log-line.critical { color: #f43f5e; background: rgba(244, 63, 94, 0.1); border-left: 3px solid #f43f5e; padding-left: 0.5rem; font-weight: 700; }
