/* ============================================
   Virtix - Custom Stylesheet
   ============================================ */

:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #818cf8;
  --sidebar-width: 260px;
  --header-height: 60px;
  --transition:    all 0.2s ease;
}

/* ── DARK THEME ── */
[data-bs-theme="dark"] {
  --bg-body:    #0f172a;
  --bg-card:    #1e293b;
  --bg-sidebar: #0f172a;
  --bg-header:  #1e293b;
  --border-col: #334155;
  --text-muted: #94a3b8;
}

/* ── LIGHT THEME ── */
[data-bs-theme="light"] {
  --bg-body:    #f1f5f9;
  --bg-card:    #ffffff;
  --bg-sidebar: #1e293b;
  --bg-header:  #ffffff;
  --border-col: #e2e8f0;
  --text-muted: #64748b;
}

/* ── GLOBAL ── */
* { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  overflow-x: hidden;
  background-color: var(--bg-body);
  transition: var(--transition);
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-decoration: none;
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.3px;
}

.sidebar-brand-sub {
  color: rgba(255,255,255,0.45);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-section-label {
  color: rgba(255,255,255,0.35);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 16px 20px 6px;
}

.sidebar-nav {
  list-style: none;
  padding: 6px 12px;
  margin: 0;
}

.sidebar-nav .nav-item { margin-bottom: 2px; }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  font-size: 0.85rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  background: rgba(99,102,241,0.18);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.35);
}

.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.sidebar-nav .nav-link .badge {
  margin-left: auto;
  font-size: 0.65rem;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* ── TOP HEADER ── */
.top-header {
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-col);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-header .page-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0;
  flex-grow: 1;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.header-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-col);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
}

.header-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.avatar-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ── PAGE CONTENT ── */
.page-content { padding: 24px; flex: 1; }

/* ── STAT CARDS ── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-col);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.purple { background: rgba(99,102,241,0.15); color: var(--primary); }
.stat-icon.green  { background: rgba(34,197,94,0.15);  color: #22c55e; }
.stat-icon.yellow { background: rgba(234,179,8,0.15);  color: #eab308; }
.stat-icon.red    { background: rgba(239,68,68,0.15);  color: #ef4444; }
.stat-icon.blue   { background: rgba(59,130,246,0.15); color: #3b82f6; }
.stat-icon.orange { background: rgba(249,115,22,0.15); color: #f97316; }

.stat-info .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-info .stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -1px;
}

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

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

.vx-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
}

.vx-card-body { padding: 20px; }

/* ── TABLE ── */
.vx-table { width: 100%; border-collapse: collapse; }

.vx-table th {
  padding: 10px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-col);
  white-space: nowrap;
}

.vx-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-col);
  vertical-align: middle;
}

.vx-table tr:last-child td { border-bottom: none; }

.vx-table tr:hover td { background: rgba(99,102,241,0.04); }

/* ── STATUS DOTS ── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.running  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-dot.stopped  { background: #94a3b8; }
.status-dot.suspended{ background: #eab308; }
.status-dot.unknown  { background: #64748b; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-sm { padding: 4px 10px; font-size: 0.78rem; }
.btn-xs { padding: 2px 8px;  font-size: 0.72rem; }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border-col);
  background: transparent;
  transition: var(--transition);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── FORMS ── */
.form-control, .form-select {
  border-radius: 8px;
  font-size: 0.875rem;
  border-color: var(--border-col);
}

.form-label {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 5px;
}

/* ── INSTALL WIZARD ── */
.install-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 20px;
}

.install-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}

.install-header {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  padding: 32px 40px 28px;
  text-align: center;
}

.install-logo {
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: -1px;
}

.install-body { padding: 36px 40px; }

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #334155;
  transition: var(--transition);
}

.step-dot.active { background: var(--primary); transform: scale(1.3); }
.step-dot.done   { background: #22c55e; }

/* ── LOGIN PAGE ── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 20px;
}

.auth-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}

.auth-header {
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  padding: 32px 36px 28px;
  text-align: center;
}

.auth-body { padding: 32px 36px; }

/* ── VPS RESOURCE BARS ── */
.resource-bar { margin-bottom: 10px; }

.resource-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  margin-bottom: 4px;
  color: var(--text-muted);
}

.progress { border-radius: 4px; height: 6px; }
.progress-bar { border-radius: 4px; transition: width 1s ease; }

/* ── VPS ACTION GRID ── */
.vps-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  padding: 16px;
}

.vps-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-col);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

.vps-action-btn i { font-size: 1.2rem; }

.vps-action-btn:hover {
  border-color: var(--primary);
  background: rgba(99,102,241,0.1);
  color: var(--primary);
  transform: translateY(-2px);
}

.vps-action-btn.danger:hover {
  border-color: #ef4444;
  background: rgba(239,68,68,0.1);
  color: #ef4444;
}

.vps-action-btn.success:hover {
  border-color: #22c55e;
  background: rgba(34,197,94,0.1);
  color: #22c55e;
}

/* ── BADGES ── */
.badge { font-weight: 600; padding: 4px 8px; border-radius: 6px; }

/* ── ALERTS ── */
.alert { border-radius: 10px; font-size: 0.875rem; }

/* ── MODAL ── */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-col);
  border-radius: 16px;
}

.modal-header {
  border-bottom: 1px solid var(--border-col);
  padding: 16px 20px;
}

.modal-footer {
  border-top: 1px solid var(--border-col);
  padding: 14px 20px;
}

/* ── MOBILE ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
  .sidebar-backdrop.show { display: block; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.5rem !important; }
  .page-content { padding: 16px; }
  .vps-actions { grid-template-columns: repeat(3, 1fr); }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ── MISC ── */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(99,102,241,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.text-primary  { color: var(--primary) !important; }
.bg-primary    { background-color: var(--primary) !important; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i { font-size: 3rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state h5 { font-weight: 700; margin-bottom: 8px; }

.vnc-box {
  background: #000;
  border-radius: 10px;
  padding: 20px;
  font-family: monospace;
  color: #22c55e;
  font-size: 0.9rem;
}
