/* =====================================================================
 * Server Monitoring System — Dark Navy Cyber / Glassmorphism Theme
 * Skema: #0f172a bg • #1e293b surface • #38bdf8 cyan
 *        #ef4444 red alert • #22c55e green success
 * ==================================================================== */

:root {
  --bg:          #0f172a;
  --bg-deep:     #0a1020;
  --surface:     #1e293b;
  --surface-2:   #16213a;
  --border:      rgba(56, 189, 248, .14);
  --cyan:        #38bdf8;
  --cyan-soft:   rgba(56, 189, 248, .12);
  --red:         #ef4444;
  --green:       #22c55e;
  --amber:       #f59e0b;
  --purple:      #a78bfa;
  --text:        #e2e8f0;
  --muted:       #94a3b8;
  --glass:       rgba(30, 41, 59, .55);
  --radius:      12px;
  --shadow:      0 8px 30px rgba(2, 6, 23, .45);
  --sidebar-w:   250px;
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(56, 189, 248, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(167, 139, 250, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ================= GLASS PRIMITIVES ================= */
.glass,
.glass-card {
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.glass-card .card-header {
  background: linear-gradient(180deg, rgba(56, 189, 248, .06), rgba(56, 189, 248, .015));
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
}

.glass-dropdown {
  background: rgba(15, 23, 42, .95) !important;
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

/* ================= APP SHELL ================= */
.app-shell { display: flex; min-height: 100vh; }

/* ================= SIDEBAR ================= */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border-left: none;
  border-top: none;
  border-bottom: none;
  transition: transform .25s ease;
  background: rgba(13, 20, 38, .82);
}

.sidebar-brand {
  display: flex; align-items: center; gap: .65rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.05rem;
  letter-spacing: .3px;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), #6366f1);
  color: #04121f; font-size: 1.1rem;
  box-shadow: 0 0 18px rgba(56, 189, 248, .45);
}
.sidebar-brand b { color: var(--cyan); font-weight: 700; }

.sidebar-nav { flex: 1; padding: .9rem .7rem; overflow-y: auto; }
.sidebar-nav .nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .68rem .85rem;
  margin-bottom: .3rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
  position: relative;
  transition: all .18s ease;
  border: 1px solid transparent;
}
.sidebar-nav .nav-item i { width: 18px; text-align: center; }
.sidebar-nav .nav-item:hover {
  color: var(--text);
  background: rgba(56, 189, 248, .08);
  border-color: var(--border);
}
.sidebar-nav .nav-item.active {
  color: #04121f;
  background: linear-gradient(135deg, var(--cyan), #38bdf8 60%, #7dd3fc);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(56, 189, 248, .35);
}
.sidebar-nav .nav-item.active .nav-marker { margin-left: auto; font-size: .7rem; }

.sidebar-footer {
  padding: .9rem;
  border-top: 1px solid var(--border);
}
.sys-mini {
  background: rgba(56, 189, 248, .06);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .6rem .7rem;
}

/* ================= CONTENT ================= */
.content-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.content { flex: 1; }

/* ================= TOPBAR ================= */
.topbar {
  position: sticky; top: 0; z-index: 1030;
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem 1rem;
  border-radius: 0;
  border-top: none; border-left: none; border-right: none;
  background: rgba(13, 20, 38, .86);
}
.topbar-info { display: flex; gap: .5rem; flex-wrap: wrap; }
.badge-sys {
  font-size: .74rem;
  background: var(--cyan-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .28rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-sys b { color: var(--cyan); font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .55rem; }

.live-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, .7);
  animation: pulse 1.6s infinite;
  display: inline-block;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
  70%  { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.badge-role {
  font-size: .74rem; padding: .3rem .65rem; border-radius: 999px;
  border: 1px solid var(--border);
}
.role-admin   { background: rgba(245, 158, 11, .15); color: #fbbf24; }
.role-operator{ background: rgba(56, 189, 248, .12); color: var(--cyan); }

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

/* ================= STAT CARDS ================= */
.stat-card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: 100%;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; inset: 0 auto auto 0;
  width: 100%; height: 3px; opacity: .9;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
}
.glow-cyan::after   { background: linear-gradient(90deg, transparent, var(--cyan), transparent); }
.glow-green::after  { background: linear-gradient(90deg, transparent, var(--green), transparent); }
.glow-purple::after { background: linear-gradient(90deg, transparent, var(--purple), transparent); }
.glow-amber::after  { background: linear-gradient(90deg, transparent, var(--amber), transparent); }
.glow-danger::after { background: linear-gradient(90deg, transparent, var(--red), transparent); }

.stat-card .card-body { padding: 1rem 1.1rem; }
.stat-head {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .6px;
}
.stat-head i { color: var(--cyan); font-size: 1rem; }
.stat-value {
  font-size: 1.85rem; font-weight: 700; margin: .35rem 0 .45rem;
  color: #f8fafc; letter-spacing: -.5px;
}
.stat-value.small-stat { font-size: 1.05rem; line-height: 1.5; }
.stat-progress { height: 6px; background: rgba(148, 163, 184, .15); border-radius: 99px; }
.stat-sub { font-size: .76rem; color: var(--muted); margin-top: .5rem; }

.bg-cyan   { background-color: var(--cyan) !important; }
.bg-green  { background-color: var(--green) !important; }
.bg-purple { background-color: var(--purple) !important; }

/* ================= QUICK BOXES ================= */
.quick-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .7rem .5rem;
  text-align: center;
  background: rgba(56, 189, 248, .05);
  margin-bottom: .6rem;
}
.quick-num { font-size: 1.35rem; font-weight: 700; color: #f8fafc; }
.quick-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.quick-box.danger  { background: rgba(239, 68, 68, .10);  border-color: rgba(239, 68, 68, .30); }
.quick-box.danger .quick-num { color: #fca5a5; }
.quick-box.warning { background: rgba(245, 158, 11, .10); border-color: rgba(245, 158, 11, .30); }
.quick-box.warning .quick-num { color: #fcd34d; }
.quick-box.success { background: rgba(34, 197, 94, .10);  border-color: rgba(34, 197, 94, .30); }
.quick-box.success .quick-num { color: #86efac; }
.quick-box.info    { background: rgba(56, 189, 248, .10); border-color: rgba(56, 189, 248, .30); }
.quick-box.info .quick-num { color: #7dd3fc; }
.quick-box.cyan    { background: rgba(167, 139, 250, .10); border-color: rgba(167, 139, 250, .30); }
.quick-box.cyan .quick-num { color: #c4b5fd; }

/* ================= BADGES GLOW ================= */
.glow-badge { box-shadow: 0 0 10px rgba(56, 189, 248, .25); }

/* ================= TABLES ================= */
.table { --bs-table-bg: transparent; color: var(--text); font-size: .87rem; }
.table > :not(caption) > * > * {
  background: transparent;
  color: var(--text);
  border-bottom-color: rgba(148, 163, 184, .10);
}
.table-hover > tbody > tr:hover > * { background: rgba(56, 189, 248, .07); color: var(--text); }
.table thead .sticky-top th {
  background: #101a30;
  z-index: 3;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.table-dark-subtle > thead > tr > th {
  background: rgba(56, 189, 248, .07) !important;
  color: var(--muted);
  font-size: .75rem; text-transform: uppercase;
  border-bottom: 1px solid var(--border) !important;
}
.info-table th {
  width: 42%; font-weight: 500; color: var(--muted); font-size: .82rem;
  padding: .45rem .75rem; border-color: rgba(148, 163, 184, .10);
}
.info-table td { font-size: .85rem; padding: .45rem .75rem; border-color: rgba(148, 163, 184, .10); }

.mono, code, .font-monospace { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ================= BUTTONS ================= */
.btn {
  border-radius: 9px;
  font-size: .86rem;
  transition: all .16s ease;
}
.btn-accent {
  background: linear-gradient(135deg, var(--cyan), #2563eb);
  border: none;
  color: #04121f;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(56, 189, 248, .30);
}
.btn-accent:hover { filter: brightness(1.1); color: #04121f; transform: translateY(-1px); }
.btn-tiny { padding: .16rem .45rem; font-size: .74rem; border-radius: 7px; }

/* ================= CHART BOX ================= */
.chart-box { position: relative; height: 300px; }
.doughnut-box { height: 300px; display: grid; place-items: center; }
.gauge-wrap { position: relative; height: 200px; display: grid; place-items: center; }

.doughnut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.doughnut-center b { font-size: 1.5rem; color: #f8fafc; }
.doughnut-center span { font-size: .72rem; color: var(--muted); text-transform: uppercase; }

/* ================= MISC ================= */
.disk-row { margin-bottom: .8rem; }
.disk-row:last-child { margin-bottom: 0; }

.log-box {
  background: rgba(2, 6, 23, .7);
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 170px;
  overflow-y: auto;
  font-family: ui-monospace, monospace;
  font-size: .72rem;
  padding: .35rem;
}
.log-line { padding: .12rem .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.log-error { color: #fca5a5; }
.log-warn  { color: #fcd34d; }
.log-info  { color: #93c5fd; }

.attack-row { background: rgba(239, 68, 68, .05); border: 1px solid rgba(239,68,68,.18); border-radius: 8px; padding: .5rem .6rem; }

.ip-big { font-size: 1.5rem; font-weight: 700; letter-spacing: 1px; }

.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--cyan), #6366f1);
  color: #04121f; font-weight: 700; font-size: .9rem;
  flex: 0 0 auto;
}
.avatar-circle.avatar-lg { width: 56px; height: 56px; font-size: 1.4rem; }

.progress { background: rgba(148, 163, 184, .15); border-radius: 99px; overflow: hidden; }
.progress-bar { transition: width .6s ease; }

.card { border: none; }
.card.text-bg-*, .badge { font-weight: 500; }

.alert { border-radius: 10px; backdrop-filter: blur(8px); }

.app-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem;
  padding: .7rem 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .76rem;
}

/* ================= LOGIN PAGE ================= */
.login-page {
  display: grid; place-items: center;
  min-height: 100vh;
  padding: 1rem;
}
.login-wrap { width: 100%; max-width: 430px; }
.login-card { padding: 2.2rem 1.9rem; border-radius: 18px; }
.login-logo {
  width: 64px; height: 64px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--cyan), #6366f1);
  color: #04121f; font-size: 1.8rem;
  box-shadow: 0 0 30px rgba(56, 189, 248, .5);
}
.login-card .form-control,
.login-card .input-group-text {
  background: rgba(2, 6, 23, .55);
  border-color: var(--border);
  color: var(--text);
}
.login-card .form-control:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 .2rem rgba(56, 189, 248, .18);
}

/* ================= MODALS ================= */
.modal-content.glass {
  background: rgba(15, 23, 42, .96);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
}
.modal .form-control, .modal .form-select {
  background: rgba(2, 6, 23, .55);
  border-color: var(--border);
  color: var(--text);
}
.modal .form-control:focus, .modal .form-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 .2rem rgba(56, 189, 248, .18);
}

/* ================= SCROLLBAR ================= */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, .6); }
::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, .35); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, .6); }

/* ================= RESPONSIVE ================= */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .7); }
  .content-wrap { margin-left: 0; }
  .chart-box, .doughnut-box { height: 250px; }
  .stat-value { font-size: 1.5rem; }
}

@media (max-width: 575.98px) {
  .content { padding: .7rem !important; }
  .topbar { padding: .5rem .7rem; }
  .login-card { padding: 1.6rem 1.2rem; }
  .stat-value { font-size: 1.35rem; }
  .app-footer { font-size: .68rem; }
}
