/* CRITICAL: Hide all expandable content by default to prevent flicker */
.well360-sidebar {
  width: 80px !important;
}

/* Hide all text content by default */
.well360-sidebar .toolbar-link__label,
.well360-sidebar .toolbar-link span:not(.toolbar-link__icon):not(i) {
  display: none !important;
  opacity: 0 !important;
  width: 0 !important;
}

.well360-sidebar__section-header {
  display: none !important;
}

.well360-sidebar .toolbar-link {
  width: 56px !important;
  justify-content: center !important;
  padding: 0 !important;
}

/* Only show expanded state when explicitly marked */
.well360-sidebar.sidebar-expanded {
  width: 240px !important;
}

.well360-sidebar.sidebar-expanded .toolbar-link__label,
.well360-sidebar.sidebar-expanded .toolbar-link span:not(.toolbar-link__icon):not(i) {
  display: block !important;
  opacity: 1 !important;
  width: auto !important;
}

.well360-sidebar.sidebar-expanded .toolbar-link:not(.toolbar-link--sidebar-toggle) {
  width: 100% !important;
  justify-content: flex-start !important;
  padding: 12px 16px !important;
}

.well360-sidebar.sidebar-expanded .toolbar-link--sidebar-toggle {
  width: 100% !important;
  justify-content: flex-start !important;
  padding: 12px 16px !important;
}

.well360-sidebar.sidebar-expanded .toolbar-link__dropdown-arrow {
  display: inline-block !important;
}

.well360-sidebar.sidebar-expanded .well360-sidebar__section-header {
  display: block !important;
}

.well360-sidebar.sidebar-expanded .well360-sidebar__logo .toolbar-link {
  width: 100% !important;
  justify-content: flex-start !important;
  padding: 12px 16px !important;
}

/* Base sidebar - START COLLAPSED by default */
.well360-sidebar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  height: 100vh;
  background: linear-gradient(180deg, var(--color--primary-50) 40%, var(--color--primary-60) 100%);
  color: #fff;
  z-index: 1025;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  padding: 16px 0;
  /* NO transition on initial load */
  transition: none;
}

/* Enable transitions after JS loads */
.well360-sidebar.transitions-enabled {
  transition: width 0.3s ease;
}

/* Expanded state */
.well360-sidebar:not(.is-collapsed) {
  width: 240px;
}

/* Collapsed state */
.well360-sidebar.is-collapsed {
  width: 80px;
}

.well360-sidebar__displace-placeholder {
  display: none;
}

.well360-sidebar__content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 12px;
}

/* Header with logo */
.well360-sidebar__header {
  padding: 0 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.well360-sidebar__logo {
  width: 100%;
  display: flex;
  justify-content: center;
}

.well360-sidebar__logo .toolbar-menu {
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

.well360-sidebar__logo .toolbar-menu__item {
  display: flex;
  justify-content: center;
  width: 100%;
}

.well360-sidebar__logo .toolbar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  background: #fff;
  border-radius: 12px;
  width: 56px;
  height: 56px;
  margin: 0;
  transition: all 0.2s;
}

.well360-sidebar__logo .toolbar-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.well360-sidebar:not(.is-collapsed) .well360-sidebar__logo .toolbar-link {
  width: 100%;
  justify-content: flex-start;
  padding: 12px 16px;
  gap: 12px;
}

.well360-sidebar.is-collapsed .well360-sidebar__logo .toolbar-link span:not(.fa-solid):not(.fa-regular):not(i) {
  display: none;
}

/* Visually hidden but accessible */
.visually-hidden {
  position: absolute !important;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  word-wrap: normal;
}

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  position: static !important;
  overflow: visible;
  clip: auto;
  width: auto;
  height: auto;
}

/* Section headers like "HEALTH ADVICE" */
.well360-sidebar__section-header {
  padding: 20px 16px 8px;
  margin-top: 12px;
}

.well360-sidebar__section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* Hide section headers when collapsed */
.well360-sidebar.is-collapsed .well360-sidebar__section-header {
  display: none;
}

/* Menu blocks */
.well360-sidebar__item.toolbar-block {
  margin-bottom: 8px;
}

.toolbar-block__title {
  display: none;
}

.toolbar-block__content {
  padding: 0;
}

.toolbar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar-menu__item {
  margin: 0;
  position: relative;
}

/* Toolbar links - base styling */
.toolbar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #666;
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 12px;
  width: 56px;
  height: 56px;
  cursor: pointer;
  transition: all 0.2s;
  gap: 12px;
  font-size: 14px;
  position: relative;
  white-space: nowrap;
  margin: 0 auto;
}

.toolbar-link:hover {
  transform: translateY(-2px);
  color: #333;
}

/* Expanded sidebar - full width buttons */
.well360-sidebar:not(.is-collapsed) .toolbar-link {
  width: 100%;
  justify-content: flex-start;
  padding: 0;
}

/* Icon container styling */
.toolbar-link__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: #fff;
  border-radius: 12px;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toolbar-link:hover .toolbar-link__icon {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Font Awesome icon styling */
.toolbar-link__icon i {
  font-size: 20px;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.toolbar-link:hover .toolbar-link__icon i {
  color: #333;
}

/* Expanded sidebar - icon positioning */
.well360-sidebar:not(.is-collapsed) .toolbar-link__icon {
  width: 44px;
  height: 44px;
}

/* Remove old ::before icon rules */
.toolbar-link--has-icon::before {
  display: none !important;
  content: none !important;
}

/* Action label (hidden) */
.toolbar-link__action {
  display: none !important;
}

/* Keep action label hidden even when sidebar is expanded */
.well360-sidebar.sidebar-expanded .toolbar-link__action {
  display: none !important;
}

/* Main label */
.toolbar-link__label {
  display: none;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s ease, width 0.15s ease;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 14px;
  padding: 0 12px;
}

/* Show labels when expanded */
.well360-sidebar:not(.is-collapsed) .toolbar-link__label {
  display: block;
}

/* Hide labels when collapsed */
.well360-sidebar.is-collapsed .toolbar-link:not(.toolbar-link--sidebar-toggle) .toolbar-link__label {
  display: none;
}

/* Dropdown arrow as element */
.toolbar-link__dropdown-arrow {
  display: none;
  margin-left: auto !important;
  transition: transform 0.2s;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px !important;
  width: auto !important;
  height: auto !important;
}

/* Show arrow when expanded */
.well360-sidebar:not(.is-collapsed) .toolbar-link__dropdown-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-link:hover .toolbar-link__dropdown-arrow {
  color: rgba(255, 255, 255, 0.9);
}

/* Rotate arrow when expanded */
.toolbar-link[aria-expanded="true"] .toolbar-link__dropdown-arrow {
  transform: rotate(90deg);
}

/* Remove the old ::after rule */
.toolbar-menu__item--has-dropdown > .toolbar-link::after {
  display: none;
  content: none;
}

/* Submenu */
.toolbar-menu__submenu {
  background: rgba(0, 0, 0, 0.15);
  padding: 4px 0;
  border-radius: 8px;
  margin-top: 4px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  padding-left: 0;
}

.toolbar-menu__item--has-dropdown > .toolbar-link[aria-expanded="true"] ~ .toolbar-menu__submenu {
  max-height: 2000px;
}

.toolbar-menu__submenu .toolbar-menu {
  gap: 0;
}

.toolbar-menu__arrow-ref {
  display: none;
}

/* Submenu styling with bullets */
.toolbar-link--submenu {
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 24px !important;
  gap: 8px;
  font-size: 14px;
  width: 100%;
  background: transparent !important;
  border-radius: 0 !important;
  margin: 0 !important;
  height: auto !important;
  justify-content: flex-start !important;
}

.toolbar-link--submenu:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  transform: none !important;
  box-shadow: none !important;
}

.toolbar-link__bullet {
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar-link--submenu span:not(.toolbar-link__bullet) {
  color: rgba(255, 255, 255, 0.9);
}

.toolbar-link--submenu:hover span {
  color: #fff;
}

/* Submenu items */
.toolbar-menu__item--level-2 {
  background: transparent;
}

.toolbar-menu__item--to-title {
  display: none;
}

/* Hide all submenus when collapsed */
.well360-sidebar.is-collapsed .toolbar-menu__submenu {
  display: none !important;
  max-height: 0 !important;
}

/* Divider between sections */
.well360-sidebar__item.toolbar-block:nth-child(4)::after {
  content: '';
  display: block;
  width: 40px;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  margin: 12px auto;
}

/* Sticky bottom section */
.well360-sidebar__sticky-section {
  position: sticky;
  bottom: 0;
  background: transparent;
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  margin: 16px 12px 0;
  padding-top: 16px;
  flex-shrink: 0;
}

/* Sidebar toggle button */
.toolbar-link--sidebar-toggle {
  background: #fff;
  color: #666;
  border-radius: 12px;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-direction: column;
  transition: all 0.2s;
}

/* Expanded sidebar state */
.well360-sidebar:not(.is-collapsed) .toolbar-link--sidebar-toggle {
  width: 100%;
  height: auto;
  flex-direction: row;
  justify-content: flex-start;
  padding: 12px 16px;
}

.toolbar-link--sidebar-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #333;
}

/* Toggle icon styling */
.toolbar-link--sidebar-toggle .toolbar-link__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: #666;
}

.toolbar-link--sidebar-toggle .toolbar-link__icon i {
  font-size: 20px;
  transition: transform 0.2s;
  color: inherit;
}

.toolbar-link--sidebar-toggle:hover .toolbar-link__icon i {
  color: #333;
}

/* Toggle label styling */
.toolbar-link--sidebar-toggle .toolbar-link__label {
  display: none;
  white-space: nowrap;
  color: #666;
  font-weight: 500;
}

/* Show label when expanded */
.well360-sidebar:not(.is-collapsed) .toolbar-link--sidebar-toggle .toolbar-link__label {
  display: block;
}

/* Collapsed state - rotate icon and hide label */
.well360-sidebar.is-collapsed .toolbar-link--sidebar-toggle {
  flex-direction: column;
  justify-content: center;
  padding: 0;
}

.well360-sidebar.is-collapsed .toolbar-link--sidebar-toggle .toolbar-link__icon i {
  transform: rotate(180deg);
}

/* Body margin - will be set by inline script, enable transition after load */
body.transitions-enabled {
  margin-left: 80px;
  transition: margin-left 0.3s ease;
}

/* Tooltips on hover when collapsed */
.well360-sidebar.is-collapsed .toolbar-link:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
  margin-left: 12px;
  z-index: 1025;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  pointer-events: none;
}

/* Don't show tooltip if no data-tooltip attribute */
.well360-sidebar.is-collapsed .toolbar-link:not([data-tooltip]):hover::after {
  display: none;
}

/* Scrollbar styling */
.well360-sidebar__content::-webkit-scrollbar {
  width: 6px;
}

.well360-sidebar__content::-webkit-scrollbar-track {
  background: transparent;
}

.well360-sidebar__content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.well360-sidebar__content::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.toolbar-oriented .toolbar-bar {
  left: 80px;
}
.toolbar-oriented .toolbar-tray-vertical.is-active {
  left: 80px;
}
