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

:root {
  --black: #0a0a0a;
  --white: #ffffff;
  --yellow: #FFE135;
  --blue: #4361EE;
  --red: #EF233C;
  --green: #06D6A0;
  --gray: #f0f0f0;
  --border: 3px solid #0a0a0a;
  --shadow: 5px 5px 0px #0a0a0a;
  --shadow-sm: 3px 3px 0px #0a0a0a;
  --radius: 0px;
  --font-main: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background: var(--gray);
  color: var(--black);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--gray); }
::-webkit-scrollbar-thumb { background: var(--black); border: 2px solid var(--gray); }

/* ─── TYPOGRAPHY ─── */
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; line-height: 1.1; }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p  { font-size: 0.95rem; line-height: 1.6; }

/* ─── LAYOUT ─── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--black);
  color: var(--white);
  display: flex;
  flex-direction: column;
  border-right: var(--border);
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transform: translateX(0);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}
.sidebar.closed { transform: translateX(-100%); }

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 3px solid #222;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: var(--yellow);
  border: var(--border);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}
.sidebar-logo .logo-text span { color: var(--yellow); }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-label {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
  color: #555;
  padding: 14px 20px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #aaa;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
}
.nav-item:hover { background: #111; color: var(--white); border-left-color: var(--yellow); }
.nav-item.active { background: var(--yellow); color: var(--black); border-left-color: var(--yellow); }
.nav-item.active svg { stroke: var(--black); }
.nav-item svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 3px solid #222;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 2px solid #222;
  background: #111;
}
.sidebar-user .user-avatar {
  width: 34px; height: 34px;
  background: var(--blue);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem;
  color: white;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 0.85rem; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 0.7rem; color: #555; font-family: var(--font-mono); }
.btn-logout {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: 2px solid #333;
  background: transparent;
  cursor: pointer;
  color: #666;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-logout:hover { background: var(--red); border-color: var(--red); color: white; }
.btn-logout svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ─── TOPBAR ─── */
.topbar {
  height: 64px;
  background: var(--white);
  border-bottom: var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: fixed;
  top: 0; right: 0;
  left: 260px;
  z-index: 100;
  transition: left 0.25s cubic-bezier(.4,0,.2,1);
}
.topbar.sidebar-closed { left: 0; }

.hamburger {
  width: 40px; height: 40px;
  border: var(--border);
  background: var(--yellow);
  cursor: pointer;
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.1s;
  flex-shrink: 0;
}
.hamburger:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--black); }
.hamburger:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--black); }
.hamburger svg { width: 20px; height: 20px; stroke: var(--black); fill: none; stroke-width: 2.5; }

.topbar-title { font-size: 1rem; font-weight: 700; font-family: var(--font-mono); }
.topbar-badge {
  margin-left: auto;
  padding: 4px 10px;
  background: var(--black);
  color: var(--yellow);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: 0.1em;
}

/* ─── MAIN CONTENT ─── */
.main-content {
  margin-left: 260px;
  margin-top: 64px;
  padding: 32px 28px;
  min-height: calc(100vh - 64px);
  transition: margin-left 0.25s cubic-bezier(.4,0,.2,1);
}
.main-content.sidebar-closed { margin-left: 0; }

/* ─── OVERLAY ─── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}
.sidebar-overlay.show { display: block; }

/* ─── CARDS ─── */
.page-header { margin-bottom: 28px; }
.page-header h1 { display: flex; align-items: center; gap: 12px; }
.page-header p { color: #555; margin-top: 6px; font-size: 0.9rem; }

.card {
  background: var(--white);
  border: var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray);
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--white);
  border: var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card .stat-icon {
  width: 44px; height: 44px;
  border: var(--border);
  display: grid; place-items: center;
  margin-bottom: 4px;
}
.stat-icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.stat-card .stat-num { font-size: 2rem; font-weight: 700; font-family: var(--font-mono); line-height: 1; }
.stat-card .stat-label { font-size: 0.78rem; color: #666; font-weight: 500; }
.stat-card.yellow .stat-icon { background: var(--yellow); }
.stat-card.blue .stat-icon { background: var(--blue); color: white; }
.stat-card.green .stat-icon { background: var(--green); }
.stat-card.red .stat-icon { background: var(--red); color: white; }

/* ─── FORM ELEMENTS ─── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  border: var(--border);
  background: var(--white);
  font-family: var(--font-main);
  font-size: 0.95rem;
  outline: none;
  transition: box-shadow 0.15s;
  color: var(--black);
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus { box-shadow: 4px 4px 0 var(--black); }
.form-input::placeholder { color: #aaa; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-hint { font-size: 0.75rem; color: #888; margin-top: 4px; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: var(--border);
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.1s;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--black); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--black); }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.5; }

.btn-primary { background: var(--yellow); color: var(--black); }
.btn-danger  { background: var(--red);    color: var(--white); }
.btn-success { background: var(--green);  color: var(--black); }
.btn-dark    { background: var(--black);  color: var(--white); }
.btn-outline { background: transparent;   color: var(--black); }
.btn-blue    { background: var(--blue);   color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 0.78rem; box-shadow: 2px 2px 0 var(--black); }
.btn-sm:hover { transform: translate(-1px,-1px); box-shadow: 5px 5px 0 var(--black); }

/* ─── TABLE ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead { background: var(--black); color: var(--white); }
thead th { padding: 12px 16px; text-align: left; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; white-space: nowrap; }
tbody tr { border-bottom: 2px solid var(--gray); transition: background 0.1s; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: 12px 16px; vertical-align: middle; }
.td-mono { font-family: var(--font-mono); font-size: 0.82rem; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border: 2px solid var(--black);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}
.badge-running { background: var(--green); }
.badge-offline { background: #ddd; }
.badge-starting { background: var(--yellow); }
.badge-admin { background: var(--blue); color: white; }
.badge-user { background: var(--gray); }
.badge svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* ─── ALERT / TOAST ─── */
.alert {
  padding: 12px 16px;
  border: var(--border);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.alert-error   { background: var(--red);   color: white; }
.alert-success { background: var(--green); color: var(--black); }
.alert-warn    { background: var(--yellow); color: var(--black); }

.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999;
}
.toast {
  padding: 12px 18px;
  border: var(--border);
  box-shadow: var(--shadow);
  font-weight: 600;
  font-size: 0.88rem;
  display: flex; align-items: center; gap: 10px;
  min-width: 260px;
  animation: toastIn 0.2s ease;
}
.toast svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.toast-success { background: var(--green); color: var(--black); }
.toast-error   { background: var(--red);   color: white; }
.toast-info    { background: var(--blue);  color: white; }
@keyframes toastIn { from { transform: translateX(120%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 20px;
}
.modal-overlay.show { display: grid; }
.modal {
  background: var(--white);
  border: var(--border);
  box-shadow: 8px 8px 0 var(--black);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  animation: modalIn 0.2s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn { from { transform: scale(0.92); opacity:0; } to { transform: scale(1); opacity:1; } }
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-title svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }
.modal-body { color: #444; font-size: 0.92rem; margin-bottom: 24px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: #888;
}
.empty-state .empty-icon {
  width: 64px; height: 64px;
  border: var(--border);
  background: var(--gray);
  display: grid; place-items: center;
  margin: 0 auto 16px;
}
.empty-state .empty-icon svg { width: 30px; height: 30px; stroke: #999; fill: none; stroke-width: 1.5; }
.empty-state p { font-size: 0.9rem; }

/* ─── LOADING ─── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 40px auto;
  display: block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 500;
  display: none;
  place-items: center;
  flex-direction: column;
  gap: 14px;
}
.loading-overlay.show { display: grid; }

/* ─── LOGIN PAGE ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: var(--yellow);
  border-radius: 50%;
  top: -200px; right: -150px;
  opacity: 0.06;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: var(--blue);
  bottom: -100px; left: -80px;
  opacity: 0.08;
}

.login-card {
  background: var(--white);
  border: var(--border);
  box-shadow: 8px 8px 0 var(--yellow);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}
.login-header { margin-bottom: 32px; }
.login-header .login-logo {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.login-logo .logo-sq {
  width: 48px; height: 48px;
  background: var(--yellow);
  border: var(--border);
  display: grid; place-items: center;
}
.login-logo .logo-sq svg { width: 26px; height: 26px; stroke: var(--black); fill: none; stroke-width: 2; }
.login-header h1 { font-size: 1.6rem; }
.login-header p  { color: #666; font-size: 0.88rem; margin-top: 4px; }
.login-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 0 20px;
  font-size: 0.72rem;
  color: #bbb;
  font-family: var(--font-mono);
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--gray);
}

/* ─── PASSWORD INPUT ─── */
.input-pw-wrap { position: relative; }
.input-pw-wrap .form-input { padding-right: 44px; }
.toggle-pw {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; color: #999;
  display: grid; place-items: center;
  padding: 4px;
}
.toggle-pw svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0 !important; }
  .main-content { margin-left: 0 !important; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .main-content { padding: 20px 16px; }
  .card { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}
