﻿/* =============================================================
   Money Global â€” Theme Layer (Bootstrap 5.3 override sheet)
   This file ONLY defines the constant look & feel:
   - Font stack
   - Dark-mode component tweaks that Bootstrap doesn't handle
   - A handful of bespoke components (sidebar layout, genealogy
     tree, impersonation banner) that are not in Bootstrap.
   All per-admin customizable values live in CSS custom properties
   set by includes/theme.php from the site_settings table.
   ============================================================= */

/* ---------- Base typography ---------- */
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--xvt-body-bg);
  color: var(--xvt-text);
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6,
.display-1,
.display-2,
.display-3,
.display-4,
.sidebar-brand,
.navbar-brand {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Bootstrap dark-mode card / surface overrides ---------- */
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .table {
  background-color: var(--xvt-card-bg);
  color: var(--xvt-text);
  border-color: var(--xvt-border);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: var(--xvt-body-bg);
  color: var(--xvt-text);
  border-color: var(--xvt-border);
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: var(--xvt-muted);
}

/* Bootstrap dropdowns opened with Popper strategy:'fixed'
   (used for action menus inside .table-responsive) must sit above sticky topbar/modals. */
.dropdown-menu.show {
  z-index: 1080;
}

[data-bs-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--xvt-text);
  --bs-table-border-color: var(--xvt-border);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
  --bs-table-hover-color: var(--xvt-text);
}

[data-bs-theme="dark"] .text-muted {
  color: var(--xvt-muted) !important;
}

/* Brand-colored button + link states */
.btn-primary {
  --bs-btn-bg: var(--xvt-primary);
  --bs-btn-border-color: var(--xvt-primary);
  --bs-btn-hover-bg: var(--xvt-accent);
  --bs-btn-hover-border-color: var(--xvt-accent);
  --bs-btn-active-bg: var(--xvt-accent);
  --bs-btn-active-border-color: var(--xvt-accent);
}

.btn-outline-primary {
  --bs-btn-color: var(--xvt-primary);
  --bs-btn-border-color: var(--xvt-primary);
  --bs-btn-hover-bg: var(--xvt-primary);
  --bs-btn-hover-border-color: var(--xvt-primary);
}

a {
  color: var(--xvt-primary);
}

a:hover {
  color: var(--xvt-accent);
}

/* ---------- Sidebar + layout shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 260px;
  background: var(--xvt-sidebar-bg);
  border-right: 1px solid var(--xvt-border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.2s ease;
}

.app-sidebar .sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px;
  color: var(--xvt-text);
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 800;
  border-bottom: 1px solid var(--xvt-border);
}

.app-sidebar .sidebar-brand i {
  color: var(--xvt-primary);
}

.app-sidebar .sidebar-brand .brand-highlight {
  color: var(--xvt-primary);
}

.app-sidebar .nav-section {
  padding: 14px 22px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--xvt-muted);
}

.app-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 22px;
  color: var(--xvt-muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.app-sidebar .nav-link i {
  width: 18px;
  text-align: center;
}

.app-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--xvt-text);
}

.app-sidebar .nav-link.active {
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--xvt-primary);
  border-left-color: var(--xvt-primary);
  font-weight: 600;
}

.app-sidebar .nav-submenu {
  list-style: none;
  padding-left: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.app-sidebar .has-submenu.open>.nav-submenu {
  max-height: 400px;
}

.app-sidebar .sub-link {
  padding-left: 52px;
  font-size: 0.85rem;
}

.app-sidebar .nav-arrow {
  margin-left: auto;
  transition: transform 0.2s;
}

.app-sidebar .has-submenu.open>.nav-link .nav-arrow {
  transform: rotate(180deg);
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background: var(--xvt-topbar-bg);
  border-bottom: 1px solid var(--xvt-border);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-content {
  padding: 24px 28px;
  flex: 1;
}

/* Mobile: sidebar becomes offcanvas */
@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    z-index: 1050;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
  }

  .app-sidebar-backdrop.show {
    display: block;
  }

  .app-content {
    padding: 16px;
  }
}

/* ---------- Avatars / status dots ---------- */
.xvt-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--xvt-primary), var(--xvt-accent));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  overflow: hidden;
}

.xvt-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xvt-avatar.lg {
  width: 56px;
  height: 56px;
  font-size: 1.1rem;
}

/* ---------- Impersonation banner ---------- */
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: linear-gradient(90deg, #b45309, #f59e0b);
  color: #1a0f00;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

.impersonation-banner a {
  background: #1a0f00;
  color: #fbbf24;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.impersonation-banner a:hover {
  background: #000;
  color: #fde68a;
}

/* ---------- Blocked login page (full-screen) ---------- */
.blocked-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: radial-gradient(circle at top, #1a0000, #0b1220);
  color: #fff;
}

.blocked-screen .blocked-icon {
  font-size: 4.5rem;
  color: #FF5A5F;
  margin-bottom: 18px;
}

.blocked-screen .blocked-reason-box {
  border: 2px solid #FF5A5F;
  background: rgba(255, 90, 95, 0.08);
  border-radius: 8px;
  padding: 22px 30px;
  max-width: 640px;
  margin: 18px 0 28px;
  letter-spacing: 2px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ---------- Utility helpers ---------- */
.bg-surface {
  background-color: var(--xvt-card-bg) !important;
}

.border-themed {
  border-color: var(--xvt-border) !important;
}

.text-accent {
  color: var(--xvt-accent) !important;
}

.fw-heading {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 700;
}

/* Scrollbar polish for dark mode */
[data-bs-theme="dark"] ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--xvt-body-bg);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--xvt-border);
  border-radius: 4px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--xvt-primary);
}

/* ---------- Network Tree Level Cards ---------- */
.network-level-card {
  transition: transform .15s, box-shadow .15s, border-color .15s;
  cursor: pointer;
}

.network-level-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
}

.network-level-card.active {
  border-color: var(--xvt-primary) !important;
  box-shadow: 0 0 0 2px var(--xvt-primary);
}

.network-level-card.active .small {
  color: var(--xvt-primary) !important;
}

.network-level-card.active .h4 {
  color: var(--xvt-primary);
}

.network-level-card.total {
  background: var(--xvt-primary);
  border-color: var(--xvt-primary) !important;
}

.network-level-card.total .small,
.network-level-card.total .h4 {
  color: #fff !important;
}

/* ---------- Sidebar Enhancements ---------- */
.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--xvt-primary), var(--xvt-accent));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin: 8px 14px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--xvt-border);
}

.sidebar-user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--xvt-primary), var(--xvt-accent));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--xvt-text);
  line-height: 1.2;
}

.sidebar-user-id {
  color: var(--xvt-muted);
  font-size: 0.75rem;
  line-height: 1.2;
}

.app-sidebar .nav-section {
  padding: 14px 22px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-sidebar .nav-section::before {
  content: '';
  display: block;
  height: 1px;
  flex: 1;
  background: var(--xvt-border);
  opacity: 0.5;
}

.app-sidebar .nav-section span {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--xvt-muted);
  white-space: nowrap;
}

.app-sidebar .nav-link {
  margin: 2px 10px;
  padding: 9px 14px;
  border-radius: 10px;
  border-left: none;
  gap: 10px;
}

.app-sidebar .nav-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ni-color, var(--xvt-muted));
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.app-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--xvt-text);
  transform: translateX(2px);
}

.app-sidebar .nav-link:hover .nav-icon {
  background: rgba(255, 255, 255, 0.1);
}

.app-sidebar .nav-link.active {
  background: rgba(var(--bs-primary-rgb), 0.12);
  color: var(--xvt-primary);
  border-left-color: transparent;
  font-weight: 600;
}

.app-sidebar .nav-link.active .nav-icon {
  background: var(--xvt-primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(var(--bs-primary-rgb), 0.3);
}

.app-sidebar .sub-link {
  padding-left: 54px;
  font-size: 0.85rem;
}

.app-sidebar .sub-link i {
  font-size: 0.8rem;
  opacity: 0.7;
}

.app-sidebar .nav-submenu {
  margin: 0 10px;
  padding-left: 0;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 0 10px 10px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
}

.app-sidebar .has-submenu.open>.nav-submenu {
  max-height: 400px;
  padding: 4px 0;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-soft {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.03);
  }
}