/* ============================================================
   NEXLINK ADMIN PANEL - style.css
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS VARIABLES - LIGHT MODE
   ============================================================ */
:root {
  --primary-color:    #6C5CE7;
  --primary-light:    #A29BFE;
  --primary-dark:     #4834D4;
  --primary-glow:     rgba(108, 92, 231, 0.18);

  --secondary-color:  #00B894;
  --accent-color:     #FDCB6E;
  --danger-color:     #E17055;
  --info-color:       #74B9FF;

  --bg-main:          #F0F2FB;
  --bg-card:          #FFFFFF;
  --bg-sidebar:       #FFFFFF;
  --bg-header:        #FFFFFF;
  --bg-hover:         #F5F3FF;
  --bg-input:         #F0F2FB;

  --text-primary:     #111827;
  --text-secondary:   #6B7280;
  --text-muted:       #9CA3AF;
  --text-light:       #F9FAFB;
  --text-sidebar:     #374151;
  --text-sidebar-active: #6C5CE7;

  --border-color:     #E5E7EB;
  --border-light:     rgba(108, 92, 231, 0.1);

  --shadow-sm:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:        0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:        0 10px 40px rgba(0,0,0,0.12);
  --shadow-primary:   0 8px 24px rgba(108, 92, 231, 0.25);

  --sidebar-width:           260px;
  --sidebar-collapsed-width: 70px;
  --header-height:           68px;

  --transition-fast:   0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow:   0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-pill: 999px;
}

/* ============================================================
   CSS VARIABLES - DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --primary-color:    #7C6FF5;
  --primary-light:    #A29BFE;
  --primary-dark:     #6C5CE7;
  --primary-glow:     rgba(124, 111, 245, 0.2);

  --bg-main:          #0F1117;
  --bg-card:          #1A1D2E;
  --bg-sidebar:       #13151F;
  --bg-header:        #13151F;
  --bg-hover:         #22263A;
  --bg-input:         #22263A;

  --text-primary:     #F1F3FF;
  --text-secondary:   #9CA3AF;
  --text-muted:       #6B7280;
  --text-sidebar:     #CBD5E1;
  --text-sidebar-active: #A29BFE;

  --border-color:     rgba(255, 255, 255, 0.07);
  --border-light:     rgba(124, 111, 245, 0.15);

  --shadow-sm:        0 1px 3px rgba(0,0,0,0.3);
  --shadow-md:        0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg:        0 10px 40px rgba(0,0,0,0.5);
  --shadow-primary:   0 8px 24px rgba(108, 92, 231, 0.4);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-main);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background var(--transition-normal), color var(--transition-normal);
}
a  { text-decoration: none; color: inherit; }
ul { list-style: none; padding: 0; margin: 0; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }

/* ============================================================
   LAYOUT WRAPPER
   ============================================================ */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR — STRUCTURE
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--transition-slow);
  overflow: hidden;           /* clip horizontally */
  box-shadow: var(--shadow-sm);
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

/* ── Logo ──────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-primary);
}

.sidebar-logo .logo-icon i { color: #fff; font-size: 16px; }

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  transition: opacity var(--transition-fast);
}

.sidebar-logo .logo-text span { color: var(--primary-color); }
.sidebar.collapsed .sidebar-logo .logo-text { opacity: 0; pointer-events: none; }

/* ── Collapse bar (below logo) ──────────────────────────────── */
.sidebar-collapse-bar {
  flex-shrink: 0;
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition:
    background    var(--transition-fast),
    border-color  var(--transition-fast),
    color         var(--transition-fast);
}

.sidebar-collapse-btn:hover {
  background:   var(--bg-hover);
  border-color: var(--border-light);
  color:        var(--primary-color);
}

/* Chevron rotates when collapsed */
.collapse-icon {
  font-size: 11px;
  flex-shrink: 0;
  transition: transform var(--transition-slow);
}
.sidebar.collapsed .collapse-icon { transform: rotate(180deg); }

/* Label fades out when collapsed */
.collapse-label {
  flex: 1;
  overflow: hidden;
  transition: opacity var(--transition-fast), width var(--transition-fast);
}
.sidebar.collapsed .collapse-label { opacity: 0; width: 0; }

/* ── Navigation (independent scroll) ───────────────────────── */
.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 0;
  overscroll-behavior: contain; /* do NOT propagate scroll to page */
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }

/* Section labels */
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 12px 20px 5px;
  white-space: nowrap;
  overflow: hidden;
  transition:
    opacity  var(--transition-fast),
    height   var(--transition-fast),
    padding  var(--transition-fast);
}
.sidebar.collapsed .nav-section-label {
  opacity: 0; height: 0; padding-top: 0; padding-bottom: 0;
}

/* Nav item */
.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--text-sidebar);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color      var(--transition-fast);
}

/* Active bar */
.nav-link::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary-color);
  border-radius: 0 2px 2px 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.nav-link:hover  { color: var(--primary-color); background: var(--bg-hover); }
.nav-link.active { color: var(--text-sidebar-active); background: var(--primary-glow); font-weight: 600; }
.nav-link.active::before { opacity: 1; }

/* Icon wrapper */
.nav-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  font-size: 15px;
  transition:
    background var(--transition-fast),
    color      var(--transition-fast),
    box-shadow var(--transition-fast);
}
.nav-link.active .nav-icon {
  background: var(--primary-color);
  color: #fff;
  box-shadow: var(--shadow-primary);
}
.nav-link:hover .nav-icon { color: var(--primary-color); }

/* Text */
.nav-text {
  flex: 1;
  transition: opacity var(--transition-fast), width var(--transition-fast);
}
.sidebar.collapsed .nav-text { opacity: 0; width: 0; overflow: hidden; }

/* Badge */
.nav-badge {
  background: var(--primary-color);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  transition: opacity var(--transition-fast), width var(--transition-fast);
}
.sidebar.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; }

/* Arrow */
.nav-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition:
    transform var(--transition-normal),
    opacity   var(--transition-fast),
    width     var(--transition-fast);
}
.nav-item.open > .nav-link .nav-arrow { transform: rotate(90deg); }
.sidebar.collapsed .nav-arrow { opacity: 0; width: 0; overflow: hidden; }

/* ── Submenu ─────────────────────────────────────────────────── */
.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}
.nav-item.open .submenu { max-height: 300px; }

/*
 * KEY RULE: force submenus closed in collapsed mode.
 * .open is NOT removed — so when the sidebar re-expands the
 * submenu reappears automatically without any JS change.
 */
.sidebar.collapsed .submenu {
  max-height: 0 !important;
  overflow: hidden;
  pointer-events: none;
}

.submenu .submenu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px 8px 66px;
  color: var(--text-secondary);
  font-size: 13px;
  position: relative;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.submenu .submenu-link::before {
  content: '';
  position: absolute;
  left: 52px;
  width: 5px; height: 5px;
  background: var(--border-color);
  border-radius: 50%;
  transition: background var(--transition-fast);
}
.submenu .submenu-link:hover          { color: var(--primary-color); }
.submenu .submenu-link:hover::before  { background: var(--primary-color); }
.submenu .submenu-link.active         { color: var(--primary-color); font-weight: 600; }
.submenu .submenu-link.active::before { background: var(--primary-color); }

/* ── Tooltip on collapsed icons ─────────────────────────────── */
.sidebar.collapsed .nav-link[title]::after {
  content:        attr(title);
  position:       fixed;
  left:           calc(var(--sidebar-collapsed-width) + 10px);
  background:     var(--text-primary);
  color:          var(--bg-card);
  font-size:      12px;
  font-weight:    600;
  padding:        5px 12px;
  border-radius:  var(--radius-sm);
  white-space:    nowrap;
  opacity:        0;
  pointer-events: none;
  transition:     opacity var(--transition-fast);
  z-index:        1200;
  box-shadow:     var(--shadow-md);
}
.sidebar.collapsed .nav-link[title]:hover::after { opacity: 1; }

/* ── Bottom profile section ─────────────────────────────────── */
.sidebar-footer {
  position: relative;   /* dropup anchor */
  padding: 12px;
  flex-shrink: 0;
  border-top: 1px solid var(--border-color);
}

.sb-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  transition:
    background  var(--transition-fast),
    box-shadow  var(--transition-fast);
}
.sb-profile:hover         { background: var(--bg-hover); }
.sb-profile.is-open       { background: var(--primary-glow); box-shadow: 0 0 0 1px var(--border-light); }

/* Avatar */
.sb-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid var(--primary-light);
  transition: border-color var(--transition-fast);
}
.sb-profile.is-open .sb-avatar { border-color: var(--primary-color); }

/* Name + role */
.sb-profile-info {
  flex: 1; min-width: 0; overflow: hidden;
  transition: opacity var(--transition-fast), width var(--transition-fast);
}
.sb-profile-name {
  display: block;
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-profile-role {
  display: block;
  font-size: 11px; color: var(--text-muted);
}

/* Chevron */
.sb-profile-chevron {
  font-size: 10px; color: var(--text-muted); flex-shrink: 0;
  transition: transform var(--transition-normal), color var(--transition-fast);
}
.sb-profile.is-open .sb-profile-chevron {
  transform: rotate(180deg);
  color: var(--primary-color);
}

/* Hide text/chevron in collapsed mode */
.sidebar.collapsed .sb-profile-info,
.sidebar.collapsed .sb-profile-chevron {
  opacity: 0; width: 0; overflow: hidden;
}

/* ── Profile dropup ─────────────────────────────────────────── */
.sb-profile-dropdown {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 12px; right: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity    var(--transition-normal),
    visibility var(--transition-normal),
    transform  var(--transition-normal);
  z-index: 300;
}
.sb-profile-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
/* Wider when sidebar collapsed so it isn't clipped */
.sidebar.collapsed .sb-profile-dropdown {
  left: 4px; right: 4px; min-width: 180px;
}

.sb-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.sb-dropdown-item i {
  width: 16px; text-align: center;
  color: var(--text-muted); font-size: 13px;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}
.sb-dropdown-item:hover             { background: var(--bg-hover); color: var(--primary-color); }
.sb-dropdown-item:hover i           { color: var(--primary-color); }

.sb-dropdown-divider {
  border-top: 1px solid var(--border-color); margin: 4px 0;
}

.sb-dropdown-logout       { color: var(--danger-color); }
.sb-dropdown-logout i     { color: var(--danger-color); }
.sb-dropdown-logout:hover { background: rgba(225,112,85,0.08); color: var(--danger-color); }
.sb-dropdown-logout:hover i { color: var(--danger-color); }

/* ============================================================
   HEADER
   ============================================================ */
.main-content {
  flex: 1;
  min-width: 0; /* <--- YEH HAI ASLI JADOO JO MISSING THA */
  margin-left: var(--sidebar-width);
  transition: margin-left var(--transition-slow);
  display: flex; 
  flex-direction: column; 
  min-height: 100vh;
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed-width); }

.main-header {
  position: sticky; top: 0; z-index: 999;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center;
  padding: 0 24px; gap: 16px;
  box-shadow: var(--shadow-sm);
}

.header-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
}
.header-breadcrumb a     { color: var(--text-muted); transition: color var(--transition-fast); }
.header-breadcrumb a:hover { color: var(--primary-color); }
.header-breadcrumb .current { color: var(--text-primary); font-weight: 600; }

.header-search {
  flex: 1; max-width: 340px; position: relative;
}
.header-search input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: inherit; font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}
.header-search input:focus {
  border-color: var(--primary-color);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search .search-icon {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px;
}

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.header-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-input);
  font-size: 16px;
  transition: background var(--transition-fast), color var(--transition-fast);
  position: relative;
}
.header-btn:hover { background: var(--primary-glow); color: var(--primary-color); }

.notif-badge {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: var(--danger-color);
  border-radius: 50%;
  border: 2px solid var(--bg-header);
}

/* Theme toggle */
.theme-toggle {
  width: 50px; height: 26px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  display: flex; align-items: center; padding: 2px;
  cursor: pointer;
  transition: background var(--transition-normal);
}
.theme-toggle .toggle-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary-color);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--transition-normal);
}
.theme-toggle .toggle-thumb i { font-size: 10px; color: #fff; }
[data-theme="dark"] .theme-toggle .toggle-thumb { transform: translateX(24px); }

/* User dropdown */
.user-dropdown { position: relative; }
.user-profile-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 12px 5px 5px;
  background: var(--bg-input);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.user-profile-btn:hover { border-color: var(--primary-color); box-shadow: 0 0 0 3px var(--primary-glow); }
.user-profile-btn .user-name-header { font-size: 12.5px; font-weight: 600; display: block; }
.user-profile-btn .user-role-header { font-size: 11px; color: var(--text-muted); display: block; }

.dropdown-menu-custom {
  position: absolute; top: calc(100% + 10px); right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity var(--transition-normal), visibility var(--transition-normal), transform var(--transition-normal);
  z-index: 100;
}
.user-dropdown.open .dropdown-menu-custom { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu-custom a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 13px; font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dropdown-menu-custom a:hover { background: var(--bg-hover); color: var(--primary-color); }
.dropdown-menu-custom a i     { width: 16px; text-align: center; color: var(--text-muted); }
.dropdown-divider-custom      { border-top: 1px solid var(--border-color); margin: 6px 0; }
.dropdown-menu-custom .logout-link   { color: var(--danger-color); }
.dropdown-menu-custom .logout-link i { color: var(--danger-color); }

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

.page-title-section {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.page-title   { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.page-subtitle{ font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  /* overflow: hidden; */
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.card-header-custom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 0;
}
.card-title      { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.card-body-custom{ padding: 18px 20px 20px; }
.card-options-btn{
  color: var(--text-muted); font-size: 14px;
  padding: 4px 8px; border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.card-options-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.stat-card .stat-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 10px;
}
.stat-card .stat-label {
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.stat-card .stat-options { color: var(--text-muted); font-size: 14px; }
.stat-card .stat-value {
  font-size: 28px; font-weight: 800; color: var(--text-primary);
  letter-spacing: -1px; line-height: 1.1; margin-bottom: 6px;
  font-family: 'DM Mono', monospace;
}
.stat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.stat-badge.up   { color: #00B894; background: rgba(0,184,148,0.12); }
.stat-badge.down { color: var(--danger-color); background: rgba(225,112,85,0.12); }

.stat-card .stat-footer {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 12px; color: var(--text-muted);
}
.stat-card .stat-footer a {
  color: var(--primary-color); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  transition: gap var(--transition-fast);
}
.stat-card .stat-footer a:hover { gap: 8px; }
.stat-mini-chart { margin-top: 8px; height: 50px; position: relative; overflow: hidden; }

/* ============================================================
   DONUT
   ============================================================ */
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-chart-container { position: relative; flex-shrink: 0; }
.donut-center-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); text-align: center;
}
.donut-center-text .donut-number {
  font-size: 20px; font-weight: 800; color: var(--text-primary);
  font-family: 'DM Mono', monospace;
}
.donut-center-text .donut-label { font-size: 10px; color: var(--text-muted); }
.donut-legend { flex: 1; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; }
.legend-dot   { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.legend-label { flex: 1; color: var(--text-secondary); }
.legend-value { font-weight: 600; color: var(--text-primary); }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-item  { margin-bottom: 12px; }
.progress-header{ display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.progress-label { color: var(--text-secondary); font-weight: 500; }
.progress-value { color: var(--text-primary); font-weight: 700; }
.progress-track {
  height: 6px; background: var(--bg-input);
  border-radius: var(--radius-pill); overflow: hidden;
}
.progress-fill  {
  height: 100%; border-radius: var(--radius-pill);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   PERIOD TABS
   ============================================================ */
.period-tabs {
  display: flex; gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-sm); padding: 3px;
}
.period-tab {
  padding: 5px 14px; border-radius: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}
.period-tab.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ============================================================
   EARNING CARD (dark gradient)
   ============================================================ */
.earning-card {
  background: linear-gradient(135deg, #2D1B8A 0%, var(--primary-color) 50%, #8B5CF6 100%);
  border-radius: var(--radius-lg);
  padding: 24px; color: #fff;
  position: relative; overflow: hidden; border: none;
}
.earning-card::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.06); border-radius: 50%;
}
.earning-card::after {
  content: ''; position: absolute; bottom: -60px; left: -20px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.04); border-radius: 50%;
}
.earning-card .earning-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px; position: relative; z-index: 1;
}
.earning-card .earning-title  { font-size: 14px; font-weight: 600; opacity: 0.9; }
.earning-card .earning-opts   { opacity: 0.7; font-size: 14px; }
.earning-card .earning-main   { text-align: center; margin-bottom: 24px; position: relative; z-index: 1; }
.earning-card .earning-amount {
  font-size: 32px; font-weight: 800;
  font-family: 'DM Mono', monospace; letter-spacing: -1px;
}
.earning-card .earning-orders { font-size: 12px; opacity: 0.7; margin-top: 2px; }
.earning-card .earning-stats  {
  display: flex; justify-content: space-between;
  position: relative; z-index: 1; margin-bottom: 20px;
}
.earning-card .earning-stat-item           { font-size: 12px; opacity: 0.85; }
.earning-card .earning-stat-item .stat-dot {
  width: 8px; height: 8px; border-radius: 2px;
  display: inline-block; margin-right: 5px;
}
.earning-card .earning-stat-item .stat-amount {
  font-size: 16px; font-weight: 700;
  font-family: 'DM Mono', monospace; display: block; margin-top: 2px;
}
.earning-order-status              { position: relative; z-index: 1; }
.earning-order-status .status-title{ font-size: 12px; font-weight: 600; opacity: 0.8; margin-bottom: 10px; }
.earning-progress-bar {
  height: 8px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.15);
  margin-bottom: 14px; overflow: hidden; display: flex;
}
.earning-progress-bar .seg-paid      { background: #A29BFE; }
.earning-progress-bar .seg-cancelled { background: rgba(255,255,255,0.45); }
.earning-progress-bar .seg-refunded  { background: rgba(255,255,255,0.2); }
.earning-status-labels { display: flex; flex-direction: column; gap: 6px; }
.earning-status-labels .status-label-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; opacity: 0.85;
}
.status-indicator { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.si-paid      { background: #A29BFE; }
.si-cancelled { background: rgba(255,255,255,0.45); }
.si-refunded  { background: rgba(255,255,255,0.2); }
.status-pct   { margin-left: auto; font-weight: 700; }

/* ============================================================
   MEETINGS
   ============================================================ */
.meeting-item { padding: 14px 0; border-bottom: 1px solid var(--border-color); }
.meeting-item:last-child { border-bottom: none; }
.meeting-item .meeting-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 4px;
}
.meeting-item .meeting-title  { font-size: 13.5px; font-weight: 600; }
.meeting-item .meeting-opts   { color: var(--text-muted); font-size: 13px; }
.meeting-item .meeting-meta   { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.meeting-platform {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  background: rgba(52,199,89,0.12); color: #34C759;
  border-radius: var(--radius-pill); font-weight: 600; font-size: 11px;
}
.meeting-department { color: var(--text-muted); }
.meeting-time       { color: var(--text-secondary); font-weight: 500; }
.meeting-time i     { color: var(--primary-color); margin-right: 3px; }

/* ============================================================
   HEATMAP
   ============================================================ */
.heatmap-grid { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.heatmap-row  { display: flex; gap: 3px; align-items: center; }
.heatmap-label{ font-size: 10px; color: var(--text-muted); width: 30px; text-align: right; margin-right: 4px; }
.heatmap-cell {
  flex: 1; aspect-ratio: 1; border-radius: 3px;
  background: var(--bg-input);
  transition: transform var(--transition-fast);
  cursor: pointer;
}
.heatmap-cell:hover    { transform: scale(1.2); }
.heatmap-cell.level-1  { background: rgba(108,92,231,0.15); }
.heatmap-cell.level-2  { background: rgba(108,92,231,0.30); }
.heatmap-cell.level-3  { background: rgba(108,92,231,0.50); }
.heatmap-cell.level-4  { background: rgba(108,92,231,0.75); }
.heatmap-cell.level-5  { background: var(--primary-color); }
.heatmap-days {
  display: grid; font-size: 10px; color: var(--text-muted);
  text-align: center; padding-left: 34px; margin-bottom: 4px;
}

/* ============================================================
   PIPELINE
   ============================================================ */
.pipeline-item { padding: 12px 0; border-bottom: 1px solid var(--border-color); }
.pipeline-item:last-child { border-bottom: none; }
.pipeline-item .pipeline-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.pipeline-stage { font-size: 13px; font-weight: 600; }
.pipeline-count { font-size: 13px; font-weight: 700; font-family: 'DM Mono', monospace; }
.pipeline-track {
  height: 8px; background: var(--bg-input);
  border-radius: var(--radius-pill); overflow: hidden;
}
.pipeline-fill { height: 100%; border-radius: var(--radius-pill); }

/* ============================================================
   CUSTOMERS TABLE
   ============================================================ */
.table-wrapper  { overflow-x: auto; }
.customers-table{ width: 100%; border-collapse: collapse; }
.customers-table th {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); padding: 12px 16px;
  text-align: left; border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.customers-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border-color);
  font-size: 13.5px; vertical-align: middle;
}
.customers-table tr:last-child td  { border-bottom: none; }
.customers-table tr:hover td       { background: var(--bg-hover); }
.customer-cell  { display: flex; align-items: center; gap: 10px; }
.customer-avatar-placeholder {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.customer-name  { font-weight: 600; font-size: 13.5px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600;
}
.status-pill.active  { background: rgba(0,184,148,0.12);   color: #00B894; }
.status-pill.pending { background: rgba(253,203,110,0.15); color: #D4A017; }

.action-btn-sm {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 12px;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.action-btn-sm:hover { background: var(--bg-hover); color: var(--primary-color); }

.table-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border-color);
  font-size: 13px; color: var(--text-muted);
}
.pagination-btns { display: flex; gap: 4px; }
.page-btn {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-input); cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}
.page-btn.active              { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.page-btn:hover:not(.active)  { border-color: var(--primary-color); color: var(--primary-color); }

.table-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-color);
}
.table-search { position: relative; }
.table-search input {
  padding: 8px 14px 8px 36px;
  background: var(--bg-input); border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: inherit; font-size: 13px; color: var(--text-primary);
  width: 220px; outline: none;
  transition: border-color var(--transition-fast), width var(--transition-fast), box-shadow var(--transition-fast);
}
.table-search input:focus {
  border-color: var(--primary-color); width: 280px;
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.table-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; }

/* ============================================================
   TASK LIST
   ============================================================ */
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-md);
  position: relative; cursor: pointer;
  transition: background var(--transition-fast);
}
.task-item:hover { background: var(--bg-hover); }
.task-drag-handle {
  color: var(--text-muted); font-size: 11px; cursor: grab;
  opacity: 0; transition: opacity var(--transition-fast);
}
.task-item:hover .task-drag-handle { opacity: 1; }
.task-checkbox {
  width: 18px; height: 18px; border: 2px solid var(--border-color);
  border-radius: 5px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
}
.task-item.done .task-checkbox { background: var(--primary-color); border-color: var(--primary-color); }
.task-item.done .task-checkbox::after {
  content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
  font-size: 9px; color: #fff;
}
.task-text         { flex: 1; font-size: 13.5px; font-weight: 500; }
.task-item.done .task-text { text-decoration: line-through; color: var(--text-muted); }
.task-time         { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.task-del-btn      { color: var(--text-muted); font-size: 13px; opacity: 0; transition: opacity var(--transition-fast), color var(--transition-fast); }
.task-item:hover .task-del-btn { opacity: 1; }
.task-del-btn:hover { color: var(--danger-color); }
.task-priority     { width: 3px; position: absolute; left: 0; top: 8px; bottom: 8px; border-radius: 0 2px 2px 0; }
.priority-high     { background: var(--danger-color); }
.priority-medium   { background: var(--accent-color); }
.priority-low      { background: var(--secondary-color); }
.priority-none     { background: transparent; }

/* ============================================================
   DEALS OVERVIEW
   ============================================================ */
.deals-stats    { display: flex; gap: 24px; margin-bottom: 16px; }
.deal-stat-item { display: flex; align-items: center; gap: 10px; }
.deal-stat-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.deal-stat-icon.closed   { background: rgba(0,184,148,0.12);  color: var(--secondary-color); }
.deal-stat-icon.pipeline { background: rgba(116,185,255,0.12); color: var(--info-color); }
.deal-stat-value  { font-size: 20px; font-weight: 800; font-family: 'DM Mono', monospace; }
.deal-stat-label  { font-size: 11px; color: var(--text-muted); }
.deal-stat-badge  { font-size: 11px; font-weight: 600; color: var(--primary-color); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary-custom {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; background: var(--primary-color); color: #fff;
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-primary);
  transition: background var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal);
}
.btn-primary-custom:hover {
  background: var(--primary-dark); transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(108,92,231,0.35); color: #fff;
}
.btn-outline-custom {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; background: transparent;
  color: var(--primary-color); border: 1.5px solid var(--primary-color);
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
  transition: background var(--transition-normal), transform var(--transition-normal);
}
.btn-outline-custom:hover { background: var(--primary-glow); transform: translateY(-1px); }

/* ============================================================
   REVENUE / MISC
   ============================================================ */
.revenue-value {
  font-size: 26px; font-weight: 800;
  font-family: 'DM Mono', monospace; letter-spacing: -1px;
}
.revenue-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; font-weight: 600;
  color: var(--secondary-color); background: rgba(0,184,148,0.1);
  padding: 2px 8px; border-radius: var(--radius-pill); margin-left: 8px;
}
.view-all-link {
  font-size: 12.5px; font-weight: 600; color: var(--primary-color);
  display: inline-flex; align-items: center; gap: 4px;
  transition: gap var(--transition-fast);
}
.view-all-link:hover { gap: 8px; color: var(--primary-color); }
.font-mono { font-family: 'DM Mono', monospace; }

/* ============================================================
   FOOTER
   ============================================================ */
.main-footer {
  padding: 18px 24px; border-top: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-muted);
  background: var(--bg-card);
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-muted); transition: color var(--transition-fast); }
.footer-links a:hover { color: var(--primary-color); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.4s ease forwards; }
.delay-1 { animation-delay: 0.05s; opacity: 0; }
.delay-2 { animation-delay: 0.10s; opacity: 0; }
.delay-3 { animation-delay: 0.15s; opacity: 0; }
.delay-4 { animation-delay: 0.20s; opacity: 0; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.15); }
}
.pulse { animation: pulse-dot 2s infinite; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay { display: none; }

/* ============================================================
   MOBILE MENU BUTTON
   ============================================================ */
.mobile-menu-btn {
  display: none;
  width: 38px; height: 38px;
  align-items: center; justify-content: center;
  background: var(--bg-input); border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 16px;
  cursor: pointer; flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.mobile-menu-btn:hover { background: var(--primary-glow); color: var(--primary-color); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 0px;
    --sidebar-collapsed-width: 0px;
    --header-height: 60px;
  }

  /* Sidebar becomes offcanvas */
  .sidebar {
    width: 260px !important;
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  /* Collapse bar not needed on mobile */
  .sidebar-collapse-bar { display: none; }

  /* Overlay */
  .sidebar-overlay {
    display: block !important;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0; visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
  }
  .sidebar.mobile-open ~ .sidebar-overlay { opacity: 1; visibility: visible; }

  .main-content  { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex !important; }
  .page-content  { padding: 16px; }

  /* Profile dropdown full width */
  .sb-profile-dropdown { left: 8px; right: 8px; }
}

@media (max-width: 768px) {
  .header-search { max-width: 200px; }
  .user-profile-btn .user-info-header { display: none; }
  .header-breadcrumb { display: none; }
  .page-title { font-size: 18px; }
  .card:hover  { transform: none; }
  .stat-card:hover { transform: none; }
  .hide-mobile { display: none; }
  .main-footer { flex-direction: column; gap: 8px; text-align: center; }
}

@media (max-width: 576px) {
  .main-header  { padding: 0 14px; gap: 10px; }
  .header-search { display: none; }
  .page-content  { padding: 12px; }
  .stat-card .stat-value { font-size: 20px; }
}

@media print {
  .sidebar, .main-header, .main-footer,
  .header-actions, .page-title-section .btn-primary-custom { display: none !important; }
  .main-content { margin: 0; }
  .page-content { padding: 0; }
  .card, .stat-card { box-shadow: none; border: 1px solid #ddd; }
}

/* ============================================================
   TABLE HORIZONTAL SCROLL & STICKY COLUMNS FIX
   ============================================================ */
.card {
    /* Prevents the card from stretching beyond the screen */
    max-width: 100%; 
    overflow: hidden;
}

.table-responsive { 
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important; 
    -webkit-overflow-scrolling: touch; 
}

/* Force minimum width to trigger scrollbar inside the div */
table.customers-table {
    /* min-width: 1400px !important;  */
    width: 100% !important;
    table-layout: auto !important;
    margin-bottom: 0 !important;
}

/* Prevent normal columns from squeezing */
table.customers-table th, 
table.customers-table td {
    white-space: nowrap !important;
    vertical-align: middle;
}

/* Allow only specific columns (Status/Disp) to wrap text */
table.customers-table td.wrap-col {
    white-space: normal !important;
    min-width: 180px !important;
    line-height: 1.5;
}

/* Sticky Columns Magic */
.sticky-left-1 { position: sticky !important; left: 0; background-color: #fff !important; z-index: 2; border-right: 1px solid #f0f0f0; }
.sticky-left-2 { position: sticky !important; left: 40px; background-color: #fff !important; z-index: 2; box-shadow: 3px 0 5px -2px rgba(0,0,0,0.05); }
.sticky-right { position: sticky !important; right: 0; background-color: #fff !important; z-index: 2; box-shadow: -3px 0 5px -2px rgba(0,0,0,0.05); }

/* Header specific sticky bg */
thead th.sticky-left-1, 
thead th.sticky-left-2, 
thead th.sticky-right { 
    background-color: #f8f9fa !important; 
    z-index: 3 !important; 
}