:root {
    --background: #000000;
    --foreground: #ffefef;
    --primary: #e033cf;
    --primary-hc: #ff9900;
    --success: #40be3e;
    --failure: #f15656;
    --red: #e2475c;
    --blue:  #488ae0;
    --green: #72c35e;
    --orange: #ea993d;
    --disabled: #6f6f72;
}

* {
    background-color: var(--background);
    color: var(--foreground);
    font-size: xx-large;
    user-select: none;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: none;
	touch-action: manipulation;
}

button, select {
    border: 3px solid var(--foreground);
    border-radius: 10px;
    padding: 8px;
    min-height: 2em;
    min-width: 2em;
    font-size: x-large;

    &:hover:not(:disabled) {
        color: var(--primary);
        border-color: var(--primary);
    }

    &:disabled {
        color: var(--disabled);
        background-color: var(--disabled);
    }
}

input {
    border: 2px solid var(--foreground);
    border-radius: 10px;
    padding: 8px 16px;
    outline: none;
    min-height: 1.4em;
    min-width: 1em;
}

hr {
    margin: 1.5% -1%;
}

dialog {
    outline: none;
    border: 1px solid var(--foreground);
    border-radius: 10px;
    min-width: 30%;

    &::backdrop {
        backdrop-filter: blur(1px) brightness(75%);
    }
}

.d-none {
    display: none;
}

.layout-wrapper {
    display: grid;
    grid-template-rows: 2fr 3fr;
    grid-template-columns: 5fr 3fr;
    height: 100svh;
    width: 100vw;
}

.error {
    border-color: var(--failure);
}

.selected {
    & > :first-child {
        text-decoration: underline;
        font-weight: bold;
    }
}

.purchase-buttons > button {
    flex-grow: 1;
    flex-basis: 0;
    font-size: xx-large;
}

.align-vertical {
    display: flex;
    flex-direction: column;
}

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

.align-right {
    align-items: right;
    align-content: end;
    text-align: right;
}

.spacer {
    width: 20px;
    height: 0.5rem;
    &[flex] {
        flex-grow: 1;
    }
}

.small {
    font-size: small;
}

.mt-3 {
    margin-top: 3%;
}

.mt-4 {
    margin-top: 4%;
}

.mt-5 {
    margin-top: 5%;
}

.mb-3 {
    margin-bottom: 3%;
}

.mb-4 {
    margin-bottom: 4%;
}

.mb-5 {
    margin-bottom: 5%;
}

.bg-red, .bg-blue, .bg-green, .bg-orange {
    &, & > * {
        color: var(--background);
    }
}

.bg-red, .bg-blue {
    &:hover {
        color: var(--primary-hc);
        border-color: var(--primary-hc);
    }
}

.bg-red {
    &, & > * {
        background-color: var(--red);
    }
}

.bg-blue {
    &, & > * {
        background-color: var(--blue);
    }
}

.bg-green {
    &, & > * {
        background-color: var(--green);
    }
}

.bg-orange {
    &, & > * {
        background-color: var(--orange);
    }
}

#auth-prompt > div > * {
    margin-bottom: 5%;
}

#transaction-failed {
    border-color: var(--failure);
}

#settings {
    & > div > *:not(:last-child) {
        margin-bottom: 2%;
    }

    hr {
        margin-top: -.25%;
    }
}

#purchase-select, #purchase-overview, #purchase-command {
    padding: .5vw;

    &:first-child {
        border-right: 2px solid var(--foreground);
    }

    &:last-child {
        border-top: 2px solid var(--foreground);
    }
}

#purchase-select {
    grid-row: 1 / 3;
    grid-column: 1;
    
    overflow-wrap: anywhere;
    overflow-y: auto;
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    scroll-padding: 1%;
    scrollbar-width: thin;

    border-top: none;

    & > div {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        height: min-content;

        border: 3px solid var(--foreground);
    
        & > * {
            aspect-ratio: 1/1;
            scroll-snap-align: end;
            text-align: center;
            align-content: center;
            border: 2px solid var(--foreground);

            & span {
                font-size: xx-large;
                font-weight: 700;
            }
        }
    }
}

#purchase-overview {
    grid-column: 2;
    grid-row: 1;

    min-height: 30svh;

    display: grid;
    grid-template-rows: auto max-content;

    /*
     * i have no clue why, but this makes the inner div
     * overflow and scroll properly instead of just..
     * re-sizing the outer div
     */
    overflow-y: auto;
}

#purchase-command {
    grid-column: 2;
    grid-row: 2;
}

#item-list {
    overflow-wrap: anywhere;
    overflow-y: auto;
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
    scrollbar-gutter: stable;
    scrollbar-width: thin;

    border-top: 3px solid var(--foreground);
    border-bottom: 3px solid var(--foreground);

    & > * {
        scroll-snap-align: center;
        align-content: start;
        flex-wrap: wrap;

        &:first-child {
            margin-top: 1%;
        }

        &:last-child {
            margin-bottom: 2%;
        }

        &:not(:last-child):after {
            content: "";
            display: block;
            margin: 1% auto;
            width: 90%;
            padding-top: 10px;
            border-bottom: 2px solid;
            border-image-slice: 1;
            border-image-source: linear-gradient(to right, var(--foreground), var(--background));
        }

        & > :last-child {
            padding-right: 2%;
        }
    }
}

#subtotal {
    font-size: larger;
    text-decoration: underline;
}

#tip-qty {
    width: 30%;
    text-align: center;
    margin: 0 2%;
}

#tip-round {
    width: 50%;
}

#purchase-statistics-canvas {
    max-height: 100%;
}

#numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);

    gap: 10px;

    & > button {
        font-size: xx-large;
        &:nth-child(10) {
            grid-column: 1 / 3;
        }
    }
}

#meta {
    & button {
        font-size: x-large;
    }
}

#clear-input {
    padding: 0px 12px;
    margin-left: 2%;
}
