/* Servio Suite Manager — app.css */

:root {
  --primary:      #cc2218;
  --primary-dark: #a31b12;
  --bg:           #0f1117;
  --surface:      #1a1d27;
  --surface2:     #22263a;
  --border:       #2e3248;
  --text:         #e8eaf0;
  --text-muted:   #8b8fa8;
  --green:        #22c55e;
  --yellow:       #f59e0b;
  --red:          #ef4444;
  --blue:         #3b82f6;
  --font:         'Inter', system-ui, sans-serif;
  --mono:         'JetBrains Mono', monospace;
  --radius:       8px;
  --sidebar-w:    220px;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

/* ── LOGIN ────────────────────────────────────────────────── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: radial-gradient(ellipse at 60% 40%, #1a0d0b 0%, #0f1117 60%);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-title { font-size: 16px; font-weight: 700; color: var(--text); }
.login-sub   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.login-error {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── APP LAYOUT ───────────────────────────────────────────── */
#app { display: flex; height: 100vh; }

#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  letter-spacing: .3px;
}

#sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: none;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
  text-align: left;
}
.nav-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: rgba(204,34,24,.15); color: var(--primary); }
.nav-btn.active svg { stroke: var(--primary); }

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .12s;
}
.user-chip:hover { background: var(--surface2); }

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-info > div:first-child { font-size: 12.5px; font-weight: 600; color: var(--text); }
.user-info > div:last-child  { font-size: 11px; color: var(--text-muted); }

.btn-logout {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 6px;
  border-radius: 6px; transition: background .12s, color .12s;
  display: flex; align-items: center;
}
.btn-logout:hover { background: rgba(239,68,68,.12); color: var(--red); }
.btn-logout svg { width: 16px; height: 16px; }

/* ── MAIN ─────────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 58px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

#topbar h1 { font-size: 16px; font-weight: 700; color: var(--text); }

#topbar-right { display: flex; align-items: center; gap: 12px; }

.alerts-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--red);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.alerts-badge:hover { background: rgba(239,68,68,.25); }

#view-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 { font-size: 14px; font-weight: 600; color: var(--text); }

.card-body { padding: 20px; }

/* ── GRID ─────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ── STAT CARDS ───────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── STATUS BADGES ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: rgba(34,197,94,.12);  color: #4ade80; }
.badge-red    { background: rgba(239,68,68,.12);   color: #f87171; }
.badge-yellow { background: rgba(245,158,11,.12);  color: #fbbf24; }
.badge-gray   { background: rgba(139,143,168,.12); color: var(--text-muted); }
.badge-blue   { background: rgba(59,130,246,.12);  color: #60a5fa; }

.dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}
.dot-green  { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
.dot-red    { background: var(--red); }
.dot-yellow { background: var(--yellow); }

@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: .4; }
}

/* ── TABLES ───────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

/* ── FORMS ────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=url], textarea, select {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  outline: none;
  transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
select option { background: var(--surface); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 9px 16px;
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-full { width: 100%; justify-content: center; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s;
}
.btn-secondary:hover { background: #2a2e45; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none;
  color: var(--text-muted);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--font);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--red); color: #fff;
  border: none; border-radius: 6px;
  padding: 7px 12px;
  font-family: var(--font);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.btn-danger:hover { background: #dc2626; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 520px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 20px; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: background .12s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.modal-body { padding: 22px; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

/* ── TOAST ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13.5px; font-weight: 500;
  min-width: 260px;
  animation: slideIn .2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.toast-success { background: #14532d; border: 1px solid #166534; color: #86efac; }
.toast-error   { background: #7f1d1d; border: 1px solid #991b1b; color: #fca5a5; }
.toast-info    { background: #1e3a5f; border: 1px solid #1e40af; color: #93c5fd; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── MISC ─────────────────────────────────────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.section-header h2 { font-size: 18px; font-weight: 700; }

.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.mono { font-family: var(--mono); font-size: 12px; }

.stat-cell { background: var(--surface2); border-radius: 6px; padding: 8px 10px; }
.stat-cell-sm { background: var(--surface2); border-radius: 5px; padding: 5px 8px; }
.stat-cell-sm .stat-label { font-size: 9.5px; }
.stat-cell-sm > div:last-child { font-size: 12px; }
.stat-label { font-size: 10.5px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; font-weight: 500; }
.stat-cell > div:last-child { font-size: 13px; font-weight: 600; }
.latency { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }
.latency-good { color: var(--green); }
.latency-warn { color: var(--yellow); }
.latency-bad  { color: var(--red); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3e4460; }
