/* NexusOS — Segment 5: sidebars, list boxes, tree views, places sidebars.
   Row selection is purple (the secondary accent), hover is the lime wash.
   This keeps "selected" visually distinct from "the thing my cursor is on". */

/* ── Generic listbox ─────────────────────────────────────── */

list,
listview,
.list {
    background-color: @base_bg;
    color: @text_primary;
    border-color: @border;
}

list row,
listview row,
.list row,
.list-row {
    padding: 8px 12px;
    background-color: transparent;
    color: @text_primary;
    border-bottom: 1px solid alpha(@border, 0.45);
    transition: background-color 100ms ease,
                color            100ms ease;
}

list row:last-child,
listview row:last-child,
.list row:last-child {
    border-bottom: none;
}

list row:hover,
listview row:hover,
.list row:hover {
    background-color: @hover_bg;
    color: @text_primary;
}

list row:selected,
listview row:selected,
.list row:selected,
list row.activatable:selected {
    background-color: @selected_bg;
    color: @selected_fg;
    border-bottom-color: alpha(@brand_purple_dark, 0.6);
}

list row:selected:hover,
listview row:selected:hover {
    background-color: shade(@selected_bg, 1.12);
    color: @selected_fg;
}

list row:disabled,
listview row:disabled {
    color: @text_disabled;
}

/* .activatable rows (clickable) get a subtle hover hint */
list row.activatable:hover {
    background-color: @hover_bg;
}

list row.activatable:active {
    background-color: shade(@hover_bg, 1.2);
}

/* Separator row */
list row.separator,
list separator {
    background-color: @border;
    min-height: 1px;
    padding: 0;
    margin: 0;
}

/* Rich-list rows (titles + subtitles) */
list.rich-list row {
    padding: 10px 14px;
}

list.rich-list row .title {
    font-weight: 500;
    color: @text_primary;
}

list.rich-list row .subtitle {
    color: @text_secondary;
    font-size: smaller;
}

list.rich-list row:selected .subtitle {
    color: alpha(@selected_fg, 0.85);
}

/* ── Sidebars ────────────────────────────────────────────── */

.sidebar,
stacksidebar,
stacksidebar.sidebar {
    background-color: @base_bg;
    color: @text_primary;
    border-right: 1px solid @border;
    padding: 0;
}

.sidebar:dir(rtl),
stacksidebar:dir(rtl) {
    border-left: 1px solid @border;
    border-right: none;
}

.sidebar:backdrop,
stacksidebar:backdrop {
    background-color: @base_bg;
    color: @text_secondary;
}

.sidebar list,
.sidebar listview,
stacksidebar list {
    background-color: transparent;
    color: @text_primary;
}

.sidebar list row,
.sidebar listview row,
stacksidebar list row {
    padding: 8px 14px;
    border-bottom: none;
    border-radius: 4px;
    margin: 2px 6px;
}

.sidebar list row:hover,
stacksidebar list row:hover {
    background-color: @hover_bg;
}

.sidebar list row:selected,
.sidebar listview row:selected,
stacksidebar list row:selected {
    background-color: @selected_bg;
    color: @selected_fg;
}

.sidebar list row:selected:hover,
stacksidebar list row:selected:hover {
    background-color: shade(@selected_bg, 1.12);
}

/* Header rows inside a sidebar (libhandy/libadwaita) */
.sidebar .navigation-sidebar > row,
.navigation-sidebar > row {
    padding: 8px 14px;
    margin: 2px 6px;
    border-radius: 4px;
    border-bottom: none;
}

/* ── Places sidebar (file managers, GtkFileChooser) ──────── */

placessidebar {
    background-color: @base_bg;
    color: @text_primary;
}

placessidebar > viewport.frame {
    border: none;
}

placessidebar list {
    background-color: transparent;
}

placessidebar row {
    padding: 6px 12px;
    border-radius: 4px;
    margin: 1px 6px;
}

placessidebar row:hover {
    background-color: @hover_bg;
}

placessidebar row:selected {
    background-color: @selected_bg;
    color: @selected_fg;
}

placessidebar row:selected image {
    color: @selected_fg;
}

placessidebar row image {
    color: @text_secondary;
    min-width: 16px;
    padding-right: 6px;
}

placessidebar row:hover image {
    color: @brand_green;
}

placessidebar row.has-open-popup {
    background-color: @hover_bg;
}

/* Drop-target highlight when dragging onto a places row */
placessidebar row.sidebar-new-bookmark-row {
    color: @brand_green;
}

placessidebar row:drop(active) {
    background-color: alpha(@brand_green, 0.25);
    color: @text_primary;
    box-shadow: inset 0 0 0 2px @brand_green;
}

/* ── Tree views / column views ───────────────────────────── */

treeview,
columnview,
treeview.view,
columnview.view {
    background-color: @base_bg;
    color: @text_primary;
    border-color: @border;
    -GtkTreeView-grid-line-pattern: "\7\7";
    -GtkTreeView-grid-line-width: 1;
}

treeview.view:hover,
columnview.view:hover {
    background-color: @hover_bg;
}

treeview.view:selected,
columnview.view:selected,
treeview.view:selected:focus,
columnview.view:selected:focus,
treeview.view row:selected,
columnview.view row:selected {
    background-color: @selected_bg;
    color: @selected_fg;
}

treeview.view:selected:hover,
columnview.view:selected:hover {
    background-color: shade(@selected_bg, 1.12);
}

treeview.view:disabled,
columnview.view:disabled {
    color: @text_disabled;
}

/* Alternate-row background for "rules-hint" tree views */
treeview.view:nth-child(even) {
    background-color: alpha(@surface_bg, 0.5);
}

/* Tree expander arrows */
treeview.view expander,
columnview.view expander {
    color: @text_secondary;
    min-width: 14px;
    min-height: 14px;
    -gtk-icon-source: -gtk-icontheme("pan-end-symbolic");
}

treeview.view expander:hover,
columnview.view expander:hover {
    color: @brand_green;
}

treeview.view expander:checked,
columnview.view expander:checked {
    -gtk-icon-source: -gtk-icontheme("pan-down-symbolic");
    color: @brand_green;
}

treeview.view expander:dir(rtl) {
    -gtk-icon-source: -gtk-icontheme("pan-start-symbolic");
}

/* Cell separators (vertical grid lines) */
treeview.view.separator,
columnview.view.separator {
    color: @border;
    background-color: @border;
}

/* Column headers — sit on the alt surface so they read as chrome */
treeview header button,
columnview header button,
treeview.view header button,
columnview.view header button {
    background-color: @surface_bg_alt;
    background-image: none;
    border: none;
    border-right: 1px solid @border;
    border-bottom: 1px solid @border;
    border-radius: 0;
    color: @text_primary;
    padding: 6px 10px;
    font-weight: 500;
    box-shadow: none;
}

treeview header button:hover,
columnview header button:hover {
    background-color: @overlay_bg;
    color: @brand_green;
}

treeview header button:active,
treeview header button:checked,
columnview header button:active {
    background-color: @overlay_bg;
    color: @brand_green;
    box-shadow: inset 0 -2px 0 0 @brand_green;
}

treeview header button:last-child,
columnview header button:last-child {
    border-right: none;
}

/* Drag-and-drop indicators */
treeview.view.dnd,
columnview.view.dnd {
    border-style: solid none;
    border-width: 1px;
    border-color: @brand_green;
}

treeview.view:drop(active),
columnview.view:drop(active) {
    background-color: alpha(@brand_green, 0.20);
    box-shadow: inset 0 0 0 1px @brand_green;
}

/* In-cell progress bar */
treeview.view.progressbar,
columnview.view.progressbar {
    background-color: @brand_green;
    color: @text_on_accent;
    border-radius: 2px;
}

treeview.view.trough,
columnview.view.trough {
    background-color: @surface_bg_alt;
    border-radius: 2px;
}
