/* Zackgo Premium Sidebar — Billion-Dollar Glass Navigation
   Shared across Admin, Executive, Clerk, Pro feature dashboards */

:root {
  --zg-sb-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --zg-sb-spring: cubic-bezier(0.34, 1.45, 0.64, 1);
  --zg-sb-dur: 0.28s;
  --zg-sb-width: 264px;
  --zg-sb-gold: #F97316;
  --zg-sb-gold-soft: rgba(249, 115, 22, 0.12);
  --zg-sb-gold-border: rgba(249, 115, 22, 0.28);
}

/* ── Base sidebar shell — frosted glass panel ── */
.sidebar.zg-sidebar-premium {
  width: var(--zg-sb-width);
  transition:
    transform var(--zg-sb-dur) var(--zg-sb-ease),
    box-shadow var(--zg-sb-dur) var(--zg-sb-ease);
  will-change: transform;
  overflow: hidden;
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
}

body.zg-sidebar-open {
  overflow: hidden;
}

/* Ambient light wash */
.sidebar.zg-sidebar-premium::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(480px 220px at 0% 0%, rgba(249, 115, 22, 0.14), transparent 58%),
    radial-gradient(380px 260px at 100% 100%, rgba(249, 115, 22, 0.06), transparent 62%);
  opacity: 0.9;
  z-index: 0;
  transition: opacity 0.4s ease;
}

/* Right edge gold hairline */
.sidebar.zg-sidebar-premium::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(249, 115, 22, 0.45) 0%,
    rgba(249, 115, 22, 0.12) 40%,
    transparent 75%
  );
  pointer-events: none;
  z-index: 2;
}

/* Dark theme / admin — matte black glass */
[data-theme="dark"] .sidebar.zg-sidebar-premium,
:root[data-theme="dark"] .sidebar.zg-sidebar-premium,
[data-theme="dark"] .sidebar.zg-sidebar-premium:has(.sidebar-nav),
:root[data-theme="dark"] .sidebar.zg-sidebar-premium:has(.sidebar-nav),
.sidebar.zg-sidebar-premium:has(.sb-nav),
body.zg-exec-shell-body .sidebar.zg-sidebar-premium {
  background:
    linear-gradient(180deg, rgba(15, 15, 15, 0.94) 0%, rgba(10, 10, 10, 0.97) 100%) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
  box-shadow:
    inset -1px 0 0 rgba(249, 115, 22, 0.08),
    4px 0 48px rgba(0, 0, 0, 0.32);
}

/* Light theme executive/clerk */
[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sidebar-nav),
:root[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sidebar-nav) {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 246, 242, 0.95) 100%) !important;
  border-right: 1px solid rgba(10, 10, 10, 0.06) !important;
  box-shadow:
    1px 0 0 rgba(10, 10, 10, 0.04),
    16px 0 56px -28px rgba(10, 10, 10, 0.1);
}

/* ── Mount entrance ── */
@keyframes zg-sb-nav-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.sidebar.zg-sidebar-premium.zg-sidebar-mounted .nav-btn,
.sidebar.zg-sidebar-premium.zg-sidebar-mounted .nav-item {
  animation: zg-sb-nav-in 0.48s var(--zg-sb-ease) backwards;
  animation-delay: calc(var(--zg-sb-i, 0) * 32ms);
}

/* ── Scrollbar ── */
.sidebar.zg-sidebar-premium .sb-nav,
.sidebar.zg-sidebar-premium .sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(249, 115, 22, 0.25) transparent;
  position: relative;
  z-index: 1;
  scroll-behavior: smooth;
  padding: 4px 10px;
}

.sidebar.zg-sidebar-premium .sb-nav::-webkit-scrollbar,
.sidebar.zg-sidebar-premium .sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar.zg-sidebar-premium .sb-nav::-webkit-scrollbar-thumb,
.sidebar.zg-sidebar-premium .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.22);
  border-radius: 100px;
  transition: background 0.2s ease;
}

.sidebar.zg-sidebar-premium .sb-nav:hover::-webkit-scrollbar-thumb,
.sidebar.zg-sidebar-premium .sidebar-nav:hover::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.38);
}

/* ── Section labels ── */
.sidebar.zg-sidebar-premium .sb-section,
.sidebar.zg-sidebar-premium .sidebar-section-label,
.sidebar.zg-sidebar-premium .nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  opacity: 0.72;
  padding: 16px 12px 8px;
  color: var(--zg-sb-gold);
  transition: opacity 0.2s ease;
}

[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sidebar-nav) .sidebar-section-label {
  color: rgba(10, 10, 10, 0.45);
}

/* ── Nav items — glass pills ── */
.sidebar.zg-sidebar-premium .nav-btn,
.sidebar.zg-sidebar-premium .nav-item {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 2px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  background: transparent;
  transition:
    background var(--zg-sb-dur) var(--zg-sb-ease),
    color 0.2s ease,
    transform 0.24s var(--zg-sb-spring),
    box-shadow 0.24s ease,
    border-color 0.24s ease;
}

/* Left gold rail indicator */
.sidebar.zg-sidebar-premium .nav-btn::before,
.sidebar.zg-sidebar-premium .nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #D4BC82, var(--zg-sb-gold));
  opacity: 0;
  transition:
    height 0.28s var(--zg-sb-spring),
    opacity 0.22s ease;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.5);
  z-index: 2;
}

.sidebar.zg-sidebar-premium .nav-btn:hover,
.sidebar.zg-sidebar-premium .nav-item:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sidebar-nav) .nav-item:hover {
  background: rgba(10, 10, 10, 0.04);
  border-color: rgba(10, 10, 10, 0.06);
}

.sidebar.zg-sidebar-premium .nav-btn:active,
.sidebar.zg-sidebar-premium .nav-item:active {
  transform: translateX(1px) scale(0.99);
}

/* Active state — glass gold pill */
.sidebar.zg-sidebar-premium .nav-btn.active,
.sidebar.zg-sidebar-premium .nav-item.active {
  background: var(--zg-sb-gold-soft) !important;
  border-color: var(--zg-sb-gold-border) !important;
  color: var(--zg-sb-gold) !important;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 4px 16px -8px rgba(249, 115, 22, 0.35);
}

.sidebar.zg-sidebar-premium .nav-btn.active::before,
.sidebar.zg-sidebar-premium .nav-item.active::before {
  height: 60%;
  opacity: 1;
}

/* Click ripple */
.zg-sb-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(249, 115, 22, 0.18);
  pointer-events: none;
  transform: scale(0);
  animation: zg-sb-ripple 0.55s var(--zg-sb-ease) forwards;
  z-index: 0;
}

@keyframes zg-sb-ripple {
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* Icon containers — glass chips */
.sidebar.zg-sidebar-premium .nav-icon,
.sidebar.zg-sidebar-premium .nav-item-icon {
  position: relative;
  z-index: 1;
  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);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition:
    background 0.22s ease,
    color 0.22s ease,
    transform 0.24s var(--zg-sb-spring),
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sidebar-nav) .nav-item-icon {
  background: rgba(10, 10, 10, 0.04);
  border-color: rgba(10, 10, 10, 0.06);
}

.sidebar.zg-sidebar-premium .nav-btn:hover .nav-icon,
.sidebar.zg-sidebar-premium .nav-item:hover .nav-item-icon {
  transform: scale(1.06);
  border-color: rgba(249, 115, 22, 0.2);
}

.sidebar.zg-sidebar-premium .nav-btn.active .nav-icon,
.sidebar.zg-sidebar-premium .nav-item.active .nav-item-icon {
  background: rgba(249, 115, 22, 0.16);
  border-color: rgba(249, 115, 22, 0.28);
  color: var(--zg-sb-gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.sidebar.zg-sidebar-premium .nav-btn .nav-text,
.sidebar.zg-sidebar-premium .nav-item {
  z-index: 1;
}

/* Admin sidebar specifics */
.sidebar.zg-sidebar-premium:has(.sb-nav) .nav-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.92);
}

.sidebar.zg-sidebar-premium:has(.sb-nav) .nav-btn.active {
  background: rgba(249, 115, 22, 0.14) !important;
  color: var(--zg-sb-gold) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 6px 20px -10px rgba(249, 115, 22, 0.4);
}

.sidebar.zg-sidebar-premium:has(.sb-nav) .nav-btn.active .nav-icon {
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.3);
}

.sidebar.zg-sidebar-premium:has(.sb-nav) .nav-icon {
  font-size: 14px;
  color: rgba(245, 243, 238, 0.88);
}

.sidebar.zg-sidebar-premium:has(.sb-nav) .nav-icon .zg-i {
  color: inherit;
  stroke: currentColor;
  opacity: 0.92;
}

.sidebar.zg-sidebar-premium:has(.sb-nav) .nav-btn:hover .nav-icon .zg-i {
  opacity: 1;
}

.sidebar.zg-sidebar-premium:has(.sb-nav) .nav-btn.active .nav-icon .zg-i {
  opacity: 1;
  color: #D4BC82;
}

/* Admin sidebar icons stay light-on-dark even when page theme is light */
[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sb-nav) .nav-icon,
[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sb-nav) .nav-icon.zg-icon-chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(245, 243, 238, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sb-nav) .nav-btn.active .nav-icon {
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.35);
  color: #D4BC82;
}

/* Nav badges */
.sidebar.zg-sidebar-premium .nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.2s var(--zg-sb-spring), box-shadow 0.2s ease;
}

.sidebar.zg-sidebar-premium .nav-badge:not([style*="display: none"]) {
  animation: zg-sb-badge-pulse 2.8s ease-in-out infinite;
}

@keyframes zg-sb-badge-pulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 0 0 rgba(239, 68, 68, 0); }
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

/* ── Logo / brand row ── */
.sidebar.zg-sidebar-premium .sb-logo-row,
.sidebar.zg-sidebar-premium .sidebar-logo {
  position: relative;
  z-index: 1;
  padding: 20px 18px 14px;
  transition: opacity 0.2s ease;
}

.sidebar.zg-sidebar-premium .sidebar-logo:hover,
.sidebar.zg-sidebar-premium .sb-logo-row:hover {
  opacity: 0.92;
}

.sidebar.zg-sidebar-premium .sidebar-logo-mark {
  transition: transform 0.28s var(--zg-sb-spring), box-shadow 0.28s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 20px -6px rgba(249, 115, 22, 0.45);
}

.sidebar.zg-sidebar-premium .sidebar-logo:hover .sidebar-logo-mark {
  transform: scale(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 12px 28px -8px rgba(249, 115, 22, 0.5);
}

/* ── Company chip — glass card ── */
.sidebar.zg-sidebar-premium .sidebar-company {
  position: relative;
  z-index: 1;
  margin: 0 12px 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition:
    border-color 0.25s ease,
    box-shadow 0.28s var(--zg-sb-ease),
    transform 0.28s var(--zg-sb-spring),
    background 0.25s ease;
}

[data-theme="light"] .sidebar.zg-sidebar-premium:has(.sidebar-nav) .sidebar-company {
  background: rgba(10, 10, 10, 0.03);
  border-color: rgba(10, 10, 10, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.sidebar.zg-sidebar-premium .sidebar-company:hover {
  transform: translateY(-1px);
  border-color: var(--zg-sb-gold-border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 24px -12px rgba(249, 115, 22, 0.2);
}

.sidebar.zg-sidebar-premium .sidebar-company-plan,
.sidebar.zg-sidebar-premium .clerk-badge {
  transition: transform 0.22s var(--zg-sb-spring);
}

.sidebar.zg-sidebar-premium .sidebar-company:hover .sidebar-company-plan,
.sidebar.zg-sidebar-premium .sidebar-company:hover .clerk-badge {
  transform: scale(1.02);
}

/* ── User footer — glass panel ── */
.sidebar.zg-sidebar-premium .sb-footer,
.sidebar.zg-sidebar-premium .sidebar-user {
  position: relative;
  z-index: 1;
  margin: 8px 12px 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.28s var(--zg-sb-ease);
}

[data-theme="light"] .sidebar.zg-sidebar-premium .sidebar-user {
  background: rgba(10, 10, 10, 0.03);
  border-color: rgba(10, 10, 10, 0.07);
}

.sidebar.zg-sidebar-premium .sidebar-user:hover,
.sidebar.zg-sidebar-premium .sb-footer:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(249, 115, 22, 0.2);
}

[data-theme="light"] .sidebar.zg-sidebar-premium .sidebar-user:hover {
  background: rgba(10, 10, 10, 0.05);
}

.sidebar.zg-sidebar-premium .user-avatar,
.sidebar.zg-sidebar-premium .sb-avatar {
  transition: transform 0.28s var(--zg-sb-spring), box-shadow 0.28s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 4px 12px -4px rgba(249, 115, 22, 0.35);
}

.sidebar.zg-sidebar-premium .sidebar-user:hover .user-avatar,
.sidebar.zg-sidebar-premium .sb-footer:hover .sb-avatar {
  transform: scale(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 0 0 3px rgba(249, 115, 22, 0.22);
}

/* Sidebar utility buttons */
.sidebar.zg-sidebar-premium .sb-theme-toggle,
.sidebar.zg-sidebar-premium .sb-logout {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s var(--zg-sb-spring),
    border-color 0.2s ease;
}

.sidebar.zg-sidebar-premium .sb-theme-toggle:hover,
.sidebar.zg-sidebar-premium .sb-logout:hover {
  transform: scale(1.06);
  background: rgba(249, 115, 22, 0.14);
  border-color: var(--zg-sb-gold-border);
}

/* ── Mobile overlay ── */
.sb-overlay,
.sidebar-overlay,
.sb-backdrop {
  opacity: 0;
  transition: opacity var(--zg-sb-dur) var(--zg-sb-ease);
  pointer-events: none;
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  background: rgba(10, 10, 10, 0.45);
}

.sb-overlay.open,
.sidebar-overlay.open,
.sb-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}

@media (max-width: 900px) {
  .sidebar.zg-sidebar-premium {
    box-shadow: 16px 0 56px rgba(0, 0, 0, 0.35);
  }

  .sidebar.zg-sidebar-premium.mobile-open,
  .sidebar.zg-sidebar-premium.open {
    transform: translateX(0) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar.zg-sidebar-premium,
  .sidebar.zg-sidebar-premium .nav-btn,
  .sidebar.zg-sidebar-premium .nav-item,
  .sidebar.zg-sidebar-premium.zg-sidebar-mounted .nav-btn,
  .sidebar.zg-sidebar-premium.zg-sidebar-mounted .nav-item {
    transition: none !important;
    animation: none !important;
  }

  .sidebar.zg-sidebar-premium .nav-btn:hover,
  .sidebar.zg-sidebar-premium .nav-item:hover {
    transform: none;
  }

  .zg-sb-ripple {
    display: none;
  }
}
