@use 'sass:math' as math;
@use 'sass:color' as color;
// Megamenu admin neutral ramp (aligned with WP admin neutrals; override per site/theme via `:root`).
:root {
--wp--preset--font-family--material-symbols: "Material Symbols", monospace;
--black: #1e1e1e; /* WP Base black */
--dark-gray: #2f2f2f; /* WP editor dark */
--semidark-gray: #3c3c3c; /* WP toolbar grey */
--gray: #757575; /* WP secondary text */
--medium-gray: #a7aaad; /* WP input border */
--light-gray: #dcdcde; /* WP surface border */
--feather-gray: #f6f7f7; /* WP sidebar background */
}
// Matches `:root` `--black`; used for Sass `color.change` shadow alphas.
$-shadow-source: #1e1e1e;
$success: #46b450;
$error: #d63638; // current WP destructive/error red (matches core .notice-error, delete actions)
$error-link: #b32d2e;
$error-link-hover: #8a2424;
$error-surface: #ffdddd;
$warning: #ffb900;
// Native fields in plugin admin: `body.maxmegamenu-admin` sets `--megamenu-form-control-border` (use `var(--megamenu-form-control-border, var(--gray))` at use sites).
// Horizontal gap between settings-page rail nav and main canvas (matches dialog rail column width intent).
$megamenu-settings-rail-gap: 24px;
// Alpha / composed shadows (tinted to match `--black`); focus halos use `--wp-admin-theme-color--rgb`.
// Five levels: feather (a05) → light (a07) → mid (a12) → strong (a22) → scrim (a45).
$shadow-a05: color.change($-shadow-source, $alpha: 0.05);
$shadow-a07: color.change($-shadow-source, $alpha: 0.07);
$shadow-a12: color.change($-shadow-source, $alpha: 0.12);
$shadow-a22: color.change($-shadow-source, $alpha: 0.22);
$shadow-a45: color.change($-shadow-source, $alpha: 0.45);
// Semantic elevation — four levels covering every shadow use in this file.
$shadow-small: 0 1px 2px $shadow-a07;
$shadow-small-hover: 0 1px 2px $shadow-a05, 0 4px 16px $shadow-a07;
$shadow-large: 0 1px 2px $shadow-a12, 0 12px 48px -8px $shadow-a22;
$shadow-large-hover: 0 4px 28px $shadow-a22;
// Chevron for `.mega-toolbar-native-select` (inline-end; `+ 3px` nudges left vs a 10px baseline).
$mega-toolbar-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23757575' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round' d='M2.75 4.5L6 7.75 9.25 4.5'/%3E%3C/svg%3E");
// Modal chrome (Gutenberg / component-style dialogs)
$modal-radius: 10px;
$modal-padding-x: 36px;
@function wp-admin-theme-rgba($alpha) {
@return #{'rgba(var(--wp-admin-theme-color--rgb), #{$alpha})'};
}
$focus-ring-blue-soft: wp-admin-theme-rgba(0.4);
$focus-ring-blue-strong: wp-admin-theme-rgba(0.45);
$mega-admin-icon-hit: 40px;
$mega-admin-icon-glyph: 24px;
// Standard `:focus-visible` ring for admin controls (color + offset; use inside `&:focus-visible { }`).
@mixin mega-admin-focus-ring($color: var(--wp-admin-theme-color), $outline-offset: 2px) {
outline: 2px solid $color;
outline-offset: $outline-offset;
}
@mixin tablet {
@media only screen and (max-width: 1200px) {
@content;
}
}
@mixin megamenu-admin-icon-dashicon-child($size: $mega-admin-icon-glyph) {
.dashicons {
width: $size;
height: $size;
font-size: $size;
line-height: 1;
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
}
@mixin megamenu-admin-icon-button-secondary-layout(
$hit: $mega-admin-icon-hit,
$icon: $mega-admin-icon-glyph
) {
box-sizing: border-box;
flex-shrink: 0;
width: $hit;
min-width: $hit;
height: $hit;
margin: 0;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
@include megamenu-admin-icon-dashicon-child($icon);
}
@mixin megamenu-admin-modal-button-secondary {
&:not(.is-active) {
border: 0;
color: var(--gray);
}
}
// Modal "ghost" icon buttons: align with Gutenberg `.components-button` (foreground default,
// accent on hover) + document-toolbar sizing / focus / theme-tint surfaces.
@mixin megamenu-admin-modal-ghost-icon-btn {
$ghost-foreground: var(--wp-components-color-foreground, var(--black));
$ghost-hover-fg: var(--wp-components-color-accent, var(--wp-admin-theme-color));
appearance: none;
background-color: transparent;
background-image: none;
border: 0;
border-radius: 2px;
box-shadow: none;
text-shadow: none;
color: $ghost-foreground;
width: 32px;
min-width: 32px;
height: 32px;
min-height: 32px;
margin: 0;
padding: 4px;
display: inline-flex;
align-items: center;
justify-content: center;
line-height: 1;
box-sizing: border-box;
flex-shrink: 0;
cursor: pointer;
outline: 1px solid transparent;
transition:
background 0.1s linear,
box-shadow 0.1s linear,
color 0.1s ease;
@include megamenu-admin-icon-dashicon-child($mega-admin-icon-glyph);
.dashicons {
color: currentColor;
}
&:visited {
color: $ghost-foreground;
}
&:hover:not(:disabled) {
color: $ghost-hover-fg;
background: wp-admin-theme-rgba(0.04);
@supports (background: color-mix(in srgb, var(--wp-admin-theme-color) 4%, transparent)) {
background: color-mix(in srgb, var(--wp-admin-theme-color) 4%, transparent);
}
}
&:active:not(:disabled) {
background: wp-admin-theme-rgba(0.08);
@supports (background: color-mix(in srgb, var(--wp-admin-theme-color) 8%, transparent)) {
background: color-mix(in srgb, var(--wp-admin-theme-color) 8%, transparent);
}
}
&:focus {
outline: 1px solid transparent;
}
// Block editor document toolbar: outer theme ring + inset white (see `editor/style.css`).
&:focus:not(:active) {
box-shadow:
0 0 0 var(--wp-admin-border-width-focus, 2px) var(--wp-admin-theme-color),
inset 0 0 0 1px #fff;
}
&:disabled {
color: var(--medium-gray);
background: transparent;
opacity: 1;
box-shadow: none;
}
}
// Icon + label compact buttons: menu location card footer + location modal Settings/Preview toggle.
@mixin megamenu-location-toolbar-button-layout {
display: inline-flex;
align-items: center;
gap: 5px;
.dashicons {
flex-shrink: 0;
width: 16px;
height: 16px;
font-size: 16px;
line-height: 1;
}
}
// Segmented mode pills (sliding theme thumb): header Settings/Preview + preview footer Desktop/Mobile.
@mixin megamenu-location-settings-dialog-mode-pill-track {
gap: 4px;
align-self: center;
padding: 3px;
border-radius: 999px;
border: 1px solid var(--light-gray);
background: var(--light-gray);
box-sizing: border-box;
overflow: visible;
position: relative;
.megamenu-location-settings-dialog__mode-pill-slider {
position: absolute;
z-index: 0;
pointer-events: none;
inset-block: 3px;
inset-inline-start: 3px;
width: calc((100% - 10px) / 2);
border-radius: 999px;
background: var(--wp-admin-theme-color);
transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
.megamenu-location-settings-dialog__mode-pill-slider {
transition-duration: 0.01ms;
}
}
}
@mixin megamenu-location-settings-dialog-mode-pill-slider-to-second(
$second-active-selector
) {
&:has(#{$second-active-selector}) .megamenu-location-settings-dialog__mode-pill-slider {
transform: translateX(calc(100% + 4px));
}
[dir="rtl"] &:has(#{$second-active-selector}) .megamenu-location-settings-dialog__mode-pill-slider {
transform: translateX(calc(-100% - 4px));
}
}
@mixin megamenu-location-settings-dialog-mode-pill-buttons {
.megamenu-location-toolbar-btn.megamenu-location-settings-dialog__mode-btn {
position: relative;
z-index: 1;
flex: 1 1 0;
min-width: 0;
justify-content: center;
margin: 0;
border: 0;
border-radius: 999px;
box-shadow: none;
background: transparent;
color: var(--black);
font-size: 13px;
font-weight: 400;
line-height: 1.3;
padding: 6px 14px;
min-height: 30px;
transition:
color 0.2s ease,
background 0.12s ease;
.dashicons {
color: var(--gray);
transition: color 0.2s ease;
}
&:focus {
box-shadow: none;
}
&:focus-visible {
@include mega-admin-focus-ring(var(--wp-admin-theme-color), 1px);
z-index: 2;
}
&:not(.is-active) {
&:hover:not(:disabled) {
background: color-mix(in srgb, var(--black) 4%, var(--feather-gray));
}
}
&.is-active {
background: transparent;
color: white;
border: 0;
.dashicons {
color: white;
}
&:focus-visible {
outline-color: white;
}
}
}
}
// Dashicon tile rendered on `::before` (menu icon grid).
@mixin megamenu-admin-icon-pseudo-dashicon-tile(
$hit: $mega-admin-icon-hit,
$glyph: $mega-admin-icon-glyph
) {
box-sizing: border-box;
width: $hit;
height: $hit;
display: inline-flex;
align-items: center;
justify-content: center;
border: 0;
padding: 0;
border-radius: 4px;
background: transparent;
color: var(--gray);
line-height: 1;
font-size: $glyph;
cursor: pointer;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
transition:
background 0.15s ease,
color 0.15s ease,
box-shadow 0.15s ease;
}
// Shared positioning when `.megamenu-modal-close` is not inside `.megamenu-admin-modal__header-actions`.
@mixin megamenu-modal-close-button {
position: absolute;
top: 14px;
right: 12px;
z-index: 2;
}
.megamenu-modal-close {
@include megamenu-modal-close-button;
}
// Sliding underline shared by Menu Themes tabs and the location settings dialog.
@mixin nav-tab-slider-indicator {
.nav-tab-slider {
position: absolute;
bottom: 0;
left: 0;
height: 3px;
background-color: var(--wp-admin-theme-color);
border-radius: 2px;
transition: left 0.3s ease-out, width 0.3s ease-out;
z-index: 1;
}
}
// Column span control pill: grid `.mega-col-header > .mega-col-span` + standard `.mega-widget-title-action .mega-col-span`.
@mixin mega-col-span-pill {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 2px;
flex: 0 1 auto;
min-width: 0;
max-width: 100%;
padding: 3px 2px;
border-radius: 9999px;
box-sizing: border-box;
background: white;
border: 1px solid var(--wp-admin-theme-color);
color: var(--wp-admin-theme-color);
}
// Shared vertical rail tabs: Appearance > Menus menu-item modal body + location settings modal.
@mixin megamenu-dialog-side-tab(
$accent: var(--wp-admin-theme-color),
$active-bg: transparent
) {
appearance: none;
-webkit-appearance: none;
margin: 0;
width: 100%;
display: block;
padding: 10px 12px;
box-sizing: border-box;
position: relative;
transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
font-family: inherit;
font-size: 13px;
font-weight: 500;
line-height: 20px;
text-align: start;
color: var(--black);
cursor: pointer;
border: 1px solid transparent;
border-radius: 0;
margin-bottom: 2px;
border-inline-start: 3px solid transparent;
background: transparent;
&:focus-visible {
@include mega-admin-focus-ring($accent);
}
&:hover {
background: var(--feather-gray);
color: var(--black);
border-color: transparent;
}
&.is-active {
color: $accent;
background: $active-bg;
border-color: transparent;
font-weight: 600;
box-shadow: none;
border-inline-start-color: $accent;
&:before {
color: $accent;
}
&:after {
display: none;
}
}
}
// Menu item modal: dashed “add widget to this column” slot (`.mega-col-add-widget`) — reused e.g. for “add another menu location”.
@mixin mega-col-add-widget-appearance {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
box-sizing: border-box;
min-height: 32px;
padding: 6px 8px;
border: 1px dashed var(--light-gray);
border-radius: 4px;
background: var(--feather-gray);
cursor: pointer;
color: var(--gray);
transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
.dashicons {
font-size: 18px;
width: 18px;
height: 18px;
line-height: 1;
opacity: 0.45;
transition: opacity 0.2s ease;
}
&:hover,
&:focus-visible {
color: var(--wp-admin-theme-color);
border-color: $focus-ring-blue-strong;
background: white;
.dashicons {
opacity: 1;
}
}
&:focus-visible {
@include mega-admin-focus-ring;
}
}
@mixin megamenu-dialog-rail-grid($column-gap: 0, $row-gap: 0) {
display: grid;
grid-template-columns: 230px 1fr;
grid-template-rows: minmax(0, 1fr);
align-items: stretch;
width: 100%;
box-sizing: border-box;
column-gap: $column-gap;
row-gap: $row-gap;
}
@mixin megamenu-dialog-tablist-shell {
grid-column: 1;
grid-row: 1;
width: 100%;
position: relative;
min-height: 0;
align-self: stretch;
display: flex;
flex-direction: column;
align-items: stretch;
gap: 0;
margin: 0;
padding: 0;
box-sizing: border-box;
overflow-x: hidden;
overflow-y: auto;
}
@mixin megamenu-dialog-panels-shell($overflow: auto) {
grid-column: 2;
grid-row: 1;
min-width: 0;
min-height: 0;
overflow: $overflow;
box-sizing: border-box;
position: relative;
border: 0;
}
// Tooltip bubble: any element with [data-mega-tooltip] (plain text and/or dual enabled/disabled). Always centered below the trigger.
@mixin tooltip-popup-base {
&:before {
position: absolute;
content: attr(data-mega-tooltip);
top: calc(100% + 6px);
left: 50%;
transform: translateX(-50%);
background: white;
color: var(--black);
padding: 6px 10px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
font-size: 12px;
font-weight: 400;
line-height: 1.4;
border-radius: 2px;
border: 1px solid var(--gray);
box-shadow: $shadow-small;
margin-left: 0;
width: auto;
max-width: 280px;
white-space: nowrap;
box-sizing: border-box;
z-index: 101;
text-align: center;
}
// Bordered chevron (not a filled triangle): rotated square so stroke meets the bubble border.
&:after {
content: "";
position: absolute;
top: calc(100% + 6px);
left: 50%;
width: 9px;
height: 9px;
margin: 0;
background: white;
border-left: 1px solid var(--gray);
border-top: 1px solid var(--gray);
border-right: none;
border-bottom: none;
box-sizing: border-box;
transform: translate(-50%, -50%) rotate(45deg);
z-index: 102;
}
&:before,
&:after {
opacity: 0;
pointer-events: none;
text-align: center;
transition: opacity 0.3s ease;
transition-delay: 0.3s;
}
&:focus:before,
&:focus:after,
&:focus-visible:before,
&:focus-visible:after,
&:hover:before,
&:hover:after {
opacity: 1;
}
}
// Percent widths via nested @for — used by #megamenu-standard (data-columns) only.
@mixin grid-col-widths($container-attr, $item-selector, $item-attr) {
@for $of from 1 through 12 {
@for $cols from 1 through $of {
&[#{$container-attr}='#{$of}'] #{$item-selector}[#{$item-attr}='#{$cols}'] {
width: math.percentage(math.div($cols, $of));
}
}
}
}
// Full-cell overlay used to visually disable table rows.
@mixin disabled-row-overlay {
background: var(--feather-gray);
display: block;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
content: "";
opacity: 0.5;
z-index: 9;
}
// Small caps label above a native `