/* ==========================================================
 * NEXUS ADMIN — COMPONENTS (Sidebar, Header, Footer)
 * ========================================================== */

/* ══════════════════════════════════
   SIDEBAR
   ══════════════════════════════════ */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: var(--z-sidebar);
  transition: width var(--t-base) var(--ease), transform var(--t-base) var(--ease);
  overflow-x: hidden; overflow-y: hidden;
  border-right: 1px solid var(--sidebar-border);
}
.sidebar-collapsed .sidebar { width: var(--sidebar-col); }

/* Logo */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px;
  height: var(--header-h);
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0; overflow: hidden; white-space: nowrap;
}
.logo-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent) 0%, #8B7CF6 100%);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(91,110,245,.35);
}
.logo-mark svg { width: 18px; height: 18px; color: #fff; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.logo-text strong { font-size: .9375rem; font-weight: 800; color: #fff; letter-spacing: -.02em; }
.logo-text span   { font-size: .62rem; color: rgba(255,255,255,.38); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-collapsed .logo-text { opacity: 0; transition: opacity var(--t-base); }

/* Nav scroll area */
.sidebar-nav {
  flex: 1;
  overflow-y: auto; overflow-x: hidden;
  padding: 10px 8px;
  min-height: 0; /* critical for flex scroll */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 9999px; }

/* Nav sections */
.nav-section { margin-bottom: 6px; }
.nav-section-label {
  font-size: .6rem; font-weight: 700; color: rgba(255,255,255,.28);
  text-transform: uppercase; letter-spacing: .1em;
  padding: 10px 10px 4px;
  white-space: nowrap; overflow: hidden;
  transition: opacity var(--t-base);
}
.sidebar-collapsed .nav-section-label { opacity: 0; }

/* Nav items */
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--sidebar-text); cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
  position: relative; user-select: none; margin-bottom: 1px;
}
.nav-item:hover { background: var(--sidebar-hover); color: rgba(255,255,255,.88); }
.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 55%;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
/* Icon wrapper inside nav items */
.nav-item > .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item > .icon svg { width: 17px; height: 17px; }
.nav-item-label { font-size: .84rem; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; transition: opacity var(--t-base); }
.sidebar-collapsed .nav-item-label { opacity: 0; pointer-events: none; }

/* Active icon glow */
.nav-item.active > .icon { filter: drop-shadow(0 0 5px rgba(91,110,245,.5)); }

/* Nav badge */
.nav-badge {
  flex-shrink: 0;
  background: var(--rose);
  color: #fff;
  font-size: .6rem; font-weight: 700;
  padding: 1px 6px; border-radius: var(--r-full); line-height: 1.6;
  transition: opacity var(--t-base);
}
.nav-badge.new    { background: var(--teal); font-size: .58rem; text-transform: uppercase; letter-spacing: .04em; }
.nav-badge.urgent { background: var(--rose); animation: urgentPulse 2s ease-in-out infinite; }
@keyframes urgentPulse {
  0%,100%{ box-shadow:0 0 0 0 rgba(245,71,110,0); }
  50%    { box-shadow:0 0 0 4px rgba(245,71,110,.22); }
}
.sidebar-collapsed .nav-badge { opacity: 0; }

/* Arrow for submenu parents */
.nav-arrow {
  flex-shrink: 0; margin-left: auto;
  display: flex; align-items: center;
  color: rgba(255,255,255,.22);
  transition: transform .25s var(--ease), color var(--t-fast);
}
.nav-arrow svg { width: 12px; height: 12px; }
.nav-item.sub-open .nav-arrow { transform: rotate(180deg); color: rgba(255,255,255,.55); }
.sidebar-collapsed .nav-arrow { display: none; }

/* Collapsed: center icons */
.sidebar-collapsed .nav-item { justify-content: center; padding: 8px; }

/* ── SUBMENUS ── */
.nav-submenu {
  max-height: 0; overflow: hidden;
  transition: max-height .28s cubic-bezier(.4,0,.2,1);
}
.nav-submenu.open { max-height: 240px; }
.sidebar-collapsed .nav-submenu { display: none; }

.nav-sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 7px 34px;
  font-size: .8125rem; font-weight: 400;
  color: rgba(255,255,255,.40);
  border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  margin-bottom: 1px;
}
.nav-sub-item:hover { background: rgba(255,255,255,.05); color: rgba(255,255,255,.78); }
.nav-sub-item.active { color: var(--accent); background: rgba(91,110,245,.12); font-weight: 600; }
.nav-sub-item.active .sub-dot { background: var(--accent); box-shadow: 0 0 6px rgba(91,110,245,.6); }

.sub-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: rgba(255,255,255,.2); flex-shrink: 0;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.nav-sub-item:hover .sub-dot { background: rgba(255,255,255,.55); }

.sub-badge {
  margin-left: auto;
  background: var(--rose); color: #fff;
  font-size: .6rem; font-weight: 700;
  padding: 1px 5px; border-radius: var(--r-full); line-height: 1.6;
}
.sub-badge.warn { background: var(--amber); color: #111; }

/* Sidebar footer */
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  cursor: pointer; white-space: nowrap;
  transition: background var(--t-fast);
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.sidebar-avatar {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8B7CF6);
  color: #fff; font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .02em;
}
.sidebar-user-info { flex: 1; min-width: 0; overflow: hidden; transition: opacity var(--t-base); }
.sidebar-user-info strong { display: block; font-size: .8125rem; font-weight: 600; color: #fff; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span   { display: block; font-size: .7rem; color: rgba(255,255,255,.36); overflow: hidden; text-overflow: ellipsis; }
.sidebar-collapsed .sidebar-user-info { opacity: 0; }
.sidebar-collapsed .sidebar-user { justify-content: center; }

/* Collapse button */
.sidebar-collapse-btn {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.3);
  transition: background var(--t-fast), color var(--t-fast);
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); }
.sidebar-collapse-btn svg { width: 14px; height: 14px; }
.sidebar-collapsed .sidebar-collapse-btn { display: none; }

/* ══════════════════════════════════
   HEADER
   ══════════════════════════════════ */
.header {
  height: var(--header-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  z-index: var(--z-header);
  flex-shrink: 0;
}

/* Mobile hamburger */
.header-mobile-toggle {
  display: none;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  align-items: center; justify-content: center;
  color: var(--text-3);
  transition: background var(--t-fast), color var(--t-fast);
}
.header-mobile-toggle:hover { background: var(--hover); color: var(--text); }
.header-mobile-toggle svg { width: 20px; height: 20px; }

/* Breadcrumb */
.header-breadcrumb {
  font-size: .84rem; font-weight: 600; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#page-name { color: var(--text); }

/* Search */
.header-search {
  flex: 1; max-width: 340px; position: relative;
  display: flex; align-items: center;
}
.header-search-icon {
  position: absolute; left: 10px;
  color: var(--text-4); pointer-events: none;
  display: flex; align-items: center;
}
.header-search-icon svg { width: 15px; height: 15px; }
.header-search input {
  width: 100%; height: 36px;
  padding: 0 36px 0 34px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: .84rem; color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.header-search input::placeholder { color: var(--text-4); }
.header-search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: var(--surface);
}
.header-search-kbd {
  position: absolute; right: 8px;
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--r-xs); padding: 1px 6px;
  font-size: .65rem; font-weight: 600; color: var(--text-4);
  pointer-events: none;
}
.header-spacer { flex: 1; }

/* Actions */
.header-actions { display: flex; align-items: center; gap: 4px; }
.header-btn {
  width: 36px; height: 36px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.header-btn:hover { background: var(--hover); color: var(--text); }
.header-btn svg { width: 18px; height: 18px; }

/* Notification dot */
.notif-indicator {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--rose); border-radius: 50%;
  border: 2px solid var(--surface);
}

/* Profile button */
.profile-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 8px; border-radius: var(--r-md);
  cursor: pointer; color: var(--text-2);
  transition: background var(--t-fast);
}
.profile-btn:hover { background: var(--hover); }
.profile-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8B7CF6);
  color: #fff; font-size: .68rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-info { line-height: 1.2; }
.profile-info strong { display: block; font-size: .8125rem; font-weight: 600; color: var(--text); }
.profile-info span   { display: block; font-size: .72rem; color: var(--text-3); }
.profile-chevron svg { width: 14px; height: 14px; color: var(--text-4); }

/* ── DROPDOWNS ── */
.dropdown-wrap { position: relative; }
.dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-6px) scale(.97);
  transition: opacity var(--t-base) var(--ease), transform var(--t-base) var(--ease), visibility var(--t-base);
  z-index: var(--z-dropdown);
}
.dropdown.open {
  opacity: 1; visibility: visible; pointer-events: all; transform: none;
}
.dropdown-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.dropdown-header strong { font-size: .875rem; font-weight: 600; color: var(--text); display: block; }
.dropdown-header span   { font-size: .75rem; color: var(--text-3); }
.dropdown-body { padding: 6px; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-sm);
  font-size: .84rem; color: var(--text-2); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.dropdown-item:hover { background: var(--hover); color: var(--text); }
.dropdown-item.danger { color: var(--rose); }
.dropdown-item.danger:hover { background: var(--rose-light); }
.dropdown-item .icon svg { width: 15px; height: 15px; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Notification dropdown specifics */
.notif-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; border-radius: var(--r-sm); cursor: pointer;
  transition: background var(--t-fast);
}
.notif-item:hover { background: var(--hover); }
.notif-item.unread { background: rgba(91,110,245,.04); }
.notif-icon {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.notif-icon svg { width: 15px; height: 15px; }
.notif-content { flex: 1; min-width: 0; }
.notif-content p { font-size: .8125rem; color: var(--text-2); line-height: 1.4; }
.notif-content p strong { color: var(--text); font-weight: 600; }
.notif-content time { font-size: .73rem; color: var(--text-4); display: block; margin-top: 2px; }
.notif-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0; margin-top: 5px;
}
.notif-footer { padding: 8px 16px 12px; border-top: 1px solid var(--border); text-align: center; }
.notif-footer button { font-size: .8125rem; color: var(--accent); font-weight: 500; cursor: pointer; }
.notif-footer button:hover { text-decoration: underline; }

/* ══════════════════════════════════
   FOOTER
   ══════════════════════════════════ */
.footer {
  height: 52px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: .75rem; color: var(--text-4);
  flex-shrink: 0; gap: 12px;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { transition: color var(--t-fast); }
.footer-links a:hover { color: var(--text-2); }
.footer-version {
  background: var(--surface-3); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: var(--r-full);
  font-size: .65rem; font-weight: 700; letter-spacing: .04em; color: var(--text-3);
}
