/* ==========================================================================
   VPNXHUB UI Redesign — Professional sidebar dashboard shell
   Loaded last so it overrides legacy .dashboard-menu pill styles.
   Shared by admin + client dashboards.
   ========================================================================== */

/* --- Intro banner polish --- */
.client-dashboard-page .dashboard-intro,
.admin-page .dashboard-intro {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.16);
  background:
    radial-gradient(1100px 220px at 0% -40%, rgba(37, 99, 235, 0.22), transparent 60%),
    radial-gradient(900px 200px at 100% 140%, rgba(14, 165, 233, 0.18), transparent 60%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(2, 6, 23, 0.86));
}

.client-dashboard-page .dashboard-intro::before,
.admin-page .dashboard-intro::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.5);
}

/* --- Two-column shell --- */
.dash-shell {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 26px;
  align-items: start;
  margin-top: 20px;
}

/* Wide desktop: give the sidebar + panels more room and shift left */
@media (min-width: 1025px) {
  .dash-shell,
  .client-dashboard-page .dashboard-intro,
  .admin-page .dashboard-intro {
    width: min(1560px, calc(100% - 48px));
    max-width: none;
  }
}

.dash-content {
  min-width: 0;
}

.dash-content > .admin-panels,
.dash-content > .dashboard-grid {
  margin-top: 0;
}

/* --- Sidebar --- */
.dash-sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.9));
  box-shadow:
    0 24px 60px rgba(2, 6, 23, 0.55),
    0 0 0 1px rgba(148, 163, 184, 0.06) inset;
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.4) transparent;
}

.dash-sidebar::-webkit-scrollbar {
  width: 8px;
}

.dash-sidebar::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.3);
  border-radius: 999px;
}

.dash-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.dash-sidebar-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 12px;
  margin: 0;
  font-family: 'Poppins', 'Inter', sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e2e8f0;
}

.dash-sidebar-title .dash-sidebar-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

/* --- Nav --- */
.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  background: none;
  border: none;
}

.dash-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-nav-group + .dash-nav-group {
  margin-top: 14px;
}

.dash-nav-group-title {
  padding: 9px 12px 5px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #64748b;
}

/* --- Nav items (override legacy .dashboard-menu-item) --- */
.dash-nav .dashboard-menu-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 12px 15px;
  border-radius: 13px;
  border: 1px solid transparent;
  background: transparent;
  color: #cbd5e1;
  font-size: 0.98rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.2;
  position: relative;
  overflow: visible;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.dash-nav .dashboard-menu-item .dash-nav-ico {
  flex-shrink: 0;
  width: 21px;
  height: 21px;
  color: #94a3b8;
  transition: color 180ms ease, transform 180ms ease;
}

.dash-nav .dashboard-menu-item::after {
  display: none;
}

.dash-nav .dashboard-menu-item:hover,
.dash-nav .dashboard-menu-item:focus-visible {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.22);
  color: #f8fafc;
  transform: translateX(2px);
  outline: none;
}

.dash-nav .dashboard-menu-item:hover .dash-nav-ico,
.dash-nav .dashboard-menu-item:focus-visible .dash-nav-ico {
  color: #7dd3fc;
}

.dash-nav .dashboard-menu-item.is-active {
  background: linear-gradient(100deg, rgba(37, 99, 235, 0.34), rgba(14, 165, 233, 0.18));
  border-color: rgba(56, 189, 248, 0.45);
  color: #f8fafc;
  font-weight: 600;
  box-shadow:
    0 10px 26px rgba(14, 116, 233, 0.3),
    0 0 0 1px rgba(56, 189, 248, 0.12) inset;
}

.dash-nav .dashboard-menu-item.is-active::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 56%;
  border-radius: 999px;
  background: linear-gradient(180deg, #7dd3fc, #38bdf8);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.85);
}

.dash-nav .dashboard-menu-item.is-active .dash-nav-ico {
  color: #38bdf8;
}

.dash-nav .dashboard-menu-item .menu-badge {
  margin-left: auto;
}

/* Bright theme adjustments */
html[data-theme='bright'] .dash-sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.92));
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.12);
}

html[data-theme='bright'] .dash-sidebar-title {
  color: #0f172a;
}

html[data-theme='bright'] .dash-nav .dashboard-menu-item {
  color: #334155;
}

html[data-theme='bright'] .dash-nav .dashboard-menu-item .dash-nav-ico {
  color: #64748b;
}

html[data-theme='bright'] .dash-nav .dashboard-menu-item:hover,
html[data-theme='bright'] .dash-nav .dashboard-menu-item:focus-visible {
  background: rgba(37, 99, 235, 0.1);
  color: #0f172a;
}

html[data-theme='bright'] .dash-nav .dashboard-menu-item.is-active {
  background: linear-gradient(100deg, rgba(37, 99, 235, 0.18), rgba(14, 165, 233, 0.1));
  color: #0f172a;
}

html[data-theme='bright'] .dash-nav .dashboard-menu-item.is-active .dash-nav-ico {
  color: #2563eb;
}

/* --- Mobile menu toggle (hidden on desktop) --- */
.dash-sidebar-toggle {
  display: none;
}

/* --- Tablet & below: sidebar moves above the content, items wrap into groups --- */
@media (max-width: 1024px) {
  .dash-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .dash-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  .dash-sidebar-title {
    padding: 4px 6px 10px;
  }

  .dash-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .dash-nav-group {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .dash-nav-group + .dash-nav-group {
    margin-top: 0;
  }

  .dash-nav-group-title {
    width: 100%;
    padding: 6px 4px 0;
  }

  .dash-nav .dashboard-menu-item {
    width: auto;
    flex: 0 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dash-nav .dashboard-menu-item:hover,
  .dash-nav .dashboard-menu-item:focus-visible {
    transform: translateY(-1px);
  }

  .dash-nav .dashboard-menu-item.is-active::before {
    display: none;
  }
}

/* --- Phone: compact single-row horizontal scroll rail (no giant tall menu) --- */
@media (max-width: 768px) {
  .dash-sidebar {
    padding: 8px;
    border-radius: 16px;
  }

  .dash-sidebar-title {
    display: none;
  }

  .dash-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  /* Flatten groups so all items flow into one scrollable row */
  .dash-nav-group {
    display: contents;
  }

  .dash-nav-group-title {
    display: none;
  }

  .dash-nav .dashboard-menu-item {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
    font-size: 0.9rem;
    padding: 9px 13px;
    gap: 9px;
  }

  .dash-nav .dashboard-menu-item .dash-nav-ico {
    width: 18px;
    height: 18px;
  }

  .dash-nav::-webkit-scrollbar {
    height: 6px;
  }

  .dash-nav::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.35);
    border-radius: 999px;
  }

  .dash-nav::-webkit-scrollbar-track {
    background: transparent;
  }
}
