/* ============================================================
   QEMU Admin Panel — Dark Theme Stylesheet
   ============================================================ */

:root {
  --sidebar-width: 220px;
  --topbar-height: 52px;
  --bg-body:    #0f1117;
  --bg-card:    #181c27;
  --bg-sidebar: #13161f;
  --border:     rgba(255,255,255,0.08);
  --accent:     #3d7ef7;
}

/* ---- Reset / Base ---------------------------------------- */
body {
  background-color: var(--bg-body);
  color: #d1d5db;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  margin: 0;
  overflow-x: hidden;
}

/* ---- Sidebar --------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  z-index: 1040;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.02em;
}

.sidebar-link {
  color: #9ca3af;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
}

.sidebar-link:hover {
  background: rgba(61, 126, 247, 0.12);
  color: #e5e7eb;
}

.sidebar-link.active {
  background: rgba(61, 126, 247, 0.2);
  color: #a8c4ff;
  font-weight: 500;
}

/* ---- Main content area ----------------------------------- */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---------------------------------------------- */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-sidebar);
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* ---- Cards ----------------------------------------------- */
.card {
  background: var(--bg-card);
  border-color: var(--border) !important;
}

.card-header {
  background: rgba(255,255,255,0.03);
  border-color: var(--border) !important;
}

/* ---- Stat cards ------------------------------------------ */
.stat-card {
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.25;
}

/* ---- Doughnut chart center label ------------------------- */
.chart-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 600;
  color: #e5e7eb;
  pointer-events: none;
}

/* ---- Tables ---------------------------------------------- */
.table-header th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b7280;
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.75rem;
  background: rgba(255,255,255,0.02);
}

.table-dark {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(255,255,255,0.04);
}

/* ---- Forms ----------------------------------------------- */
.form-control, .form-select {
  background-color: #1e2130;
  border-color: rgba(255,255,255,0.12);
  color: #d1d5db;
}

.form-control:focus, .form-select:focus {
  background-color: #222638;
  border-color: var(--accent);
  color: #e5e7eb;
  box-shadow: 0 0 0 3px rgba(61,126,247,0.2);
}

.form-check-input {
  background-color: #1e2130;
  border-color: rgba(255,255,255,0.2);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Buttons --------------------------------------------- */
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #5b95ff;
  border-color: #5b95ff;
}

/* ---- Badges ---------------------------------------------- */
.badge {
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

/* ---- Login page ------------------------------------------ */
.login-wrapper {
  min-height: 100vh;
  background: radial-gradient(ellipse at 20% 50%, rgba(61,126,247,0.08) 0%, transparent 60%),
              var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.login-logo {
  font-size: 2.5rem;
  color: var(--accent);
}

/* ---- Console (noVNC) ------------------------------------- */
#novnc-canvas-container {
  background: #000;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

#novnc-canvas-container canvas {
  display: block;
  width: 100%;
  height: auto;
}

.console-toolbar {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.vnc-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: #6b7280;
  transition: background 0.3s;
}

.vnc-status-dot.connected   { background: #22c55e; }
.vnc-status-dot.connecting  { background: #f59e0b; animation: blink 1s infinite; }
.vnc-status-dot.error       { background: #ef4444; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ---- ISO list icon colors -------------------------------- */
.iso-windows { color: #60a5fa; }
.iso-linux   { color: #34d399; }
.iso-other   { color: #9ca3af; }

/* ---- Responsive: collapse sidebar < lg ------------------- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
}

/* ---- Scrollbar ------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

/* ---- Utilities ------------------------------------------- */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.section-heading {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
  padding: 0.25rem 0.75rem;
  margin-top: 0.75rem;
}

pre.config-block {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  font-size: 0.78rem;
  color: #a8c4ff;
  white-space: pre-wrap;
  word-break: break-all;
}
