/* =============================================
   WMS Unified Dashboard — Sidebar Layout
   Design system: warm cream · Fraunces · IBM Plex · orange accent
   ============================================= */

/* ── Layout Shell ──────────────────────────────────────── */
.wms-dash-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
  background: var(--wms-bg, #F5F2EC);
}

/* Helpdesk pages scroll naturally — sidebar stays fixed, content scrolls */
.wms-dash-layout--scroll {
  height: auto;
  min-height: 100%;
  overflow: visible;
  align-items: stretch;
}
.wms-dash-layout--scroll .wms-dash-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
}
.wms-dash-layout--scroll .wms-dash-content {
  height: auto;
  overflow-y: visible;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.wms-dash-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--wms-bg-2, #EEE9DF);
  border-right: 1px solid var(--wms-border, #E4DED1);
  color: var(--wms-text, #1F1E1D);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  z-index: 200;
  padding: 20px 14px;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--wms-border, #E4DED1) transparent;
}

/* ── Brand ─────────────────────────────────────────────── */
.wms-dash-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px 8px;
  border-bottom: 1px solid var(--wms-border, #E4DED1);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.wms-dash-sidebar-brand img {
  max-height: 32px;
  width: auto;
}

.wms-dash-sidebar-brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--wms-text, #1F1E1D);
  color: var(--wms-bg, #F5F2EC);
  display: grid;
  place-items: center;
  font-family: var(--wms-font-serif, Georgia, serif);
  font-size: 15px;
  font-weight: 500;
  flex-shrink: 0;
}

.wms-dash-sidebar-brand-text {
  font-family: var(--wms-font-serif, Georgia, serif);
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--wms-text, #1F1E1D);
}

.wms-dash-sidebar-brand-name {
  font-family: var(--wms-font-serif, Georgia, serif);
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--wms-text, #1F1E1D);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── User / Role chip ──────────────────────────────────── */
.wms-dash-sidebar-user {
  background: var(--wms-surface, #fff);
  border: 1px solid var(--wms-border, #E4DED1);
  border-radius: var(--wms-radius-md, 10px);
  padding: 10px 12px;
  margin-bottom: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wms-dash-sidebar-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--wms-text, #1F1E1D);
  color: var(--wms-bg, #F5F2EC);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  font-family: var(--wms-font-sans, sans-serif);
}

.wms-dash-sidebar-user-info {
  min-width: 0;
}

.wms-dash-sidebar-user strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--wms-text, #1F1E1D);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0;
}

.wms-dash-sidebar-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--wms-muted, #75716A);
}

/* ── Nav ────────────────────────────────────────────────── */
.wms-dash-nav {
  flex: 1;
  padding: 4px 0;
  list-style: none;
  margin: 0;
}

.wms-dash-nav-item {
  margin: 1px 0;
}

.wms-dash-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--wms-radius-sm, 6px);
  color: var(--wms-text2, #46443F);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  box-sizing: border-box;
  line-height: 1.4;
  position: relative;
  user-select: none;
  transition: background 120ms, color 120ms;
}

.wms-dash-nav-link:hover {
  background: rgba(31,30,29,.04);
  color: var(--wms-text, #1F1E1D);
  text-decoration: none;
}

.wms-dash-nav-link.is-active {
  background: var(--wms-surface, #fff);
  color: var(--wms-text, #1F1E1D);
  box-shadow: 0 1px 0 rgba(31,30,29,.04), 0 1px 2px rgba(31,30,29,.04);
}

/* Orange left-bar indicator on active item */
.wms-dash-nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--wms-primary, #EA5A00);
  border-radius: 2px;
}

.wms-dash-nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wms-dash-nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--wms-muted, #75716A);
}

.wms-dash-nav-link.is-active .wms-dash-nav-icon {
  color: var(--wms-text, #1F1E1D);
}

.wms-dash-nav-badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--wms-text, #1F1E1D);
  color: var(--wms-bg, #F5F2EC);
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
  font-weight: 500;
  line-height: 1.6;
  flex-shrink: 0;
}

.wms-dash-nav-badge--alert {
  background: var(--wms-danger, #C8553D);
}

.wms-dash-nav-badge--warn {
  background: var(--wms-warning, #B7791F);
}

.wms-dash-nav-badge--dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  padding: 0;
  border-radius: 50%;
  background: var(--wms-primary, #EA5A00);
}

.wms-dash-nav-divider {
  height: 1px;
  background: var(--wms-border, #E4DED1);
  margin: 6px 2px;
}

/* ── Sidebar Footer ─────────────────────────────────────── */
.wms-dash-sidebar-footer {
  padding: 14px 0 0;
  border-top: 1px solid var(--wms-border, #E4DED1);
  margin-top: auto;
  flex-shrink: 0;
}

/* ── Content Area ──────────────────────────────────────── */
.wms-dash-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

/* ── Topbar ─────────────────────────────────────────────── */
.wms-dash-topbar {
  height: 54px;
  background: var(--wms-bg, #F5F2EC);
  border-bottom: 1px solid var(--wms-border, #E4DED1);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.wms-dash-topbar-title {
  font-family: var(--wms-font-serif, Georgia, serif);
  font-size: 16px;
  font-weight: 400;
  color: var(--wms-text, #1F1E1D);
  flex: 1;
  letter-spacing: -0.01em;
}

.wms-dash-topbar-bell {
  position: relative;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--wms-border, #E4DED1);
  border-radius: var(--wms-radius-sm, 6px);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--wms-muted, #75716A);
  flex-shrink: 0;
  transition: background 120ms;
}

.wms-dash-topbar-bell:hover {
  background: var(--wms-surface, #fff);
  color: var(--wms-text, #1F1E1D);
}

.wms-dash-topbar-bell .wt-notif-badge {
  top: -4px;
  right: -4px;
}

.wms-dash-topbar-mobile-btn {
  display: none;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--wms-border, #E4DED1);
  border-radius: var(--wms-radius-sm, 6px);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--wms-text, #1F1E1D);
  flex-shrink: 0;
}

/* ── Content Inner ──────────────────────────────────────── */
.wms-dash-content-inner {
  flex: 1;
  padding: 28px 40px 80px;
  max-width: 1200px;
}

/* Helpdesk variant — contained padding, full width, natural block flow */
.wms-dash-content-inner--helpdesk {
  padding: 24px 32px 60px;
  max-width: none;
  display: block;
}

.wms-dash-content-inner--helpdesk .wms-hd-wrap.wms-hd-page {
  display: block;
}

/* ── Page Head (matches design's .page-head) ───────────── */
.wms-dash-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--wms-border, #E4DED1);
}

.wms-dash-page-head-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--wms-muted, #75716A);
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: var(--wms-font-sans, sans-serif);
}

.wms-dash-page-head h1,
.wms-dash-page-head h2 {
  font-family: var(--wms-font-serif, Georgia, serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.1;
  margin: 0;
  color: var(--wms-text, #1F1E1D);
}

.wms-dash-page-head-sub {
  color: var(--wms-muted, #75716A);
  font-size: 13.5px;
  margin-top: 6px;
  max-width: 52ch;
  line-height: 1.5;
}

.wms-dash-page-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  padding-left: 24px;
}

/* ── Section Panels ────────────────────────────────────── */
.wms-dash-section {
  display: none;
}

.wms-dash-section.is-active {
  display: block;
  animation: wmsDashFadeIn .16s ease;
}

@keyframes wmsDashFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile Overlay ─────────────────────────────────────── */
.wms-dash-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(31,30,29,.5);
  z-index: 199;
}

.wms-dash-sidebar-overlay.is-visible {
  display: block;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .wms-dash-content-inner {
    padding: 20px 24px 60px;
  }
}

@media (max-width: 768px) {
  .wms-dash-layout {
    display: block;
    height: 100%;
    overflow: hidden;
  }

  .wms-dash-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100%;
    z-index: 201;
    transition: left .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 4px 0 24px rgba(31,30,29,.15);
  }

  html.admin-bar .wms-dash-sidebar {
    top: 32px;
    height: calc(100% - 32px);
  }

  .wms-dash-sidebar.is-open {
    left: 0;
  }

  .wms-dash-topbar-mobile-btn {
    display: flex;
  }

  .wms-dash-content {
    height: 100%;
    overflow-y: auto;
  }

  .wms-dash-content-inner {
    padding: 16px;
  }

  .wms-dash-content-inner--helpdesk {
    padding: 16px 16px 48px;
  }
  .wms-dash-layout--scroll .wms-dash-sidebar {
    position: fixed;
    height: 100vh;
  }
}

@media (max-width: 480px) {
  .wms-dash-topbar {
    padding: 0 16px;
  }
}
