/**
 * Sidebar Navigation Menu Block Styles
 */

.brand-sidebar-menu {
  --brand-nav-font-size: 15px;
  --brand-nav-font-weight: 500;
  --brand-nav-gap: 6px;
  --brand-nav-text-transform: none;
  --brand-nav-pad-y: 8px;
  --brand-nav-pad-x: 12px;
  --brand-nav-radius: 6px;
  --brand-nav-color: #1e293b;
  --brand-nav-hover-color: #002855;
  --brand-nav-hover-bg: #f8fafc;
  --brand-nav-active-color: #002855;
  --brand-nav-active-bg: #f1f5f9;
  --brand-nav-indicator-color: #002855;

  --brand-nav-child-font-size: 14px;
  --brand-nav-child-font-weight: 400;
  --brand-nav-child-gap: 4px;
  --brand-nav-child-indent: 16px;
  --brand-nav-child-pad-y: 6px;
  --brand-nav-child-pad-x: 10px;
  --brand-nav-child-color: #475569;
  --brand-nav-child-hover-color: #002855;
  --brand-nav-child-active-color: #002855;
  --brand-nav-child-active-bg: #f1f5f9;
  --brand-nav-child-border-color: #e2e8f0;

  display: block;
  box-sizing: border-box;
  width: 100%;
}

.brand-sidebar-menu *,
.brand-sidebar-menu *::before,
.brand-sidebar-menu *::after {
  box-sizing: border-box;
}

/* Sidebar Title / Heading */
.brand-sidebar-menu-title {
  margin-top: 0;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: #0f172a;
}

/* Menu Lists */
.brand-sidebar-menu-list,
.brand-sidebar-submenu {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.brand-sidebar-menu-list {
  gap: var(--brand-nav-gap);
}

.brand-sidebar-submenu {
  gap: var(--brand-nav-child-gap);
  margin-top: var(--brand-nav-child-gap) !important;
  margin-left: var(--brand-nav-child-indent) !important;
  padding-left: 0 !important;
}

/* Guide Line for Child Submenus */
.brand-sidebar-menu.has-child-border .brand-sidebar-submenu {
  border-left: 2px solid var(--brand-nav-child-border-color);
  padding-left: 10px !important;
}

/* Menu Items */
.brand-menu-item {
  position: relative;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Menu Links */
.brand-menu-link {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-decoration: none !important;
  color: var(--brand-nav-color);
  font-size: var(--brand-nav-font-size);
  font-weight: var(--brand-nav-font-weight);
  text-transform: var(--brand-nav-text-transform);
  padding: var(--brand-nav-pad-y) var(--brand-nav-pad-x);
  border-radius: var(--brand-nav-radius);
  line-height: 1.45;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
  position: relative;
}

.brand-menu-link:hover {
  color: var(--brand-nav-hover-color);
  background-color: var(--brand-nav-hover-bg);
}

.brand-menu-link:focus-visible {
  outline: 2px solid var(--brand-nav-active-color);
  outline-offset: 2px;
}

.brand-menu-label {
  flex: 1 1 auto;
  word-break: break-word;
}

/* Active State for Top-Level */
.brand-menu-item.is-active > .brand-menu-link,
.brand-menu-item.current-menu-item > .brand-menu-link {
  color: var(--brand-nav-active-color);
  background-color: var(--brand-nav-active-bg);
  font-weight: 600;
}

/* Active Indicator Accent Bar (Parent) */
.brand-sidebar-menu.has-active-indicator .brand-sidebar-menu-list > .brand-menu-item.is-active > .brand-menu-link::before,
.brand-sidebar-menu.has-active-indicator .brand-sidebar-menu-list > .brand-menu-item.current-menu-item > .brand-menu-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3px;
  background-color: var(--brand-nav-indicator-color);
  border-radius: 0 2px 2px 0;
}

/* Parent of Active Child (Current Ancestor) */
.brand-menu-item.is-active-ancestor > .brand-menu-link,
.brand-menu-item.current-menu-ancestor > .brand-menu-link {
  color: var(--brand-nav-hover-color);
  font-weight: 600;
}

/* Child Links Specific Styling */
.brand-sidebar-submenu .brand-menu-link {
  font-size: var(--brand-nav-child-font-size);
  font-weight: var(--brand-nav-child-font-weight);
  color: var(--brand-nav-child-color);
  padding: var(--brand-nav-child-pad-y) var(--brand-nav-child-pad-x);
}

.brand-sidebar-submenu .brand-menu-link:hover {
  color: var(--brand-nav-child-hover-color);
  background-color: var(--brand-nav-hover-bg);
}

.brand-sidebar-submenu .brand-menu-item.is-active > .brand-menu-link,
.brand-sidebar-submenu .brand-menu-item.current-menu-item > .brand-menu-link {
  color: var(--brand-nav-child-active-color);
  background-color: var(--brand-nav-child-active-bg);
  font-weight: 500;
}

/* Active indicator for child with left border */
.brand-sidebar-menu.has-active-indicator .brand-sidebar-submenu .brand-menu-item.is-active > .brand-menu-link::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background-color: var(--brand-nav-indicator-color);
  border-radius: 0 2px 2px 0;
}

/* Collapsible toggle arrow button */
.brand-menu-toggle {
  background: none;
  border: none;
  padding: 0 4px;
  margin-left: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.brand-menu-toggle:hover {
  opacity: 1;
}

.brand-menu-toggle .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

.brand-menu-item.is-collapsed > .brand-sidebar-submenu {
  display: none !important;
}

.brand-menu-item.is-collapsed > .brand-menu-link .brand-menu-toggle {
  transform: rotate(-90deg);
}

/* Editor Specific Styles */
.brand-sidebar-menu-placeholder {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  background: #f8fafc;
  color: #64748b;
  font-family: inherit;
}

.brand-sidebar-menu-placeholder p {
  margin: 0;
  font-size: 14px;
}

.brand-sidebar-menu-editor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #002855;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-color-control-group {
  margin-bottom: 16px;
}

.brand-color-control-group .components-base-control__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
}

