/* =========================
   Theme + Base
========================= */

:root {
    --bg: #1e1e1e;
    --panel: #2e2e2e;
    --panel-hover: #3e3e3e;
    --border: #6b6b6b;
    --text: #ffffff;
    --warn: rgb(255, 110, 110);

    --radius: 12px;
    --radius-sm: 9px;

    --btn-h: 38px;
    --btn-w: 300px;

    --small-btn-h: 30px;
    --small-btn-w: 110px;

    --input-max-w: 75px;
    --input-h: 25px;

    --img-size: 30px;

    --font-size: 22px;
    --small-font-size: 16px;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: sans-serif;
    touch-action: manipulation;
    padding: 10px;
    font-size: var(--font-size);
}

h1 {
    color: var(--text);
    font-size: 45px;
}

p {
    color: var(--text);
    margin: 0 0 8px 0;
    font-size: var(--font-size);
}

a {
    color: #2196f3;
    font-size: var(--font-size);
}

pre {
    color: var(--text);
    white-space: pre-wrap;
    margin: 0;
    font-size: 19px;
}

.label {
    margin: 0;
}

/* Utility helpers */
.hidden {
    display: none !important;
}
.visible {
    visibility: hidden;
}
.spacer {
    height: 15px;
}

/* Hide element but keep it in DOM for JS.
   This is better than the "hidden" attribute for your use case,
   because some browsers treat hidden form elements differently. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* =========================
   Form Layout
========================= */

.checkbox-container {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    column-gap: 60px;
    row-gap: 0px;
    align-items: center;
}

.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;

    display: inline-flex;
}

.input-container {
    max-width: var(--btn-w);
}

.input-row {
    display: flex;
    align-items: center;
}

.res_label {
    flex: 1;
    text-align: right;
    padding-right: 8px;
}

.resource {
    flex: 2;
    max-width: var(--input-max-w);
    height: var(--input-h);
    color: var(--text);
    background-color: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 20px;
}

.res-icon {
    width: var(--img-size);
    height: var(--img-size);
    margin-right: 8px;
    flex-shrink: 0; /* prevents flex from stretching it */
}

/* =========================
   Buttons
========================= */

button {
    display: block;
    color: var(--text);
    background-color: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    width: var(--btn-w);
    height: var(--btn-h);
    margin-bottom: 6px;
    font-size: var(--font-size);
    cursor: pointer; /* always, not only on hover */
}

button:hover {
    background-color: var(--panel-hover);
}

.small-button {
    color: var(--warn);
    width: var(--small-btn-w);
    height: var(--small-btn-h);
    font-size: var(--small-font-size);
    padding: 0;
}

/* =========================
   Inputs
========================= */

input:hover {
    background-color: var(--panel-hover);
}

/* =========================
   Native Select (only used for limit_box)
========================= */

select {
    background-color: var(--panel);
    color: var(--text);
    font-size: var(--font-size);
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
}

select:hover {
    background-color: var(--panel-hover);
}

/* Keep your old scrollbar styling for native selects */
select::-webkit-scrollbar {
    width: 18px;
}
select::-webkit-scrollbar-track {
    background: var(--panel);
}
select::-webkit-scrollbar-thumb {
    background: var(--text);
    border-radius: var(--radius-sm);
}

option {
    background-color: var(--bg);
    color: var(--text);
    font-size: var(--font-size);
}

/* =========================
   Custom Checkboxes
========================= */

.container {
    display: block;
    position: relative;
    line-height: 30px;
    padding-left: 38px;
    margin: 3px 6px 6px 0;
    user-select: none;
    color: var(--text);
    cursor: pointer;
}

.container input {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 30px;
    width: 30px;
    border-radius: var(--radius-sm);
    background-color: var(--panel);
}

.container:hover input ~ .checkmark {
    background-color: var(--panel-hover);
}

.container input:checked ~ .checkmark {
    background-color: #2196f3;
}

.checkmark::after {
    content: "";
    position: absolute;
    inset: 0;

    background-color: white;

    -webkit-mask: url("../assets/checkmark.svg") no-repeat center;
    -webkit-mask-size: 90%;

    mask: url("../assets/checkmark.svg") no-repeat center;
    mask-size: 90%;

    display: none;
}

.container input:checked ~ .checkmark::after {
    display: block;
}

/* =========================
   Output Table / Items
========================= */

#table-container {
    min-height: 600px; /* prevents page collapsing when empty */
}

.items {
    color: var(--text);
    font-size: var(--font-size);
}

.items img {
    width: var(--img-size);
    height: var(--img-size);
}

.note {
    color: var(--warn);
}


.items.boosts3 {
    border-collapse: collapse;
}

.items.boosts3 th,
.items.boosts3 td {
    padding: 3px 9px;
    vertical-align: middle;
}

.items.boosts3 th.num,
.items.boosts3 td.num {
    text-align: right;
    white-space: nowrap;
}

.items.boosts3 .res-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.items.boosts3 .sub-label {
    opacity: 0.8;
    font-size: 0.95em;
}

.items.boosts3 .res-gap td {
    padding: 9px 0;
}

/* =========================
   Fake Select (with images)
========================= */

.fake-select {
    position: relative;
    margin-bottom: 6px;
}


.fake-select.large {
    width: var(--btn-w);
}

/* Make the fake “selected” control look like your other buttons,
   but without forcing button width/height. */
.fake-select .selected {
    width: 100%;
    height: var(--btn-h);
    margin-bottom: 0;              /* avoids double spacing inside container */ 
}
.fake-select .selected, .fake-select .option {
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: var(--font-size);
}
.fake-select.small .selected {
    justify-content: center;    /* horizontal */
}


/* icons inside dropdown + selected */
.fake-select img {
    width: var(--img-size);
    height: var(--img-size);
}

/* dropdown panel */
.fake-select .options {
    display: none;
    position: absolute;
    width: 100%;
    margin-top: 8px;

    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);

    max-height: 450px;
    overflow-y: auto;
    z-index: 10;

    color: var(--text);
    font-size: var(--font-size);
}

.fake-select.open .options {
    display: block;
}

.fake-select .option:hover {
    background: var(--panel-hover);
}

/* scrollbar for the custom dropdown */
.fake-select .options::-webkit-scrollbar {
    width: 12px;
}
.fake-select .options::-webkit-scrollbar-track {
    background: var(--panel);
    border-radius: var(--radius-sm);
}
.fake-select .options::-webkit-scrollbar-thumb {
    background: var(--text);
    border-radius: var(--radius-sm);
}

/* Firefox only */
@supports (-moz-appearance: none) {
    .fake-select .options {
        scrollbar-width: thin;
        scrollbar-color: var(--text) var(--panel);
    }
}