/* ═══════════════════════════════════════════════════════
   VPS Control Center — Enterprise Dashboard Styles
   ═══════════════════════════════════════════════════════ */
:root {
  --bg-primary: #06080f;
  --bg-secondary: #0c1021;
  --bg-card: rgba(15, 20, 40, 0.75);
  --bg-card-hover: rgba(20, 28, 55, 0.85);
  --border: rgba(99, 102, 241, 0.15);
  --border-hover: rgba(99, 102, 241, 0.35);
  --text-primary: #e8ecf4;
  --text-secondary: #7b86a2;
  --text-dim: #4a5270;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.25);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.15);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245, 158, 11, 0.15);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.15);
  --cyan: #06b6d4;
  --purple: #a855f7;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
}

/* ═══════════════════ HEADER ═══════════════════ */
#dashboard-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px;
  background: rgba(10, 14, 26, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 16px; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.logo-text h1 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; background: linear-gradient(135deg, #fff, #94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.logo-sub { font-size: 0.7rem; color: var(--text-dim); font-weight: 500; letter-spacing: 0.15em; text-transform: uppercase; }
.header-right { display: flex; align-items: center; gap: 20px; }
.connection-status { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-secondary); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse-dot 2s infinite; }
.status-dot.offline { background: var(--red); }
.status-dot.connecting { background: var(--yellow); animation: pulse-dot 1s infinite; }
.last-update { font-size: 0.8rem; color: var(--text-dim); display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ═══════════════════ SECTIONS ═══════════════════ */
.section { padding: 0 28px; margin-top: 20px; }

/* ═══════════════════ SERVER OVERVIEW ═══════════════════ */
.overview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  backdrop-filter: blur(12px);
  transition: var(--transition);
  cursor: pointer;
}
.server-card:hover, .server-card.active {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}
.server-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.server-identity { display: flex; align-items: center; gap: 10px; }
.server-identity h2 { font-size: 1.1rem; font-weight: 700; }
.server-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.server-status-dot.online { background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse-dot 2s infinite; }
.server-status-dot.offline { background: var(--text-dim); }
.server-status-dot.error { background: var(--red); box-shadow: 0 0 10px var(--red); }
.server-ip { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); background: rgba(255,255,255,0.04); padding: 4px 10px; border-radius: 6px; }

/* Gauges */
.server-card-gauges { display: flex; gap: 16px; justify-content: center; margin-bottom: 16px; }
.mini-gauge { position: relative; width: 90px; text-align: center; }
.mini-gauge svg { width: 72px; height: 72px; transform: rotate(-90deg); }
.mini-gauge .gauge-bg { fill: none; stroke: rgba(255,255,255,0.06); stroke-width: 7; }
.mini-gauge .gauge-fill {
  fill: none; stroke: var(--green); stroke-width: 7;
  stroke-linecap: round; transition: stroke-dashoffset 0.8s ease, stroke 0.5s ease;
}
.mini-gauge .gauge-fill.warn { stroke: var(--yellow); }
.mini-gauge .gauge-fill.danger { stroke: var(--red); }
.gauge-center {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center; gap: 1px;
}
.gauge-value { font-size: 1.15rem; font-weight: 700; font-family: var(--font-mono); }
.gauge-unit { font-size: 0.65rem; color: var(--text-secondary); margin-top: 2px; }
.gauge-label { display: block; font-size: 0.65rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 2px; }

/* Meta */
.server-card-meta { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.meta-item { font-size: 0.75rem; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.meta-item i { color: var(--accent); font-size: 0.7rem; }

/* ═══════════════════ TAB NAV ═══════════════════ */
#server-tabs { display: flex; gap: 8px; margin-top: 24px; }
.tab-btn {
  padding: 10px 24px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.85rem;
  transition: var(--transition); display: flex; align-items: center; gap: 8px;
}
.tab-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.tab-btn.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(6,182,212,0.1));
  border-color: var(--accent); color: #fff;
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ═══════════════════ DETAIL CONTENT ═══════════════════ */
#detail-content { padding: 0 28px 28px; }
.detail-section { margin-top: 20px; }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; display: flex; align-items: center; gap: 14px;
  transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.stat-icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(99,102,241,0.05));
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--accent); flex-shrink: 0;
}
.stat-icon.download { background: linear-gradient(135deg, rgba(34,197,94,0.2), rgba(34,197,94,0.05)); color: var(--green); }
.stat-icon.upload { background: linear-gradient(135deg, rgba(168,85,247,0.2), rgba(168,85,247,0.05)); color: var(--purple); }
.stat-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label { font-size: 0.7rem; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.05rem; font-weight: 700; font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Charts */
.charts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.chart-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.chart-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.chart-header h3 { font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.chart-header h3 i { color: var(--accent); }
.chart-live-badge {
  font-size: 0.6rem; font-weight: 700; color: var(--green); letter-spacing: 0.1em;
  display: flex; align-items: center; gap: 5px;
}
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse-dot 1.5s infinite; }
.chart-body { padding: 12px 14px; height: 200px; }
.chart-body canvas { width: 100% !important; height: 100% !important; }

/* Panels */
.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.panel-header h3 i { color: var(--accent); }
.badge {
  background: rgba(99,102,241,0.15); color: var(--accent); font-size: 0.7rem;
  font-weight: 700; padding: 2px 10px; border-radius: 20px; font-family: var(--font-mono);
}
.panel-body { padding: 14px 18px; }
.panel-body.scrollable { max-height: 260px; overflow-y: auto; }
.panel-body.table-scroll { padding: 0; max-height: 350px; overflow-y: auto; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
thead { position: sticky; top: 0; z-index: 1; }
th {
  text-align: left; padding: 10px 14px;
  background: rgba(15, 20, 40, 0.95); color: var(--text-dim);
  font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}
td { padding: 8px 14px; border-bottom: 1px solid rgba(255,255,255,0.03); font-family: var(--font-mono); font-size: 0.78rem; }
tr:hover td { background: rgba(99,102,241,0.04); }
.cpu-bar {
  height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06);
  overflow: hidden; margin-top: 3px; width: 60px;
}
.cpu-bar-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

/* Infra Grid */
.infra-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.security-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

/* Services List */
.service-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.8rem;
}
.service-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* Docker */
.docker-item {
  padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
}
.docker-name { font-weight: 600; font-size: 0.85rem; margin-bottom: 3px; }
.docker-meta { font-size: 0.72rem; color: var(--text-dim); font-family: var(--font-mono); }
.docker-status { color: var(--green); }

/* Security */
.security-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.security-label { font-size: 0.8rem; color: var(--text-secondary); }
.security-value { font-size: 0.8rem; font-family: var(--font-mono); font-weight: 600; }
.login-list { margin-top: 8px; }
.login-item { font-size: 0.75rem; font-family: var(--font-mono); color: var(--text-secondary); padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.02); word-break: break-all; }

/* Sysinfo */
.sysinfo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.sysinfo-item { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.sysinfo-label { font-size: 0.7rem; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.sysinfo-value { font-size: 0.82rem; font-family: var(--font-mono); color: var(--text-primary); word-break: break-all; }

/* ═══════════════════ FOOTER ═══════════════════ */
#dashboard-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px; margin-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem; color: var(--text-dim);
}

/* ═══════════════════ SCROLLBAR ═══════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(99,102,241,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(99,102,241,0.4); }

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .infra-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .overview-grid { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .infra-grid { grid-template-columns: 1fr; }
  .security-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr; }
  #dashboard-header { flex-direction: column; gap: 10px; }
  .server-card-gauges { flex-wrap: wrap; }
}

/* ═══════════════════ ANIMATIONS ═══════════════════ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.detail-section { animation: fadeIn 0.4s ease; }

/* No data state */
.no-data { text-align: center; padding: 30px; color: var(--text-dim); font-size: 0.85rem; }
