/* NexusOS — Segment 2: buttons & entries.
   Foundation widgets. Lime green = primary accent (hover/active/focus),
   purple = selection within text. */

/* ── Buttons ─────────────────────────────────────────────── */

button {
    min-height: 24px;
    min-width: 16px;
    padding: 6px 12px;
    border: 1px solid @border_strong;
    border-radius: 6px;
    background-color: @surface_bg;
    background-image: none;
    color: @text_primary;
    transition: background-color 120ms ease,
                border-color     120ms ease,
                color            120ms ease,
                box-shadow       120ms ease;
    text-shadow: none;
    -gtk-icon-shadow: none;
}

button:hover {
    background-color: @hover_bg;
    border-color: @brand_green_dark;
    color: @text_primary;
}

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

button:checked:hover {
    background-color: @brand_green_light;
    border-color: @brand_green;
    color: @active_fg;
}

button:focus,
button:focus-visible {
    outline: 2px solid @focus_ring;
    outline-offset: -1px;
    border-color: @brand_green;
}

button:disabled,
button:disabled:hover,
button:disabled:active {
    background-color: @surface_bg;
    border-color: @border;
    color: @text_disabled;
    -gtk-icon-effect: dim;
}

/* Flat buttons — transparent until interacted with */
button.flat {
    background-color: transparent;
    border-color: transparent;
    box-shadow: none;
}

button.flat:hover {
    background-color: @hover_bg;
    border-color: transparent;
}

button.flat:active,
button.flat:checked {
    background-color: @active_bg;
    border-color: transparent;
    color: @active_fg;
}

button.flat:disabled {
    background-color: transparent;
    border-color: transparent;
    color: @text_disabled;
}

/* Suggested-action — primary CTA, solid lime green */
button.suggested-action {
    background-color: @brand_green;
    border-color: @brand_green_dark;
    color: @text_on_accent;
    font-weight: 600;
}

button.suggested-action:hover {
    background-color: @brand_green_light;
    border-color: @brand_green;
    color: @text_on_accent;
}

button.suggested-action:active,
button.suggested-action:checked {
    background-color: @brand_green_dark;
    border-color: @brand_green_dark;
    color: @text_on_accent;
}

button.suggested-action:disabled {
    background-color: alpha(@brand_green, 0.25);
    border-color: transparent;
    color: @text_disabled;
}

/* Destructive-action — solid red */
button.destructive-action {
    background-color: @error_color;
    border-color: shade(@error_color, 0.85);
    color: #ffffff;
    font-weight: 600;
}

button.destructive-action:hover {
    background-color: shade(@error_color, 1.10);
    border-color: shade(@error_color, 0.85);
}

button.destructive-action:active,
button.destructive-action:checked {
    background-color: shade(@error_color, 0.85);
    border-color: shade(@error_color, 0.75);
}

button.destructive-action:disabled {
    background-color: alpha(@error_color, 0.30);
    border-color: transparent;
    color: @text_disabled;
}

/* Image-only buttons — slightly tighter padding */
button.image-button {
    padding: 6px 8px;
    min-width: 24px;
}

/* Linked button groups — share borders, only the ends round */
.linked > button,
.linked > entry {
    border-radius: 0;
    border-right-width: 0;
}

.linked > button:first-child,
.linked > entry:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.linked > button:last-child,
.linked > entry:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    border-right-width: 1px;
}

.linked.vertical > button,
.linked.vertical > entry {
    border-radius: 0;
    border-right-width: 1px;
    border-bottom-width: 0;
}

.linked.vertical > button:first-child,
.linked.vertical > entry:first-child {
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

.linked.vertical > button:last-child,
.linked.vertical > entry:last-child {
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    border-bottom-width: 1px;
}

/* Link buttons — inline hyperlink style */
button.link,
*.link {
    background-color: transparent;
    border-color: transparent;
    padding: 0;
    color: @link_color;
    text-shadow: none;
}

button.link:hover,
*.link:hover {
    background-color: transparent;
    color: @brand_green_light;
    text-decoration: underline;
}

button.link:visited,
*.link:visited {
    color: @link_visited_color;
}

button.link:disabled {
    color: @text_disabled;
}

/* ── Entries ─────────────────────────────────────────────── */

entry,
spinbutton:not(.vertical) {
    min-height: 24px;
    padding: 6px 10px;
    border: 1px solid @border_strong;
    border-radius: 6px;
    background-color: @surface_bg;
    background-image: none;
    color: @text_primary;
    caret-color: @brand_green;
    transition: border-color 120ms ease,
                box-shadow   120ms ease,
                background-color 120ms ease;
}

entry:hover {
    border-color: @brand_green_dark;
}

entry:focus,
entry:focus-within {
    border-color: @brand_green;
    box-shadow: inset 0 0 0 1px @brand_green;
    background-color: @surface_bg;
}

entry:disabled {
    background-color: @insensitive_bg_color;
    border-color: @border;
    color: @text_disabled;
}

entry selection {
    background-color: @selected_bg;
    color: @selected_fg;
}

entry:selected {
    background-color: @selected_bg;
    color: @selected_fg;
}

entry image {
    color: @text_secondary;
    padding: 0 4px;
}

entry image:hover {
    color: @brand_green;
}

entry progress {
    background-color: @brand_green;
    background-image: none;
    border: none;
    border-radius: 2px;
    margin: 0 -10px -6px -10px;
    min-height: 2px;
}

/* Error / warning / success states */
entry.error {
    border-color: @error_color;
    box-shadow: inset 0 0 0 1px @error_color;
    color: @error_color;
}

entry.warning {
    border-color: @warning_color;
    box-shadow: inset 0 0 0 1px @warning_color;
    color: @warning_color;
}

entry.success {
    border-color: @success_color;
    box-shadow: inset 0 0 0 1px @success_color;
}

/* Search entries — slight visual tweak */
entry.search {
    border-radius: 999px;
    padding-left: 14px;
    padding-right: 14px;
}

/* ── Spinbuttons ─────────────────────────────────────────── */

spinbutton button {
    background-color: transparent;
    border-color: transparent;
    border-radius: 0;
    color: @text_secondary;
    min-width: 18px;
    padding: 4px 6px;
}

spinbutton button:hover {
    background-color: @hover_bg;
    color: @text_primary;
}

spinbutton button:active {
    background-color: @active_bg;
    color: @active_fg;
}

spinbutton button:disabled {
    background-color: transparent;
    color: @text_disabled;
}

spinbutton.vertical button {
    border-left: 1px solid @border;
}

/* ── Text views (multi-line) ────────────────────────────── */

textview,
textview text {
    background-color: @base_bg;
    color: @text_primary;
    caret-color: @brand_green;
}

textview text selection {
    background-color: @selected_bg;
    color: @selected_fg;
}

textview:disabled,
textview:disabled text {
    color: @text_disabled;
}
