@import url("variables.css");

::-webkit-scrollbar {
    width: calc(var(--unit) / 2);
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    border-radius: calc(var(--border-radius) / 2);
    background: var(--surface-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--input-background);
}

body {
    color-scheme: dark;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    color: var(--text-primary-color);
    font-family: var(--main-font);
    font-size: var(--font-size);
    background-color: var(--background-color);
    height: 100%;
}

a {
    color: var(--text-primary-color);
}

h2 {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

body>.content {
    display: flex;
    flex-direction: row;
    height: calc(100vh - var(--header-height));
}

header {
    height: var(--header-height);
}

header .app-bar h1 {
    flex-grow: 1;
    margin: 0;
}

header .app-bar {
    display: flex;
    align-items: center;
    padding: var(--unit);
    background-color: var(--header-color);
    border-bottom: 1px solid var(--separator-color);
}

header .app-bar .logo svg {
    width: var(--logo-size);
    height: var(--logo-size);
    margin-right: var(--unit)
}

header .app-bar a {
    text-decoration: none;
}

nav {
    background-color: var(--sidebar-color);
    border-right: 1px solid var(--separator-color);
    height: 100%;
}

nav ul {
    padding: var(--unit) 0;
    margin: 0;
}

nav ul li {
    list-style: none;
    padding: 0 var(--unit) var(--unit) var(--unit);
}

nav ul li a {
    cursor: pointer;
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: var(--unit) calc(var(--unit) * 2);
    border-radius: var(--border-radius);
}

nav ul li a svg {
    margin-right: var(--unit);
    width: 24px;
    height: 24px;
}

nav ul li a:hover,
nav ul li a.active {
    background-color: var(--sidebar-hover-color);
}

main {
    width: 100%;
    height: 100%;
}

header button {
    margin-left: var(--unit);
}

.status svg {
    width: 20px;
    height: 20px;
}

.primary svg {
    fill: var(--text-primary-color);
}

.info svg {
    fill: var(--info-color);
}

.warning svg {
    fill: var(--warning-color);
}

.error svg {
    fill: var(--error-color);
}

.success svg {
    fill: var(--success-color);
}

svg {
    fill: var(--text-primary-color);
}

.toolbar {
    border-bottom: 1px solid var(--separator-color);
    height: var(--toolbar-height);
    display: flex;
    align-items: center;
    padding: 0 var(--unit);
    min-width: 0;
}

.toolbar h2 {
    flex-grow: 1;
    white-space: nowrap;
    overflow-x: hidden;
    min-width: 0;
    width: 0;
    text-overflow: ellipsis;
}

.toolbar h2 svg {
    margin-right: var(--unit);
}

.toolbar .icon-button {
    margin-left: var(--unit);
}

table {
    font-size: 0.9rem;
    width: 100%;
    border-collapse: collapse;
}

table tbody tr:hover {
    cursor: pointer;
    background-color: var(--surface-color);
}

table td,
table th {
    text-align: left;
    padding: var(--unit);
    border-bottom: 1px solid var(--separator-light-color);
}

table td.actions {
    text-align: right;
    justify-content: right;
    padding-right: var(--unit);
}

.list-page .scrollable-table {
    height: calc(100% - var(--toolbar-height) - 1px);
}

.scrollable-table {
    height: 100%;
    overflow-y: auto;
}

.scrollable-table th {
    position: sticky;
    top: 0;
    background-color: var(--background-color);
    z-index: 1;
}

.surface {
    background-color: var(--surface-color);
    border: 1px solid var(--separator-color);
}

#login-form {
    margin: auto;
    padding: calc(var(--unit) * 2);
    min-width: 500px;
}

#login-form .title {
    display: flex;
    align-items: center;
}

#login-form .title svg {
    width: var(--logo-size);
    height: var(--logo-size);
    margin-right: var(--unit);
}

#login-form .alert {
    margin-bottom: calc(var(--unit) * 2);
}

#invoice-items .subtitle {
    color: var(--text-secondary-color);
    font-size: 0.8rem;
}

.page {
    padding: var(--unit);
    overflow-y: auto;
    height: 100%;
    min-height: 0;
}

.page .section h2 {
    margin: 0;
}

.page .section .content {
    width: 100%;
    padding-top: calc(var(--unit) * 2);
}

hr {
    border: none;
    height: 1px;
    background-color: var(--separator-color);
}

.surface {
    margin: auto;
    background-color: var(--surface-color);
    border: solid 1px var(--separator-color);
    border-radius: var(--border-radius);
    min-width: 500px;
    width: 60%;
}

div.actions button {
    margin-left: var(--unit);
}

div.actions .pusher {
    flex-grow: 1;
}

div.actions {
    padding: var(--unit) 0;
    display: flex;
}

.modal {
    position: fixed;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation-name: fadeIn;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.modal>.modal-underlay {
    position: absolute;
    z-index: -1;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
}

.modal>.modal-content {
    background-color: var(--surface-color);
    margin-top: 10vh;
    width: 80%;
    max-width: 600px;
    border: solid 1px var(--separator-color);
    border-radius: var(--border-radius);
    padding: calc(var(--unit) * 2);
    animation-name: zoomIn;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.modal>.modal-content.wide {
    max-width: unset;
}

.modal>.modal-content h2 {
    margin: 0 0 calc(var(--unit) * 2) 0;
}

.modal.closing {
    animation-name: fadeOut;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.modal.closing>.modal-content {
    animation-name: zoomOut;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.split {
    display: flex;
    gap: var(--unit);
}

.split>div {
    flex-grow: .5;
    width: 50%;
}

form {
    margin: 0;
    padding: 0;
}

.form-control {
    width: 100%;
    height: 64px;
    margin-bottom: var(--unit);
}

.form-control.area {
    height: 128px;
}

.form-control.checkbox {
    height: 32px;
}

.form-control.checkbox .control {
    display: flex;
    align-items: center;
}

.form-control.checkbox .control input {
    width: auto;
    margin-right: var(--unit)
}

.form-control.checkbox .control label {
    font-size: 1rem;
}

.form-control label {
    display: block;
    font-size: .75rem;
}

.form-control input {
    appearance: textfield;
}

.form-control input,
.form-control textarea,
.form-control select {
    width: 100%;
    border: none;
    border-radius: var(--border-radius);
    padding: var(--unit);
    background-color: var(--input-background);
    color: var(--text-secondary-color);
    font-family: var(--main-font);
    font-size: var(--input-font-size);
}

.form-control select option {
    font-size: var(--input-font-size);
}

.form-control input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.4);
}

.form-control input:focus,
.form-control select:focus {
    outline: 1px solid var(--primary-color);
}

.form-control select {
    appearance: base-select;
}

.form-control select::picker-icon {
    margin-right: var(--unit);
}

.form-control.has-error {
    color: --error-color;
}

.form-control.has-error label {
    color: var(--error-color);
}

.form-control.has-error input,
.form-control.has-error textarea,
.form-control.has-error select {
    background-color: var(--error-background);
}

.form-control .error {
    font-size: .7rem;
    color: var(--error-color);
}

.primary {
    background-color: var(--primary-color);
}

.icon-button {
    padding: calc(var(--unit) / 2);
    border: none;
    cursor: pointer;
    border-radius: var(--border-radius);
}

.icon-button:hover {
    background-color: rgba(1, 1, 1, 0.2);
}

.icon-button svg {
    width: 24px;
    height: 24px;
}

.icon-button.small svg {
    width: 20px;
    height: 20px;
}

.icon-button .htmx-indicator {
    display: none;
}

.icon-button.htmx-request .htmx-indicator {
    display: inline;
}

.icon-button.htmx-request svg {
    display: none;
}

.icon-button.htmx-request .htmx-indicator svg {
    display: inline;
}

.alert {
    display: flex;
    align-items: center;
    padding: var(--unit);
    border-radius: var(--border-radius);
}

.alert.error {
    color: var(--error-color);
    border: 1px solid var(--error-color);
    background-color: var(--error-background);
}

.alert svg {
    width: 20px;
    height: 20px;
    margin-right: var(--unit);
}

.toast {
    display: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: calc(var(--unit) *2) var(--unit);
    text-align: center;
    animation-name: slideUp;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.toast.closing {
    animation-name: slideDown;
    animation-duration: 150ms;
    animation-timing-function: ease;
}

.toast.info {
    color: var(--info-color);
    background-color: var(--info-background);
}

.toast.warning {
    color: var(--warning-color);
    background-color: var(--warning-background);
}

.toast.error {
    color: var(--error-color);
    background-color: var(--error-background);
}

.toast.success {
    color: var(--success-color);
    background-color: var(--success-background);
}

button {
    appearance: button;
    border: none;
    border-radius: var(--border-radius);
    background-color: var(--input-background);
    color: var(--text-secondary-color);
    padding: var(--unit);
    cursor: pointer;
    font-family: var(--main-font);
    text-transform: uppercase;
}

button:hover {
    filter: brightness(150%);
}

button:disabled {
    filter: brightness(75%);
    cursor: default;
}

button.icon-button {
    background-color: transparent;
}

@keyframes slideUp {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes slideDown {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(100%);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes zoomIn {
    0% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes zoomOut {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(0.9);
    }
}


.progress {
    display: none;
    height: calc(var(--unit) / 4);
    background-color: var(--background-color);
    position: fixed;
    overflow: hidden;
    top: 0;
    left: 0;
    right: 0;
}

.progress.active {
    display: block;
}

.progress::before,
.progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    background-color: var(--primary-color);
    animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
}

.progress::after {
    animation-delay: 1.15s;
    animation-name: indeterminate-short;
    animation-duration: 2.1s;
}

@keyframes indeterminate {
    0% {
        left: -35%;
        right: 100%;
    }

    60% {
        left: 100%;
        right: -90%;
    }

    100% {
        left: 100%;
        right: -90%;
    }
}

@keyframes indeterminate-short {
    0% {
        left: -200%;
        right: 100%;
    }

    60% {
        left: 107%;
        right: -8%;
    }

    100% {
        left: 107%;
        right: -8%;
    }
}
