/* =============================================
   MLM PLATFORM – GLASSMORPHISM DARK THEME
   VERSION 4.0.1 (All text bright white)
   ============================================= */

/* ---------- CORE VARIABLES ---------- */
:root {
  --primary: #2dd4bf;
  --primary-dark: #14b8a6;
  --primary-light: #5eead4;
  --secondary: #22d3ee;
  --accent: #6b21a8;
  --success: #34d399;
  --info: #60a5fa;
  --warning: #fbbf24;
  --danger: #f87171;
  --dark-bg: #0f172a;
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.85);
  --text-muted: rgba(255, 255, 255, 0.6);
  --sidebar-width: 250px;
  --topbar-height: 60px;
  --transition: 0.3s ease;
}





/* ---------- RESET & BASE ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
font-family: 'Plus Jakarta Sans', sans-serif;
  background: linear-gradient(135deg, #0f766e 0%, #6b21a8 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: -1;
}

/* ---------- FORCE ALL TEXT TO LIGHT COLORS ---------- */
/* (bootstrap overrides – keeps button / badge text as designed) */
.card,
.card .card-body,
.table,
.table thead th,
.table tbody td,
.modal-content,
.modal-header,
.modal-body,
.alert,
.list-group-item,
.breadcrumb,
.dropdown-menu,
.page-link {
  color: var(--text-secondary) !important;
}

/* Headers stay pure white */
.card .card-header,
.modal-header,
.breadcrumb-item.active,
.navbar-brand,
h1, h2, h3, h4, h5, h6,
.text-white {
  color: var(--text-primary) !important;
}

/* Keep muted text distinct */
.text-muted,
.small,
.dropdown-item-text {
  color: var(--text-muted) !important;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  color: var(--text-primary);
  z-index: 1050;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar .sidebar-brand {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.sidebar .sidebar-brand i {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar .nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.9rem 1rem 0.3rem;
}

.sidebar .nav-item {
  position: relative;
}

.sidebar .nav-item .nav-link {
  display: flex;
  align-items: center;
  padding: 0.65rem 1rem;
  margin: 0.1rem 0.6rem;
  border-radius: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sidebar .nav-item .nav-link i {
  font-size: 1.05rem;
  width: 22px;
  min-width: 22px;
  text-align: center;
  margin-right: 0.65rem;
}

.sidebar .nav-item .nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

.sidebar .nav-item .nav-link.active {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(45, 212, 191, 0.3);
}

.sidebar .sidebar-divider {
  border-top: 1px solid rgba(255,255,255,0.06);
  margin: 0.5rem 0;
}

.sidebar::-webkit-scrollbar {
  width: 3px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
}

/* ---------- SIDEBAR OVERLAY ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}



/* ---------- CONTENT WRAPPER ---------- */
.content-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition);
  display: flex;
  flex-direction: column;
}

/* ---------- TOPBAR ---------- */
.topbar {
  height: var(--topbar-height);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 999;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topbar .sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 0.4rem;
  transition: background 0.2s;
  flex-shrink: 0;
  line-height: 1;
  display: none;
}

.topbar .sidebar-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: var(--primary);
}

.topbar .search-box {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.topbar .search-box input {
  width: 100%;
  padding: 0.42rem 0.8rem 0.42rem 2.4rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-size: 0.88rem;
  transition: all 0.2s;
}

.topbar .search-box input:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
  outline: none;
}

.topbar .search-box i {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.topbar .topbar-nav {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 0.35rem;
  flex-shrink: 0;
}

.topbar .topbar-nav .nav-link,
#darkModeToggle {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.55rem;
  border-radius: 0.5rem;
  transition: background 0.2s;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
}

.topbar .topbar-nav .nav-link:hover,
#darkModeToggle:hover {
  background: rgba(255,255,255,0.1);
  color: var(--primary);
}

.swal-custom-title {
    color: #000000 !important;
}

/* User dropdown */
.topbar .user-dropdown {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: 0.5rem;
  transition: background 0.2s;
  text-decoration: none;
  color: var(--text-primary);
}

.topbar .user-dropdown:hover {
  background: rgba(255,255,255,0.1);
}

.topbar .user-dropdown .rounded-circle {
  font-weight: bold;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #0f172a;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  padding: 1.5rem;
  flex: 1;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  margin-bottom: 1.25rem;
  transition: all var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  border-color: rgba(45, 212, 191, 0.2);
}

.card .card-header {
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 1rem 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  border-radius: 1rem 1rem 0 0;
}

.card .card-body {
  padding: 1.25rem;
  color: var(--text-secondary);
}

/* Stat Cards */
.stat-card {
  border-left: 4px solid;
  border-radius: 0.5rem;
}

.stat-card.primary  { border-left-color: var(--primary); }
.stat-card.success  { border-left-color: var(--success); }
.stat-card.info     { border-left-color: var(--info); }
.stat-card.warning  { border-left-color: var(--warning); }
.stat-card.danger   { border-left-color: var(--danger); }

.stat-card .stat-icon {
  font-size: 2rem;
  opacity: 0.4;
  color: var(--text-primary);
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.stat-card .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- TABLES ---------- */
.table {
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.table thead th {
  background: rgba(255,255,255,0.04);
  border-bottom: 2px solid rgba(255,255,255,0.08);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  white-space: nowrap;
  vertical-align: middle;
}

.table tbody td {
  vertical-align: middle;
  background: transparent;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.table tbody tr:hover td {
  background: rgba(255,255,255,0.03);
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
  border-radius: 0.5rem;
}

/* ---------- BADGES ---------- */
.badge {
  padding: 0.35em 0.65em;
  font-size: 0.73em;
  font-weight: 600;
  border-radius: 0.35rem;
  letter-spacing: 0.02em;
}

/* ---------- BUTTONS ---------- */
.btn {
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.25s ease;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
  color: #0f172a;
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 212, 191, 0.3);
}

.btn-success { background: var(--success); color: #0f172a; }
.btn-info    { background: var(--info); color: #0f172a; }
.btn-warning { background: var(--warning); color: #0f172a; }
.btn-danger  { background: var(--danger); color: #fff; }

.btn-outline-primary {
  border: 1.5px solid var(--primary);
  color: var(--primary);
  background: transparent;
}
.btn-outline-primary:hover {
  background: var(--primary);
  color: #0f172a;
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border: 1.5px solid rgba(255,255,255,0.2);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.2);
}

/* ---------- FORMS ---------- */
.form-control,
.form-select {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  padding: 0.48rem 0.75rem;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2);
  outline: none;
}

.form-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

/* ---------- ALERTS ---------- */
.alert {
  border-radius: 0.5rem;
  border: none;
  font-size: 0.9rem;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  color: var(--text-primary);
  border-left: 4px solid;
}

.alert-success { border-color: var(--success); }
.alert-danger  { border-color: var(--danger); }
.alert-warning { border-color: var(--warning); }
.alert-info    { border-color: var(--info); }

/* ---------- MODAL ---------- */
.modal-content {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  box-shadow: 0 0.5rem 3rem rgba(0,0,0,0.4);
}

.modal-header {
  background: transparent;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
  border-radius: 1rem 1rem 0 0;
}

.modal-header .btn-close {
  filter: invert(1);
}

/* ---------- PAGINATION ---------- */
.page-link {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 0.4rem;
  margin: 0 2px;
}

.page-item.active .page-link {
  background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
  border-color: transparent;
  color: #0f172a;
  font-weight: 700;
}

.page-link:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-primary);
}

/* ---------- GENEALOGY TREE ---------- */
.tree-container {
  overflow: auto;
  padding: 20px;
}

.tree ul {
  padding-top: 20px;
  position: relative;
}

.tree li {
  float: left;
  text-align: center;
  list-style-type: none;
  position: relative;
  padding: 20px 5px 0 5px;
}

.tree li::before,
.tree li::after {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  border-top: 2px solid rgba(255,255,255,0.15);
  width: 50%;
  height: 20px;
}

.tree li::after {
  right: auto;
  left: 50%;
  border-left: 2px solid rgba(255,255,255,0.15);
}

.tree li:only-child::after,
.tree li:only-child::before { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before,
.tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 2px solid rgba(255,255,255,0.15); border-radius: 0 5px 0 0; }
.tree li:first-child::after { border-radius: 5px 0 0 0; }
.tree ul ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 2px solid rgba(255,255,255,0.15);
  width: 0;
  height: 20px;
}

.tree .member-node {
  display: inline-block;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 10px 15px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 12px;
  width: 120px;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.tree .member-node:hover {
  background: var(--primary);
  color: #0f172a;
  transform: scale(1.05);
  border-color: var(--primary);
}

/* ---------- UTILITY ---------- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.bg-gradient-primary { background: linear-gradient(135deg, var(--primary-dark), var(--accent)); }
.bg-gradient-success { background: linear-gradient(135deg, #84fab0, #8fd3f4); }
.bg-gradient-info    { background: linear-gradient(135deg, #a8edea, #fed6e3); }
.bg-gradient-warning { background: linear-gradient(135deg, #f6d365, #fda085); }

/* ---------- ANIMATIONS ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fadeInUp { animation: fadeInUp 0.4s ease-out; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

/* ---------- DATATABLES ---------- */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  padding: 0.375rem 0.75rem;
  font-size: 0.88rem;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--primary);
  outline: none;
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
::-webkit-scrollbar-thumb { background: var(--primary-dark); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .content-wrapper {
    margin-left: 0 !important;
  }
  .topbar .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar-overlay.active {
    display: block;
  }
  .topbar .search-box {
    max-width: 240px;
  }
  .topbar .user-dropdown .user-name {
    display: none;
  }
  .main-content {
    padding: 1rem;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 1rem;
  }
  .topbar .search-box {
    max-width: 160px;
  }
  .main-content {
    padding: 0.75rem;
  }
  .card .card-body {
    padding: 1rem;
  }
  .stat-card .stat-value {
    font-size: 1.15rem;
  }
}

@media (max-width: 480px) {
  .topbar .search-box {
    display: none;
  }
  .main-content {
    padding: 0.5rem;
  }
}

/* ---------- PRINT ---------- */
@media print {
  .sidebar, .topbar, .sidebar-overlay, .no-print {
    display: none !important;
  }
  .content-wrapper {
    margin-left: 0 !important;
  }
  .card {
    box-shadow: none;
    border: 1px solid #dee2e6;
  }
}

/* h1, h2, h3, h4, h5, h6,
.text-white {
  color: var(--text-primary) !important;
} */

.swal2-toast h2:where(.swal2-title) {
  color: rgba(48, 48, 48, 0.829) !important;
}

.swal2-confirm:focus {
  box-shadow: 0 0 0 3px var(--primary) !important;
}

.swal2-confirm:active {
  background-color: var(--primary) !important;
}

.swal2-confirm:hover {
  background-color: var(--primary) !important;
}

.swal2-confirm:disabled {
  background-color: var(--primary) !important;
}

.swal2-confirm:disabled:hover {
  background-color: var(--primary) !important;
}

.swal2-confirm:disabled:focus {
}

/* Sidebar close button (cross icon) - default hidden, mobile pe dikhega */
.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  z-index: 10;
  padding: 0.25rem 0.5rem;
  border-radius: 0.4rem;
  transition: background 0.2s;
}
.sidebar-close-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--danger);
}

/* Toggle button hamesha dikhega (desktop + mobile dono pe) */
.topbar .sidebar-toggle {
  display: flex;
}

/* ---------- DESKTOP: collapse behaviour ---------- */
@media (min-width: 993px) {
  .sidebar.collapsed {
    transform: translateX(-100%);
  }
  .content-wrapper.expanded {
    margin-left: 0;
  }
}

/* ---------- MOBILE: off-canvas behaviour ---------- */
/* ---------- MOBILE: off-canvas behaviour ---------- */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%) !important;
    transition: transform 0.3s ease !important;
    z-index: 1055; /* overlay se upar guarantee */
  }
  .sidebar.active {
    transform: translateX(0) !important;
  }
  .content-wrapper {
    margin-left: 0 !important;
  }
  .sidebar-close-btn {
    display: block !important;
    z-index: 1060; /* sidebar ke andar sabse upar */
    pointer-events: auto;
  }
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1040;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto; /* zaroori hai, warna click through ho jayega */
}