:root[data-bs-theme="dark"] {
  --bs-body-bg: #0c0c0e; /* mainsurface */
  --bs-body-color: #fafafa; /* zinc-50 */
  --bs-dark: #18181b; /* zinc-900 */
  --bs-secondary: #a1a1aa; /* zinc-400 */
  --bs-primary: #3b82f6; /* blue-500 */
  --bs-primary-rgb: 59, 130, 246;
  --bs-border-color: #27272a; /* zinc-800 */
  --bs-font-sans-serif: 'Manrope', system-ui, -apple-system, sans-serif;
  
  /* Overriding Bootstrap tertiary to match mainsurface */
  --bs-tertiary-bg: #0c0c0e !important;
  --bs-tertiary-bg-rgb: 12, 12, 14 !important;
}

body {
  font-family: var(--bs-font-sans-serif);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  -webkit-font-smoothing: antialiased;
}

/* Custom Utilities */
.bg-mainsurface {
  background-color: #0c0c0e;
}

.bg-surface {
  background-color: #18181b; /* zinc-900 */
}

.text-white {
  color: #fafafa !important;
}

.text-secondary {
  color: #a1a1aa !important;
}

.text-sm {
  font-size: 0.875rem !important;
}

.text-xs {
  font-size: 0.75rem !important;
}

.text-xxs {
  font-size: 0.65rem !important;
}

.letter-spacing-1, .ls-1 {
  letter-spacing: 0.05em;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  line-height: 1.25;
}

.border {
  border-color: var(--bs-border-color) !important;
}

.border-bottom, .border-top, .border-end, .border-start {
  border-color: var(--bs-border-color) !important;
}

.hover-white:hover {
  color: #fafafa !important;
  transition: color 0.15s ease;
}

/* Brand Logo */
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo h2, .brand-logo h4 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.045em;
}
.logo-dot {
  width: 36px;
  height: 36px;
  background-image: url("/assets/brand/logo.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border-radius: 0;
  box-shadow: none;
  flex-shrink: 0;
}

/* Views Navigation */
.view-container {
  display: flex;
}
.view-container.d-none {
  display: none !important;
}

/* Nav & Sidebar */
.top-nav {
  height: 72px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--bs-border-color);
  background-color: var(--bs-body-bg);
}

.nav-divider {
  width: 1px;
  height: 24px;
  background-color: var(--bs-border-color);
  margin: 0 8px;
}

.app-sidebar {
  width: 250px;
  background-color: var(--bs-dark);
  border-right: 1px solid var(--bs-border-color);
  display: flex;
  flex-direction: column;
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 10px 14px;
  border-radius: 6px;
  color: var(--bs-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  text-align: left;
  transition: all 0.2s;
  cursor: pointer;
}
.sidebar-nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: #fafafa;
}
.sidebar-nav-btn.active {
  background-color: rgba(255, 255, 255, 0.08);
  color: #fafafa;
}

/* Auth View */
.login-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bs-dark);
  padding: 40px;
  border-radius: 16px;
  border: 1px solid var(--bs-border-color);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Grid Cards */
.app-card {
  background-color: var(--bs-dark);
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s ease;
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.app-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.status-indicator.bg-success {
  background-color: #10b981 !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}
.status-indicator.bg-danger {
  background-color: #ef4444 !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* Tables and Tabs */
.tab-pane.d-none {
  display: none !important;
}

.table-card {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.table-dark {
  --bs-table-bg: var(--bs-dark);
  --bs-table-border-color: var(--bs-border-color);
  --bs-table-hover-bg: rgba(255,255,255,0.03);
}
.table td, .table th {
  border-bottom: 1px solid var(--bs-border-color);
  background-color: transparent !important;
}

thead.bg-black.bg-opacity-25 th {
  background-color: rgba(0,0,0,0.3) !important;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--bs-secondary);
  letter-spacing: 0.05em;
}

.list-group-item {
  background-color: transparent;
  border-color: var(--bs-border-color);
}
.list-group-flush > .list-group-item:last-child {
  border-bottom: 0;
}

/* Modals */
.glass-modal .modal-content {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  background-color: #18181b !important;
}

.form-control, .form-select {
  background-color: #09090b;
  border: 1px solid #27272a;
  color: #fafafa;
}
.form-control:focus, .form-select:focus {
  background-color: #09090b;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
  color: #fafafa;
}

.btn {
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 6px;
}
.btn-primary {
  background-color: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}
.btn-primary:hover {
  background-color: #2563eb;
  border-color: #2563eb;
}
.btn-dark {
  background-color: #27272a;
  border-color: #27272a;
}
.btn-dark:hover {
  background-color: #3f3f46;
  border-color: #3f3f46;
}

/* JSON editor area */
textarea.font-monospace {
  font-size: 13px !important;
  line-height: 1.5;
  background-color: #000000 !important;
  color: #3b82f6 !important;
  border: 1px solid #27272a !important;
}

/* Form switch */
.form-switch .form-check-input {
  width: 2.5em;
  height: 1.25em;
  background-color: #3f3f46;
  border-color: transparent;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fafafa'/%3e%3c/svg%3e");
}
.form-switch .form-check-input:checked {
  background-color: #3b82f6;
  border-color: #3b82f6;
}

/* Analytics Tabs */
.analytics-tabs {
  border-bottom: none;
}
.analytics-tabs .nav-link {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #a1a1aa;
  border-radius: 0;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.15s, border-color 0.15s;
}
.analytics-tabs .nav-link:hover {
  color: #fafafa;
}
.analytics-tabs .nav-link.active {
  color: #fafafa;
  border-bottom-color: #3b82f6;
  background: none;
}
