/* Variables */
:root {
    /* Fonts */
    --font-website: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --font-receipt: "Roboto Mono", "Courier New", Courier, monospace;
    --font-receipt-form: var(--font-receipt);

    /* Colors */
    --bg: #F3F2ED;
    --text-website: #1a1a1a;
    --text-receipt: #1a1a1a;
    --text-muted: #9f9f9f;
    --text-error: #9d2222;
    --paper: #ffffff;
    --shadow: rgba(10, 10, 10, 0.15);
    --button-bg: #ffffff;
    --button-hover-bg: #fafafa;
    --border: #9f9f9f;
    --progress-bar-bg: #ffffff;
    --progress-bar: #3b3b3b;
    --highlight-1: #ffcc00;
    --highlight-2: #C3D5B7;
    --highlight-3: #B7C3D5;
    --highlight-4: #D5B7C3;
    --highlight-5: #C3B7D5;
    --highlight-6: #D5C3B7;

    /* Spacing */
    --vert-margin-p: 8px;
    --vert-margin-ui: 16px;
    --vert-margin-ui-small: 4px;
    --vert-margin-receipt: 5px;
    --vert-margin-divider: 15px;
    --vert-margin-receipt-big: 25px;

    /* Receipt geometry */
    --receipt-content-width: 42ch;
    --receipt-padding-x: 18px;
    --receipt-padding-y: 25px;
}

/* Basics */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
}

p, h1, h2, h3 {
    overflow-wrap: break-word;
}

img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
}

input, button, textarea, select {
    font: inherit;
    color: inherit;
    font-size: inherit;
}

button {
    cursor: pointer;
}

label {
    cursor: text;
}

[hidden] {
    display: none !important;
}

/* Custom styles */
html, body {
    height: 100%;
}

body {
    font-family: var(--font-website);
    color: var(--text-website);
    background-color: var(--bg);
    font-size: 15px;
    /* line-height: 1.5; */
    display: flex;
    flex-direction: column;
}

main {
    padding: 15px;
    flex: 1 0 auto;
}

p {
    margin-bottom: var(--vert-margin-p);
}

h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}

h2 {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}

.receipt-form {
    font-family: var(--font-receipt-form);
    font-weight: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin: auto;
}

.receipt {
    font-family: var(--font-receipt);
    font-weight: 300;
    line-height: 1.3;
    color: var(--text-receipt);
    width: calc(var(--receipt-content-width) + 2 * var(--receipt-padding-x));
    max-width: 100%;
    margin-inline: auto;
    padding: var(--receipt-padding-y) var(--receipt-padding-x);
    margin-bottom: var(--vert-margin-ui);
    background-color: var(--paper);
    box-shadow: 0px 0px 10px 0px var(--shadow);
}

.receipt-header {
    text-align: center;
    margin-bottom: var(--vert-margin-receipt);
}

.receipt-logo {
    max-height: 80px;
    max-width: 100%;
    display: block;
    margin: 0 auto;
}

.receipt-logo-fallback {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    overflow-wrap: break-word;
}

.receipt-divider {
    margin: var(--vert-margin-divider) 0;
    white-space: nowrap;
    text-align: center;
    display: block;
    overflow: hidden;
}

.receipt-rows-wrapper {
    margin-bottom: var(--vert-margin-receipt-big);
}

.receipt-row-input {
    display: flex;
    flex-direction: row;
    margin-bottom: var(--vert-margin-receipt);
}

.name-label {
    white-space: pre;
}

.receipt-input-name,
.receipt-input-field {
    flex-grow: 1;
    min-width: 0;
}

input[type="text"], textarea {
    border: none;
    background: transparent;
    padding: 0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="text"]:focus, textarea:focus {
    background: transparent;
    outline: none;
}

input[type="text"]::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

.receipt-row {
    margin-bottom: var(--vert-margin-receipt);
    white-space: pre;
    overflow: hidden;
}

.receipt-textarea {
    width: 100%;
    resize: none;
    overflow: hidden;
    margin-bottom: var(--vert-margin-receipt-big);
}

.receipt-upload-box {
    border: 0.5px solid var(--border);
    background-color: var(--button-bg);
    padding: 12px;
    cursor: pointer;
    /* position: relative; */
    /* min-height: 100px; */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    margin-bottom: var(--vert-margin-receipt);
    width: 100%;
}

.receipt-upload-box:hover,
.receipt-upload-box:active,
.receipt-upload-box:focus-visible {
    background-color: var(--button-hover-bg);
}

.receipt-upload-box:focus-visible {
    outline: 1px solid var(--border);
}

.receipt-image-preview-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: var(--vert-margin-receipt);
    width: 100%;
}

.receipt-image-preview-frame {
    position: relative;
    max-width: 80%;
}

.receipt-image-preview {
    display: block;
    max-width: 100%;
    max-height: 400px;
    /*image-rendering: pixelated;*/
}

.image-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 1;
}

.image-action-button {
    width: 22px;
    height: 22px;
    border: 0.5px solid var(--border);
    border-radius: 50%;
    background-color: var(--paper);
    color: var(--text-website);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.image-action-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 1.2;
    fill: none;
    pointer-events: none;
}

.image-action-button:hover {
    background-color: var(--button-hover-bg);
}

.image-action-button:focus-visible {
    outline: 1px solid var(--border);
}

.plus {
    font-size: 22px;
    font-weight: 100;
    /* line-height: 1.0; */
    margin-top: -8px;
}

.submit-button {
    background-color: var(--button-bg);
    border: 0.5px solid var(--border);
    padding: 8px 20px;
    width: 100%;
    margin-bottom: var(--vert-margin-ui);
}

.submit-button:hover {
    background-color: var(--button-hover-bg);
}

.submit-button:has(+ .submit-button) {
    margin-bottom: var(--vert-margin-ui-small);
}

.submit-button:focus-visible {
    outline: 1px solid var(--border);
}

footer {
    background-color: var(--paper);
    text-align: center;
    padding: 15px;
}

.footer-link {
    color: inherit;
    text-decoration: none;
}

.status-wrapper {
    width: 100%;
}

.status-text {
    /* width: 0 keeps the status text out of the form's fit-content width calculation */
    width: 0;
    min-width: 100%;
    margin-bottom: var(--vert-margin-ui-small);
    text-align: center;
    overflow-wrap: break-word;
}

.status-text.is-error {
    color: var(--text-error);
}

.progress-bar-wrapper {
    display: none;
    width: 100%;
    height: 8px;
    background-color: var(--progress-bar-bg);
    border: 0.5px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--vert-margin-ui);
}

.progress-bar {
    height: 100%;
    background-color: var(--progress-bar);
    width: 25%;
    transition: width 0.5s ease;
}

.receipt-title {
    margin-top: 0;
    margin-bottom: var(--vert-margin-receipt);
}

.receipt-subtitle {
    text-align: left;
    margin-top: 0;
    margin-bottom: var(--vert-margin-receipt-big);
}

.receipt-hint {
    text-align: left;
    color: var(--text-muted);
    margin-top: 0;
    margin-bottom: 0;
}

.receipt-closed-note {
    width: 0;
    min-width: 100%;
    margin: 0 0 var(--vert-margin-ui);
    text-align: center;
    overflow-wrap: break-word;
}

.receipt-error-message {
    /* width: 0 keeps the error text out of the form's fit-content width calculation */
    width: 0;
    min-width: 100%;
    margin: 0 0 var(--vert-margin-ui-small);
    text-align: center;
    overflow-wrap: break-word;
    color: var(--text-error);
}

.access-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.access-label {
    font-family: var(--font-receipt);
    font-size: 14px;
}

.access-input {
    font-family: var(--font-receipt);
    border: 0.5px solid var(--border);
    padding: 10px 12px;
    background-color: #fff;
}

.access-input:focus {
    outline: 1px solid var(--border);
}