@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  /* Color Palette */
  --bg-dark: #070913;
  --bg-card: rgba(17, 22, 43, 0.7);
  --bg-card-hover: rgba(22, 28, 54, 0.85);
  --border-color: rgba(255, 255, 255, 0.07);
  --border-color-active: rgba(6, 182, 212, 0.4);
  
  --color-cyan: #06b6d4;
  --color-emerald: #10b981;
  --color-purple: #a855f7;
  --color-amber: #f59e0b;
  --color-rose: #f43f5e;
  --color-blue: #3b82f6;

  /* Gradients */
  --grad-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  --grad-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --grad-purple: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  --grad-rose: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  --grad-dark: linear-gradient(180deg, #0d1227 0%, #070913 100%);

  /* Glow Effects */
  --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.25);
  --glow-emerald: 0 0 20px rgba(16, 185, 129, 0.25);
  --glow-purple: 0 0 20px rgba(168, 85, 247, 0.25);
  --glow-rose: 0 0 20px rgba(244, 63, 94, 0.25);
  
  /* Text Colors */
  --text-main: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Fonts */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Reset & Global */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 0%, rgba(168, 85, 247, 0.05) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.03) 0px, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Layout container */
.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header styling */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 1.5rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-section h1 {
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.025em;
}

.brand-badge {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--color-cyan);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-pulse {
  width: 8px;
  height: 8px;
  background-color: var(--color-cyan);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(6, 182, 212, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(6, 182, 212, 0);
  }
}

.server-status-pill {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1.25rem;
  border-radius: 12px;
  font-size: 0.875rem;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-label {
  color: var(--text-muted);
}

.status-value {
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Glass Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.3s ease;
}

.metric-card:hover {
  transform: translateY(-5px);
  background: var(--bg-card-hover);
  border-color: var(--border-color-active);
  box-shadow: var(--glow-cyan);
}

.metric-card.cpu:hover {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: var(--glow-cyan);
}
.metric-card.cpu::before {
  background: var(--grad-cyan);
}

.metric-card.ram:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: var(--glow-purple);
}
.metric-card.ram::before {
  background: var(--grad-purple);
}

.metric-card.storage:hover {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: var(--glow-emerald);
}
.metric-card.storage::before {
  background: var(--grad-emerald);
}

.metric-card.network:hover {
  border-color: rgba(244, 63, 94, 0.4);
  box-shadow: var(--glow-rose);
}
.metric-card.network::before {
  background: var(--grad-rose);
}

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

.metric-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  font-size: 1.2rem;
}

.cpu .metric-icon { color: var(--color-cyan); background: rgba(6, 182, 212, 0.1); }
.ram .metric-icon { color: var(--color-purple); background: rgba(168, 85, 247, 0.1); }
.storage .metric-icon { color: var(--color-emerald); background: rgba(16, 185, 129, 0.1); }
.network .metric-icon { color: var(--color-rose); background: rgba(244, 63, 94, 0.1); }

.metric-value-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.metric-number {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.05em;
}

.metric-unit {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 100%;
  border-radius: 9999px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.cpu .progress-bar { background: var(--grad-cyan); }
.ram .progress-bar { background: var(--grad-purple); }
.storage .progress-bar { background: var(--grad-emerald); }
.network .progress-bar { background: var(--grad-rose); }

.metric-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.metric-trend {
  font-weight: 600;
}

.trend-up { color: var(--color-rose); }
.trend-down { color: var(--color-emerald); }
.trend-neutral { color: var(--text-muted); }

/* Main Section Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

/* Base Card Style */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem;
  height: 100%;
  transition: border-color 0.3s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
}

.card-title i {
  color: var(--color-cyan);
}

/* Charts Wrapper */
.chart-container {
  position: relative;
  width: 100%;
  height: 320px;
}

/* Info List Style */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}

.info-item:last-child {
  border: none;
  padding-bottom: 0;
}

.info-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.info-val {
  font-weight: 600;
  font-size: 0.875rem;
  color: #fff;
  text-align: right;
}

/* Dynamic Core Cores Grid */
.cores-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
  gap: 0.5rem;
  margin-top: 1rem;
}

.core-load-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.5rem 0.25rem;
  text-align: center;
  transition: all 0.3s ease;
}

.core-index {
  font-size: 0.65rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.core-load-value {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-cyan);
}

/* Table Area */
.table-card {
  grid-column: span 2;
}

@media (max-width: 1024px) {
  .table-card {
    grid-column: span 1;
  }
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

th {
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  font-family: var(--font-mono);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--color-emerald); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--color-amber); }
.badge-danger { background: rgba(244, 63, 94, 0.15); color: var(--color-rose); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: var(--color-cyan); }

/* Storage Disk Rows */
.disk-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.disk-row:last-child {
  margin-bottom: 0;
}

.disk-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.disk-name {
  font-weight: 600;
}

.disk-usage {
  color: var(--text-secondary);
}

/* Interfaces */
.net-interface-pill {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.net-interface-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.net-interface-name {
  font-weight: 700;
  font-size: 0.875rem;
}

.net-interface-ip {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Footer styling */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-wrap: wrap;
  gap: 1rem;
}

footer a {
  color: var(--color-cyan);
  text-decoration: none;
  font-weight: 600;
}

footer a:hover {
  text-decoration: underline;
}

/* Responsive adjust */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }
  
  header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .server-status-pill {
    width: 100%;
    justify-content: space-between;
  }
}
