/* ═══════════════════════════════════════════════════════
   Vanilla Alby — Control Panel Stylesheet
   ═══════════════════════════════════════════════════════ */

/* ── CSS Custom Properties (Light — default) ───────── */
:root {
  /* Surfaces */
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f9fb;
  --bg-elevated: #ffffff;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  /* Accent */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.1);
  --accent-glow: rgba(99, 102, 241, 0.25);

  /* Status */
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --yellow: #f59e0b;
  --yellow-soft: rgba(245, 158, 11, 0.12);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --cyan: #06b6d4;
  --purple: #a855f7;

  /* Borders */
  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(15, 23, 42, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 20px var(--accent-glow);

  /* Console */
  --console-bg: #0c0e14;
  --console-text: #c8d6e5;
  --console-border: rgba(255,255,255,0.06);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Dark Theme ──────────────────────────────────────── */
[data-theme="dark"] {
  --bg-primary: #0a0c10;
  --bg-secondary: #12151c;
  --bg-tertiary: #181c25;
  --bg-elevated: #1a1e28;

  --text-primary: #e8ecf2;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-soft: rgba(129, 140, 248, 0.12);
  --accent-glow: rgba(129, 140, 248, 0.2);

  --green-soft: rgba(34, 197, 94, 0.15);
  --red-soft: rgba(239, 68, 68, 0.15);
  --yellow-soft: rgba(245, 158, 11, 0.15);
  --blue-soft: rgba(59, 130, 246, 0.15);

  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.35);

  --console-bg: #080a0e;
  --console-border: rgba(255,255,255,0.04);
}

/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100%;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* Control Buttons */
.btn-start {
  background: var(--green);
  color: white;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
.btn-start:hover {
  background: #16a34a;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
  transform: translateY(-1px);
}

.btn-stop {
  background: var(--red);
  color: white;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.btn-stop:hover {
  background: #dc2626;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-restart {
  background: var(--yellow);
  color: #451a03;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-restart:hover {
  background: #d97706;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.btn-kill {
  background: #1a0505;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}
.btn-kill:hover {
  background: #7f1d1d;
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-send:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background:
    radial-gradient(ellipse at 50% 0%, var(--accent-soft) 0%, transparent 60%),
    var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeInUp 0.5s ease-out;
}

.login-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 20px;
}

.login-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.input-group {
  position: relative;
  margin-bottom: 16px;
}
.input-group svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-group input {
  width: 100%;
  padding: 13px 14px 13px 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  transition: all var(--transition);
  outline: none;
}
.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--bg-elevated);
}
.input-group input::placeholder {
  color: var(--text-muted);
}

.login-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 16px;
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
  animation: shake 0.4s ease-in-out;
}

/* ═══════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════ */
.dashboard {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}
.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.server-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.server-status-badge.online {
  background: var(--green-soft);
  color: var(--green);
}
.server-status-badge.offline {
  background: var(--red-soft);
  color: var(--red);
}
.server-status-badge.starting,
.server-status-badge.restarting {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}
.server-status-badge.online .status-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  animation: pulse-ring 2s infinite;
}

/* ── Main Content ────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 24px 28px 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* ── Stats Grid ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: all var(--transition);
  animation: fadeInUp 0.5s ease-out both;
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
}
.stat-icon.cpu { background: var(--blue-soft); color: var(--blue); }
.stat-icon.ram { background: var(--green-soft); color: var(--green); }
.stat-icon.tps { background: rgba(168, 85, 247, 0.12); color: var(--purple); }
.stat-icon.players { background: rgba(6, 182, 212, 0.12); color: var(--cyan); }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 14px;
}
.stat-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 2px;
}

.stat-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 8px;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}
.cpu-bar { background: linear-gradient(90deg, var(--blue), #6366f1); }
.ram-bar { background: linear-gradient(90deg, var(--green), #06b6d4); }
.tps-bar { background: linear-gradient(90deg, var(--purple), #ec4899); }
.players-bar { background: linear-gradient(90deg, var(--cyan), var(--blue)); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Controls ────────────────────────────────────────── */
.controls-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.5s ease-out 0.25s both;
}

/* ── Console ─────────────────────────────────────────── */
.console-wrapper {
  background: var(--console-bg);
  border: 1px solid var(--console-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.5s ease-out 0.3s both;
}

.console-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--console-border);
}
.console-dots {
  display: flex;
  gap: 7px;
}
.console-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.console-dots .dot.red { background: #ff5f57; }
.console-dots .dot.yellow { background: #febc2e; }
.console-dots .dot.green { background: #28c840; }
.console-title {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.4);
}
.btn-clear {
  border-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.35);
}
.btn-clear:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-soft);
}

.console-output {
  height: 420px;
  overflow-y: auto;
  padding: 16px;
  font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.65;
  color: var(--console-text);
  white-space: pre-wrap;
  word-break: break-all;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.console-output::-webkit-scrollbar {
  width: 6px;
}
.console-output::-webkit-scrollbar-track {
  background: transparent;
}
.console-output::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 100px;
}

.console-output .line {
  padding: 1px 0;
}

.cmd-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--console-border);
  background: rgba(255,255,255,0.02);
}
.cmd-prompt {
  color: var(--accent);
  font-family: 'Consolas', monospace;
  font-size: 15px;
  font-weight: 700;
  user-select: none;
}
.cmd-form input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  color: var(--console-text);
  font-family: 'Consolas', monospace;
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
}
.cmd-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: rgba(255,255,255,0.06);
}
.cmd-form input::placeholder {
  color: rgba(255,255,255,0.2);
}

/* ═══════════════════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════════════════ */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}
.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 48px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
#overlayText {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════
   ANSI COLOR CLASSES
   ═══════════════════════════════════════════════════════ */
.ansi-black   { color: #4e545c; }
.ansi-red     { color: #ff6b6b; }
.ansi-green   { color: #69db7c; }
.ansi-yellow  { color: #ffd43b; }
.ansi-blue    { color: #74c0fc; }
.ansi-magenta { color: #da77f2; }
.ansi-cyan    { color: #66d9e8; }
.ansi-white   { color: #dee2e6; }

.ansi-bright-black   { color: #868e96; }
.ansi-bright-red     { color: #ffa8a8; }
.ansi-bright-green   { color: #b2f2bb; }
.ansi-bright-yellow  { color: #ffec99; }
.ansi-bright-blue    { color: #a5d8ff; }
.ansi-bright-magenta { color: #eebefa; }
.ansi-bright-cyan    { color: #99e9f2; }
.ansi-bright-white   { color: #f8f9fa; }

.ansi-bold   { font-weight: 700; }
.ansi-dim    { opacity: 0.6; }
.ansi-italic { font-style: italic; }
.ansi-underline { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

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

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.3; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 12px 16px;
  }
  .main-content {
    padding: 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat-value {
    font-size: 22px;
  }
  .controls-row {
    flex-wrap: wrap;
  }
  .controls-row .btn {
    flex: 1;
    justify-content: center;
    min-width: 100px;
  }
  .console-output {
    height: 320px;
    font-size: 12px;
  }
  .logo-text {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .topbar-right span {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════
   THEME TRANSITION
   ═══════════════════════════════════════════════════════ */
.login-card,
.topbar,
.stat-card,
.console-wrapper,
.overlay-content,
.btn-icon,
.btn-ghost,
.server-status-badge,
.input-group input {
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition);
}

/* Theme icon transition */
.theme-icon {
  transition: transform 0.3s ease, opacity 0.3s ease;
}
