/* NexusOS — Segment 4: menus, popovers, tooltips.
   Surfaces lift one step above the window base. Hovered menu items use the
   lime hover wash; selected/checked items go to solid lime. */

/* ── Menubar (top-level) ─────────────────────────────────── */

menubar,
.menubar {
    background-color: @surface_bg_alt;
    color: @text_primary;
    border-bottom: 1px solid @border;
    padding: 0;
}

menubar > menuitem,
.menubar > menuitem {
    padding: 6px 10px;
    color: @text_primary;
    background-color: transparent;
}

menubar > menuitem:hover,
.menubar > menuitem:hover {
    background-color: @hover_bg;
    color: @text_primary;
}

menubar > menuitem:active,
menubar > menuitem:checked,
.menubar > menuitem:active {
    background-color: @active_bg;
    color: @active_fg;
}

menubar > menuitem:disabled,
.menubar > menuitem:disabled {
    color: @text_disabled;
}

/* ── Pop-up menus (classic GtkMenu) ──────────────────────── */

menu,
.menu,
.context-menu {
    padding: 1px 0;
    background-color: @menu_bg;
    background-image: none;
    border: 1px solid @menu_border;
    border-radius: 6px;
    color: @text_primary;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45),
                0 2px 4px  rgba(0, 0, 0, 0.30);
}

menu menuitem,
.menu menuitem,
.context-menu menuitem {
    padding: 1px 10px;
    min-height: 0;
    color: @text_primary;
    background-color: transparent;
    text-shadow: none;
}

/* Normalize the optional menu icon (gtk-menu-images=true) so an icon'd
   row — e.g. xfdesktop's "Desktop Settings…" — is the same height as a
   text-only row instead of being sized by the raw icon + GTK defaults.
   Kept tight because nm-applet's wifi list grows long and the menu is
   bounded by screen height — every px per row matters. */
menu menuitem image,
.menu menuitem image,
.context-menu menuitem image {
    min-width: 14px;
    min-height: 14px;
    margin: 0 6px 0 0;
    -gtk-icon-transform: scale(1);
}

menu menuitem box,
.menu menuitem box,
.context-menu menuitem box {
    margin: 0;
    padding: 0;
    /* border-spacing not valid in GTK3; gap managed by margin/padding above */
}

/* nm-applet wraps the Wi-Fi list in a GtkScrolledWindow inside the menu.
   GTK caps it programmatically; min-height overrides that cap so all
   networks are visible without scrolling. */
menu scrolledwindow {
    min-height: 800px;
}

menu menuitem:hover,
.menu menuitem:hover,
.context-menu menuitem:hover {
    background-color: @hover_bg;
    color: @text_primary;
}

menu menuitem:active,
menu menuitem:checked,
.menu menuitem:active {
    background-color: @active_bg;
    color: @active_fg;
}

menu menuitem:disabled,
.menu menuitem:disabled,
.context-menu menuitem:disabled {
    color: @text_disabled;
}

/* Keyboard accelerator hint text on the right side */
menuitem accelerator,
.menuitem accelerator {
    color: @text_secondary;
    padding-left: 16px;
}

menuitem:hover accelerator {
    color: @text_primary;
}

menuitem:active accelerator,
menuitem:checked accelerator {
    color: @active_fg;
}

menuitem:disabled accelerator {
    color: @text_disabled;
}

/* Submenu arrow */
menuitem arrow,
.menuitem arrow {
    color: @text_secondary;
    min-width: 12px;
    min-height: 12px;
    -gtk-icon-source: -gtk-icontheme("pan-end-symbolic");
}

menuitem:hover arrow {
    color: @text_primary;
}

menuitem:dir(rtl) arrow {
    -gtk-icon-source: -gtk-icontheme("pan-start-symbolic");
}

/* Check / radio inside menus */
menuitem check,
menuitem radio,
.menuitem check,
.menuitem radio {
    min-width: 14px;
    min-height: 14px;
    color: @brand_green;
    margin-right: 8px;
}

menuitem check:checked,
menuitem radio:checked {
    color: @brand_green;
    -gtk-icon-shadow: none;
}

/* Separator inside menus */
menu separator,
.menu separator,
.context-menu separator {
    background-color: @menu_border;
    min-height: 1px;
    margin: 3px 0;
}

/* ── Popovers (modern) ───────────────────────────────────── */

popover,
popover.background {
    background-color: @menu_bg;
    background-image: none;
    border: 1px solid @menu_border;
    border-radius: 8px;
    color: @text_primary;
    padding: 6px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45),
                0 2px 4px  rgba(0, 0, 0, 0.30);
}

popover > arrow,
popover.background > arrow {
    background-color: @menu_bg;
    border: 1px solid @menu_border;
}

/* Modelbutton — the flat row-style button used in popover menus */
modelbutton,
popover modelbutton {
    padding: 6px 10px;
    min-height: 24px;
    border-radius: 4px;
    background-color: transparent;
    color: @text_primary;
    outline: none;
}

modelbutton:hover,
popover modelbutton:hover {
    background-color: @hover_bg;
    color: @text_primary;
}

modelbutton:active,
modelbutton:checked,
popover modelbutton:active,
popover modelbutton:checked {
    background-color: @active_bg;
    color: @active_fg;
}

modelbutton:disabled,
popover modelbutton:disabled {
    background-color: transparent;
    color: @text_disabled;
}

modelbutton check,
modelbutton radio {
    color: @brand_green;
}

modelbutton arrow.left,
modelbutton arrow.right {
    color: @text_secondary;
    min-width: 12px;
    min-height: 12px;
}

modelbutton:hover arrow {
    color: @text_primary;
}

/* Separators inside popovers */
popover separator {
    background-color: @menu_border;
    min-height: 1px;
    margin: 3px 2px;
}

/* Entries inside popovers — keep the entry style but match the surface */
popover entry {
    background-color: @surface_bg;
    border-color: @menu_border;
}

popover entry:focus {
    border-color: @brand_green;
    box-shadow: inset 0 0 0 1px @brand_green;
}

/* Buttons inside popovers — flat by default */
popover button {
    background-color: transparent;
    border-color: transparent;
    color: @text_primary;
}

popover button:hover {
    background-color: @hover_bg;
}

popover button:active,
popover button:checked {
    background-color: @active_bg;
    color: @active_fg;
}

popover button.suggested-action {
    background-color: @brand_green;
    color: @text_on_accent;
}

popover button.destructive-action {
    background-color: @error_color;
    color: #ffffff;
}

/* ── Tooltips ────────────────────────────────────────────── */

tooltip,
tooltip.background {
    background-color: @tooltip_background;
    background-image: none;
    border: 1px solid @tooltip_border;
    border-radius: 6px;
    color: @tooltip_text;
    padding: 4px 8px;
    text-shadow: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.40);
}

tooltip label,
tooltip.background label {
    padding: 0;
    color: @tooltip_text;
}

/* ── Whisker menu (xfce4-whiskermenu-plugin) ─────────────── */
/* Whisker has no menuitems — the app/category lists are GtkTreeViews.
   Row height = cell padding + the icon-size set in Whisker's own
   settings, so trim padding here and keep icons small in Whisker. */

/* Whisker sets the popup's GTK *widget name* (gtk_widget_set_name),
   which CSS matches as #id — NOT a .class. The #id selector also
   outranks the base `window.background` rule (headerbars.css). */
#whiskermenu-window {
    background-color: @menu_bg;
    color: @text_primary;
    padding: 2px;
}

#whiskermenu-window .view,
#whiskermenu-window treeview,
#whiskermenu-window treeview.view,
#whiskermenu-window iconview,
#whiskermenu-window scrolledwindow,
#whiskermenu-window viewport,
#whiskermenu-window stack,
#whiskermenu-window box {
    background-color: @menu_bg;
    color: @text_primary;
}

#whiskermenu-window treeview.view,
#whiskermenu-window iconview {
    padding: 1px 4px;
    -GtkTreeView-vertical-separator: 0;
}

#whiskermenu-window treeview.view:hover,
#whiskermenu-window iconview:hover {
    background-color: @hover_bg;
    color: @text_primary;
}

#whiskermenu-window treeview.view:selected,
#whiskermenu-window iconview:selected {
    background-color: @active_bg;
    color: @active_fg;
}

/* Search entry and the bottom command buttons */
#whiskermenu-window entry {
    margin: 2px;
    background-color: @menu_bg;
    border-color: @menu_border;
    color: @text_primary;
}

#whiskermenu-window entry:focus {
    border-color: @brand_green;
    box-shadow: inset 0 0 0 1px @brand_green;
}

#whiskermenu-window button {
    padding: 2px 6px;
    min-height: 0;
    background-color: transparent;
    color: @text_primary;
}

#whiskermenu-window button:hover {
    background-color: @hover_bg;
}

#whiskermenu-window button:checked,
#whiskermenu-window button:active {
    background-color: @active_bg;
    color: @active_fg;
}

#whiskermenu-window separator {
    margin: 2px 0;
}

/* ── Tooltips (cont.) ────────────────────────────────────── */

tooltip * {
    background-color: transparent;
    color: @tooltip_text;
}
