/*
 * Side menu (Superfly Menu plugin, menu "Menu Lateral").
 * Figma: "Category menu" (79:223), states "Header / Desktop / Menu open" (80:52) and
 * "Header / Mobile / Menu open" (80:239).
 * Colours, width (440), font, item padding, icons per item and logo are Superfly options;
 * this file only covers what the plugin has no option for.
 * Spec: openspec/changes/side-menu.
 */

/* Panel: rounded right edge and floating shadow. */
#sfm-sidebar .sfm-sidebar-bg {
	border-radius: 0 var(--bb-radius-xl) var(--bb-radius-xl) 0;
	box-shadow: 0 2px 3px rgba(31, 36, 41, 0.06), 0 8px 12px rgba(31, 36, 41, 0.12);
}

/* Scrim: Figma rgba(0,0,0,.62). The plugin animates #sfm-overlay opacity up to .9, so .69 x .9. */
#sfm-overlay {
	background-color: rgba(0, 0, 0, 0.69) !important;
}

/* ---------- Header row: close button + logo, 80px, inside the 24px panel padding ---------- */
#sfm-sidebar .sfm-scroll {
	padding: 24px 0;
	box-sizing: border-box;
}

#sfm-sidebar .sfm-sidebar-close {
	position: absolute;
	top: 42px;
	left: 24px;
	z-index: 1000;
	width: 44px;
	height: 44px;
	background: center / 24px 24px no-repeat url("../img/side-menu/fechar.svg");
	cursor: pointer;
}

/* The plugin draws its own grey X with pseudo-elements. */
#sfm-sidebar .sfm-sidebar-close::before,
#sfm-sidebar .sfm-sidebar-close::after {
	display: none;
}

/* The plugin positions the logo absolutely (top 40px); in the flow, the menu follows it. */
#sfm-sidebar .sfm-logo {
	position: relative;
	top: 0;
	display: flex;
	height: 80px;
	padding: 0 24px 0 80px;
	align-items: center;
	text-align: left;
}

/* The logo block spans the row and would cover the close button: only the link takes clicks. */
#sfm-sidebar .sfm-logo {
	pointer-events: none;
}

#sfm-sidebar .sfm-logo a {
	display: block;
	line-height: 0;
	pointer-events: auto;
}

#sfm-sidebar .sfm-logo img {
	width: 120px;
	max-height: none;
	height: auto;
}

/* Menu starts under the header (the plugin centres it vertically in a table). */
#sfm-sidebar .sfm-nav,
#sfm-sidebar .sfm-va-middle {
	display: block;
	height: auto;
}

/* Desktop: the plugin positions the menu absolutely at the top of the panel, over the logo. */
#sfm-sidebar .sfm-nav {
	position: relative !important;
	margin-top: 0;
	padding-top: 16px;
}

/* ---------- Items: 52px, icon 24 + 14 gap, text as written, chevron on the right ---------- */
#sfm-sidebar .sfm-menu li a,
#sfm-sidebar .sfm-menu li a span {
	text-transform: none;
}

/* .sfm-nav in the selector: the plugin prints "padding-left: 24% !important" after this file. */
#sfm-sidebar .sfm-nav .sfm-menu li a {
	position: relative;
	display: flex;
	padding: 14px 60px 14px 32px !important;
	align-items: center;
	color: var(--bb-color-text-primary);
	line-height: 24px;
}

#sfm-sidebar .sfm-menu li a img {
	flex: 0 0 24px;
	margin: 0 14px 0 0;
}

/* Chevron on the <li>: the plugin already uses a::before and a::after for its hover layers. */
#sfm-sidebar .sfm-menu li:not(.sfm-chapter) {
	position: relative;
}

#sfm-sidebar .sfm-menu li:not(.sfm-chapter)::after {
	content: "";
	position: absolute;
	top: 16px;
	right: 32px;
	width: 20px;
	height: 20px;
	background: center / 20px 20px no-repeat url("../img/side-menu/chevron.svg");
	pointer-events: none;
}

/* Hover/active background ("semi-dark" option): the plugin grows it from width 0.
   Inset it to the content box (24px each side) with the 8px item radius. */
#sfm-sidebar .sfm-menu li > a::before {
	left: 24px;
	border-radius: var(--bb-radius-md);
}

#sfm-sidebar .sfm-menu li:hover > a::before,
#sfm-sidebar .sfm-menu li > a:focus::before,
#sfm-sidebar .sfm-menu li.sfm-active-item > a::before,
#sfm-sidebar .sfm-menu li.sfm-active-smooth > a::before {
	width: calc(100% - 48px) !important;
}

#sfm-sidebar .sfm-menu li a:focus-visible,
#sfm-sidebar .sfm-sidebar-close:focus-visible {
	outline: 3px solid rgba(2, 144, 70, 0.30);
	outline-offset: -3px;
}

/* ---------- Section title: a Superfly "Chapter" on an item (Menus > item > Superfly settings) ---------- */
/* "Categorias" on the first item, "Links úteis" (Tiago, 2026-10; was a 1px divider). li.* outranks Superfly's inline chapter CSS. */
#sfm-sidebar .sfm-menu > li.sfm-chapter {
	height: auto;
	margin: 24px 24px 8px;
	padding: 0 !important;
	overflow: visible;
	background: transparent;
	font-size: 16px !important;
	line-height: 24px;
}

#sfm-sidebar .sfm-menu > li.sfm-chapter:first-child {
	margin-top: 0;
}

#sfm-sidebar .sfm-menu > li.sfm-chapter > div {
	display: block;
	margin: 0;
	padding: 0;
	color: var(--bb-color-text-primary);
	font-family: var(--bb-font-family);
	font-size: 16px;
	font-weight: var(--bb-font-weight-bold);
	line-height: 24px;
	letter-spacing: normal;
	text-transform: none;
}

/* ---------- Mobile: full width, no rounded edge, bottom nav hidden while open ---------- */
@media (max-width: 439px) {
	#sfm-sidebar,
	#sfm-sidebar .sfm-sidebar-bg,
	#sfm-sidebar .sfm-scroll-wrapper,
	#sfm-sidebar .sfm-menu {
		width: 100vw !important;
	}

	#sfm-sidebar .sfm-sidebar-bg {
		border-radius: 0;
	}

	#sfm-sidebar .sfm-scroll {
		padding-top: calc(24px + env(safe-area-inset-top, 0px));
		padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	}

	#sfm-sidebar .sfm-sidebar-close {
		top: calc(42px + env(safe-area-inset-top, 0px));
	}
}

/* The fixed mobile bottom nav (z-index 9998) is below the panel, but it must not stay clickable. */
body.sfm-body-pushed #footer .footer-nav {
	visibility: hidden !important;
	pointer-events: none !important;
}

/* ---------- Subpanels per category (Tiago, 2026-10; openspec: tiago-r2-side-menu) ----------
   Native Superfly custom panels, behaviour in js/side-menu.js (adds body.gf-bb-category-menu).
   Menu width in --gf-bb-menu-width: 440px, 320px from 720px, 100vw below 440px. */
body.gf-bb-category-menu { --gf-bb-menu-width: 440px; }
body.gf-bb-category-menu #sfm-sidebar,
body.gf-bb-category-menu #sfm-sidebar .sfm-sidebar-bg,
body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main,
body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main .sfm-logo,
body.gf-bb-category-menu #sfm-sidebar .sfm-menu-level-0 {
  width: var(--gf-bb-menu-width) !important;
  max-width: var(--gf-bb-menu-width) !important;
}
body.gf-bb-category-menu #sfm-sidebar:not(.sfm-sidebar-exposed) {
  transform: translate3d(calc(-1 * var(--gf-bb-menu-width)), 0, 0);
}
body.gf-bb-category-menu.sfm-body-pushed #sfm-sidebar { transform: translate3d(0, 0, 0); }
body.gf-bb-category-menu #sfm-sidebar .sfm-menu-level-0 > li > a span {
  max-width: calc(var(--gf-bb-menu-width) - 92px) !important;
}
body.gf-bb-category-menu #sfm-sidebar .sfm-menu-level-0 > li > a > .sfm-sm-indicator { display: none; }
body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom {
  left: var(--gf-bb-menu-width) !important;
  right: auto !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 320px !important;
  height: 100% !important;
  max-height: 100dvh;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  background: var(--bb-color-bg-canvas) !important;
  border-radius: 0 var(--bb-radius-xl) var(--bb-radius-xl) 0;
  box-shadow: var(--bb-shadow-floating);
  transform: translate3d(-100%, 0, 0) !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}
body.gf-bb-category-menu.gf-bb-menu-has-panel #sfm-sidebar .sfm-view-level-custom {
  z-index: 3 !important;
  transform: translate3d(0, 0, 0) !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto;
}
body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom > .sfm-back-parent,
body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom > .sfm-close,
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel:not(.sfm-active) { display: none !important; }
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel.sfm-active {
  display: flex !important;
  flex-direction: column;
  align-items: stretch;
  width: 100% !important;
  height: 100%;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  font: 400 14px/20px var(--bb-font-family);
  color: var(--bb-color-text-primary);
  background: var(--bb-color-bg-canvas);
  text-align: left;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__header {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 56px;
  padding: 4px 8px;
  background: var(--bb-color-bg-canvas);
  color: var(--bb-color-text-primary);
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: inherit;
  font: 700 16px/24px var(--bb-font-family);
}
/* Was an h2: same tracking the type scale gave it from 850px (css/custom.css). */
@media (min-width: 850px) {
  body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__title { letter-spacing: var(--bb-h2-tracking); }
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__back,
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__close {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: var(--bb-radius-sm);
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__back { width: 100%; }
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__back > span {
  display: flex;
  align-items: center;
  gap: 10px;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__back > span::before {
  content: "";
  display: block;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  background: center / 24px no-repeat;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__back > span::before {
  background-image: var(--gf-bb-theme-panel-icon, none);
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__close { flex: 0 0 44px; justify-content: center; }
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__back::before,
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__close::before {
  content: "";
  display: block;
  flex: 0 0 20px;
  height: 20px;
  background: center / 20px no-repeat url("/wp-content/themes/buyback/img/side-menu/chevron.svg");
  transform: rotate(180deg);
  filter: none;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__close::before {
  background-image: url("/wp-content/themes/buyback/img/side-menu/fechar.svg");
  transform: none;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__links {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 12px 16px max(20px, env(safe-area-inset-bottom, 0px));
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__group { margin: 12px 0 0; }
/* Group titles are text, not h3: the menu is in every page (Jose, 2026-10-28). The h3 stays here
   in case a panel is pasted with the old markup. */
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__group-title,
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__group h3 {
  margin: 0 0 4px;
  padding: 0 4px;
  color: var(--bb-color-text-primary);
  font: 700 14px/20px var(--bb-font-family);
  text-transform: none;
  letter-spacing: normal;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__group ul { margin: 0; padding: 0; list-style: none; }
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__group li { margin: 0; padding: 0; }
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  box-sizing: border-box;
  padding: 10px 8px;
  margin: 0;
  border-radius: var(--bb-radius-sm);
  color: var(--bb-color-text-primary);
  font: 400 14px/20px var(--bb-font-family);
  text-decoration: none;
  white-space: normal;
  overflow-wrap: break-word;
  text-transform: none;
  letter-spacing: normal;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__links a:hover,
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__links a:focus-visible { background: var(--bb-color-bg-support-subtle); }
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__links a:focus-visible {
  outline: 2px solid var(--bb-color-focus-ring);
  outline-offset: -2px;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__header button:focus-visible {
  outline: 2px solid var(--bb-color-focus-ring);
  outline-offset: -2px;
}
body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__all { font-weight: 700; }
@media (min-width: 720px) {
  body.gf-bb-category-menu { --gf-bb-menu-width: 320px; }
  /* One continuous surface: rounding and shadow belong to the outside edge. */
  body.gf-bb-category-menu.gf-bb-menu-has-panel #sfm-sidebar,
  body.gf-bb-category-menu.gf-bb-menu-has-panel #sfm-sidebar .sfm-view-level-custom {
    box-shadow: none !important;
  }
  body.gf-bb-category-menu.gf-bb-menu-has-panel #sfm-sidebar .sfm-sidebar-bg {
    width: calc(2 * var(--gf-bb-menu-width)) !important;
    max-width: calc(2 * var(--gf-bb-menu-width)) !important;
    border-radius: 0 var(--bb-radius-xl) var(--bb-radius-xl) 0 !important;
    box-shadow: var(--bb-shadow-floating) !important;
  }
}
@media (max-width: 719px) {
  body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom {
    left: 0 !important;
    width: var(--gf-bb-menu-width) !important;
    border-radius: 0 var(--bb-radius-xl) var(--bb-radius-xl) 0;
  }
  body.gf-bb-category-menu.gf-bb-menu-has-panel #sfm-sidebar .sfm-scroll-main { display: none !important; }
  body.gf-bb-category-menu #sfm-sidebar .gf-bb-theme-panel__header { padding-top: max(4px, env(safe-area-inset-top, 0px)); }
}
@media (max-width: 439px) {
  body.gf-bb-category-menu { --gf-bb-menu-width: 100vw; }
  body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  body.gf-bb-category-menu #sfm-sidebar,
  body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom .sfm-custom-content,body.gf-bb-category-menu #sfm-sidebar .sfm-view-level-custom .sfm-content-wrapper {height:100%;width:100%;padding:0;margin:0;transform:none;top:0;}

/* Compact the existing logo/close row after removing sf_under_logo natively. */
body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main > .sfm-scroll {
  padding-top: 16px !important;
}
body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main .sfm-logo {
  height: 64px !important;
  min-height: 64px !important;
}
body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main .sfm-nav {
  padding-top: 8px !important;
}
body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main .sfm-sidebar-close {
  top: 26px !important;
}
@media (max-width: 439px) {
  body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main > .sfm-scroll {
    padding-top: calc(16px + env(safe-area-inset-top, 0px)) !important;
  }
  body.gf-bb-category-menu #sfm-sidebar .sfm-scroll-main .sfm-sidebar-close {
    top: calc(26px + env(safe-area-inset-top, 0px)) !important;
  }
}
