/* ─── BASE — Variables, Reset, Layout ─── */
:root {
  --bg:        #080c14;
  --surface:   #0d1117;
  --surface2:  #161b22;
  --border:    #21262d;
  --text:      #e6edf3;
  --muted:     #7d8590;
  --blue:      #388bfd;
  --purple:    #a371f7;
  --green:     #3fb950;
  --orange:    #d29922;
  --teal:      #39d353;
  --red:       #f85149;
  --pink:      #f778ba;

  /* RGB triplets for rgba() usage: rgba(var(--blue-rgb), 0.12) */
  --blue-rgb:    56,139,253;
  --purple-rgb:  163,113,247;
  --green-rgb:   63,185,80;
  --orange-rgb:  210,153,34;
  --teal-rgb:    57,211,83;
  --red-rgb:     248,81,73;
  --pink-rgb:    247,120,186;
  --text-rgb:    230,237,243;
  --muted-rgb:   125,133,144;
}

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

/* ─── FOCUS VISIBLE ─── */
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

/* ─── ANIMATED BACKGROUND ─── */
body::before {
  content: '';
  position: fixed;
  inset: -100px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 800px at 10% 20%, rgba(56,139,253,0.25), transparent 70%),
    radial-gradient(ellipse 700px 700px at 90% 80%, rgba(163,113,247,0.22), transparent 70%),
    radial-gradient(ellipse 600px 600px at 50% 50%, rgba(63,185,80,0.12), transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 10%, rgba(247,120,186,0.15), transparent 70%),
    radial-gradient(ellipse 650px 650px at 20% 90%, rgba(56,139,253,0.18), transparent 70%);
  animation: bgDrift 30s ease-in-out infinite alternate;
}

body::after {
  content: '';
  position: fixed;
  inset: -100px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 700px 700px at 70% 30%, rgba(163,113,247,0.20), transparent 70%),
    radial-gradient(ellipse 800px 800px at 30% 70%, rgba(56,139,253,0.18), transparent 70%),
    radial-gradient(ellipse 500px 500px at 60% 90%, rgba(210,153,34,0.12), transparent 70%);
  animation: bgDrift2 25s ease-in-out infinite alternate;
}

@keyframes bgDrift {
  0%   { transform: translate(0, 0) scale(1); }
  25%  { transform: translate(60px, -40px) scale(1.08); }
  50%  { transform: translate(-40px, 60px) scale(1.04); }
  75%  { transform: translate(30px, 30px) scale(1.1); }
  100% { transform: translate(-50px, -30px) scale(1.06); }
}

@keyframes bgDrift2 {
  0%   { transform: translate(0, 0) scale(1.05); }
  33%  { transform: translate(-60px, 40px) scale(1); }
  66%  { transform: translate(40px, -50px) scale(1.08); }
  100% { transform: translate(20px, 60px) scale(1.03); }
}

.header, .status-bar, .main, .footer { position: relative; z-index: 1; }

/* ─── HEADER ─── */
.header {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 40%, #1a1f2e 100%);
  border-bottom: 1px solid var(--border);
  padding: 22px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.logo {
  width: 100px; height: 100px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: #ffffff !important;
  border-radius: 12px;
}
.logo img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.header-title h1 {
  font-size: 20px; font-weight: 700;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-title p { font-size: 12px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.5px; }

#clock {
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--surface2); padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
}

/* ─── STATUS BAR ─── */
.status-bar {
  background: var(--surface2); border-bottom: 1px solid var(--border);
  padding: 10px 40px; display: flex; align-items: center; gap: 32px; font-size: 12px;
}

.status-bar-label { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; font-size: 11px; }

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

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); transition: background 0.4s, box-shadow 0.4s; flex-shrink: 0;
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 8px rgba(63,185,80,0.6); animation: pulse-dot 2s infinite; }
.status-dot.offline { background: var(--red); }

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px rgba(63,185,80,0.6); }
  50%       { box-shadow: 0 0 14px rgba(63,185,80,0.9); }
}

.status-name { color: var(--text); font-weight: 500; }
.status-port { color: var(--muted); font-size: 11px; }

/* ─── MAIN ─── */
.main { max-width: 1400px; margin: 0 auto; padding: 36px 40px; }

.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.section-header h2 { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; }
.section-header h2.section-toggle { cursor: pointer; user-select: none; }
.section-header h2.section-toggle:hover { color: var(--text); }
.section-line { flex: 1; height: 1px; background: var(--border); }
.s-chevron { display: inline-block; transition: transform .2s; font-size: 14px; margin-right: 4px; }

/* ─── STATS ─── */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 48px;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 24px; display: flex; flex-direction: column; gap: 6px;
}

.stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }
.stat-value { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--muted); }

/* ─── GRID ─── */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px; margin-bottom: 48px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* ─── INFO ROWS ─── */
.info-rows { display: flex; flex-direction: column; gap: 8px; }

.info-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; padding: 8px 12px;
  background: var(--surface2); border-radius: 8px; border: 1px solid var(--border);
  gap: 8px;
}

.info-row-label { color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.info-row-value { color: var(--text); font-family: monospace; font-size: 11.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── SERVER STATUS IN CARD ─── */
.server-status-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--surface2); border-radius: 8px;
  border: 1px solid var(--border); font-size: 12px;
}

.server-status-left { display: flex; align-items: center; gap: 8px; }
.server-status-text { color: var(--text); font-weight: 500; font-family: monospace; font-size: 11.5px; }

/* ─── BUTTONS ─── */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text);
  transition: all 0.15s; white-space: nowrap; text-decoration: none;
  user-select: none;
}
.btn:hover { background: #21262d; border-color: #388bfd40; transform: translateY(-1px); }

.btn-primary { background: linear-gradient(135deg, var(--blue), #1f6feb); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #4f9fff, var(--blue)); box-shadow: 0 4px 12px rgba(56,139,253,0.3); }

.btn-green  { background: rgba(63,185,80,0.15);   border-color: rgba(63,185,80,0.4);   color: var(--green); }
.btn-green:hover  { background: rgba(63,185,80,0.25);  box-shadow: 0 4px 12px rgba(63,185,80,0.2); }

.btn-purple { background: rgba(163,113,247,0.15); border-color: rgba(163,113,247,0.4); color: var(--purple); }
.btn-purple:hover { background: rgba(163,113,247,0.25); box-shadow: 0 4px 12px rgba(163,113,247,0.2); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ─── CMD BOX ─── */
.cmd-box {
  background: #0d1117; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-family: monospace; font-size: 11.5px; color: #7ee787;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer; transition: border-color 0.15s; word-break: break-all;
}
.cmd-box:hover { border-color: #388bfd40; }
.cmd-copy-icon { flex-shrink: 0; opacity: 0.5; }

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; padding: 10px 18px; border-radius: 10px;
  z-index: 999; opacity: 0; transition: opacity 0.2s, transform 0.2s;
  transform: translateY(8px); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(63,185,80,0.4); color: var(--green); }
.toast.error   { border-color: rgba(248,81,73,0.4);  color: var(--red); }

/* ─── FOOTER ─── */
.footer {
  border-top: 1px solid var(--border); padding: 20px 40px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .header, .status-bar, .main, .footer { padding-left: 20px; padding-right: 20px; }
  .grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 3px; }

/* ─── RETRO FLOATING PARTICLES ─── */
.retro-particle {
  position: fixed;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  font-family: 'Courier New', monospace;
  image-rendering: pixelated;
  animation: retroFloat linear forwards;
}
@keyframes retroFloat {
  0%   { opacity: 0; transform: translateY(0) translateX(0) rotate(0deg); }
  8%   { opacity: 0.6; }
  50%  { opacity: 0.45; }
  92%  { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-110vh) translateX(var(--sway)) rotate(var(--spin)); }
}

/* ─── BACK TO TOP ─── */
#back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 50;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(56,139,253,0.15);
  border: 1px solid rgba(56,139,253,0.3);
  color: var(--blue);
  font-size: 20px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.2s, transform 0.2s, opacity 0.3s;
  opacity: 0;
}
#back-to-top.visible { display: flex; opacity: 0.8; }
#back-to-top:hover { background: rgba(56,139,253,0.3); transform: translateY(-2px); opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }
