/* #region ==================== SECTION */

.page-content > section + section,
.page-content > .overflow-container > section + section {
    margin-top: 1cm;
}

/* #endregion */


/* #region ==================== CONTROLS */

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.5cm;
    gap: 0.5cm;
}

.controls .btn-print {
    font-size: 0.9em;
}

/* #endregion */


.pages {
    padding-top: 0.5cm;
}


/* #region ==================== HEADERS */

/* page title */
.page-content h1 {
    font-size: 2.5em;
    font-weight: normal;
}

/* section titles */
.page-content h2 {
    font-size: 1.3em;
    margin-bottom: 0.5em;
    font-weight: 600;
}
.page-content .bottom-line {
    border-bottom: 1px solid hsla(0, 0%, 0%, 0.2);
    padding-left: 0.1em;
    padding-bottom: 0.25em;
}
.page-content h3.bottom-line {
    border-bottom: 1px solid hsla(0, 0%, 0%, 0.1);
}

.page-content h3 {
    font-size: 1.2em;
    margin-bottom: 0.5em;
}

.page-content h4 {
    font-size: 1.1em;
    margin-bottom: 0.25cm;
}

.page-content h5 {
    font-size: 1em;
    margin-bottom: 0.25cm;
}


/* #endregion */


/* #region ==================== LOGO */

#logo .img-wrapper {
    height: 3cm;
    align-items: center;
    display: flex;
    overflow: hidden;
}
#logo img {
    max-width: 5cm;
}

/* #endregion */


/* #region ==================== TITLE */

/* #logo-title {
    margin-bottom: -0.5cm;
    margin-top: -0.5cm;
} */
section.title {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1em;
}
section.title h1 {
    margin: 0;
    text-align: right;
}

.title-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* #endregion */


/* #region ==================== QR */

#qr-wrapper {
    width: 1.8cm;
    aspect-ratio: 1;
}
#qr-wrapper canvas,
#qr-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}
#qr-wrapper img {
    display: block;
}

/* #endregion */


/* #region ==================== PARTIES */

/* #receiver h2 {
    line-height: 1.5;
} */

#parties ul {
    padding-left: 0;
    list-style: none;
    margin-bottom: 0;
}
#parties ul li:before {
    margin-right: 0.5em;
}

#other dl {
    text-align: right;
    margin-bottom: 0.5em;
}
#other dt {
    font-size: 1.3em;
    font-weight: 600;
    line-height: 1.2;
}
#other dd {
    text-align: right;
    margin-bottom: 0;
}

/* #endregion */


/* #region ==================== MONEY */

.money {
    display: inline-flex;
}
.money .space {
    width: 0.2em;
}
.money .amount .frc {
    font-size: 0.8em;
    opacity: 0.5;
}

/* #endregion */


/* #region ==================== LINE ITEMS */

section.line-items {
    font-size: 0.9em;
}

section.line-items table {
    width: 100%;
}

.line-items {
    --col-index-width: 3.5%;
    --col-qty-width: 7.5%;
    --col-unit-width: 7.5%;
    --col-price-width: 11.5%;
    --col-discount-width: 8.5%;
    --col-discounted-price-width: 13%;
    --col-tax-width: 7.5%;
    --col-total-width: 12.5%;
}

.line-items-header th {
    white-space: nowrap;
    font-weight: 600;
}

.line-items td {
    vertical-align: middle;
}
.line-items .col-index {
    width: var(--col-index-width);
}
.line-items .col-name {
    /* width: 50%; */
    padding-left: 0;
    padding-right: 1em;
}
.line-items .col-qty {
    width: var(--col-qty-width);
}
.line-items .col-unit {
    width: var(--col-unit-width);
}
.line-items .col-price {
    width: var(--col-price-width);
    text-align: right;
}
.line-items .col-discount {
    width: var(--col-discount-width);
    text-align: right;
}
.line-items .col-discounted-price {
    width: var(--col-discounted-price-width);
    text-align: right;
}
.line-items .col-tax {
    width: var(--col-tax-width);
    text-align: center;
}
.line-items .col-total {
    text-align: right;
    width: var(--col-total-width);
    white-space: nowrap;
    padding-right: 0;
}

.line-items tr:first-child .col-name.has-desc span {
    /* margin-top: 0.5em; */
    /* display: inline-block; */
    /* line-height: 1; */
}
.line-items tr:first-child .col-name.has-desc p {
    /* margin-top: 0.5em; */
    /* margin-bottom: 0; */
    /* margin: 0; */
}
.item-description {
    color: hsl(0deg 0% 60%);
    font-size: 0.9em;
}

:root {
    --line-img-width: 2cm;
    --line-img-height: 1.5cm;
}

.name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.7em;
}
.name-wrapper .img-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--line-img-width);
    height: var(--line-img-height);
    flex-shrink: 0;
}
.name-wrapper .img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    cursor: pointer;
}
.name-wrapper .info-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}


.line-items .col-name-content {
    display: flex;
}
.line-items .col-name span.part-name {
    display: inline-block;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    /* width: 45%; */
}
.line-items .col-name span.seperator {
    margin-left: 0.5em;
    margin-right: 0.5em;
}
.line-items .col-name span.part-option {
    width: 52%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.line-items .col-qty span {
    /* margin-top: 0.2em; */
    display: inline-block;
}

.line-items .col-price hr {
    margin: 0.1em 0;
}

.line-items tr:not(:first-child) {
    font-size: 0.9em;
}

.line-items tr:not(:first-child) td:first-child {
    padding-left: 2em;
}

.line-items hr {
    margin-top: 0.25em;
    margin-bottom: 0;
}
/* .line-items hr:last-child {
    display: none;
} */

.line-items tr:first-child {
    vertical-align: top;
}
.line-items tr:first-child td {
    padding-top: 0.5em;
}

.line-items .bullet {
    margin-right: 0.5em;
    color:hsla(0, 0%, 0%, 0.5);
    font-size: 0.9em;
    vertical-align: text-bottom;
}

.line-items-header h2 {
    margin-bottom: 0;
}

.line-items.has-images .extras-seperator hr,
.line-items.has-images .extra-row .col-name > div {
    margin-left: 7.5em;
}

/* #endregion */


/* #region ==================== TOTALS */

#totals {
    display: flex;
    justify-content: flex-end;
}
#totals td:nth-child(1) {
    width: 10em;
    font-weight: 500;
}
#totals td:nth-child(2) {
    width: 12em;
    text-align: right;
}
#totals hr {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}
#totals table {
    margin-left: 1em;
}
#totals table + hr:not(:last-child) {
    margin-left: 1em;
}
#grand-total-table td {
    font-weight: bold !important;
}
#quote-discount-percent {
    margin-right: 0.2em;
    color: hsl(0deg 0% 60%);
}
#tax-rates-body {
    font-size: 0.9em;
    color: hsla(0, 0%, 0%, 0.5);
}

/* #endregion */


/* #region ==================== DESCRIPTION */

/* do we need these since we switched to markdown? */
/* section.description {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: auto;
}
section.description p {
    flex-grow: 1;
    overflow: auto;
} */

/* #endregion */


/* #region ==================== OTHER */

section.other td {
    vertical-align: top;
}

/* #endregion */


/* #region ==================== BANK ACCOUNTS */

section.bank-accounts .bank-accounts {
    display: flex;
    gap: 1em;
    font-size: 0.9em;
    flex-wrap: wrap;
}
section.bank-accounts .bank-accounts .bank-account {
    width: calc(50% - 1em/2);
}
section.bank-accounts .bank-accounts .bank-account td {
    vertical-align: top;
}
section.bank-accounts .bank-accounts .bank-account tr.iban {
    background-color: hsl(0deg 0% 0% / 5%);
}

/* #endregion */


/* #region ==================== DIMENSIONS */

section.dimensions table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9em;
}

section.dimensions table :is(td, th) {
    padding: 0.3em 0.5em;
    border: 1px solid hsl(0deg 0% 85%);
}

section.dimensions table thead {
    background-color: hsl(0deg 0% 95%);
    font-weight: 500;
}

section.dimensions .total-row {
    font-weight: 500;
}
section.dimensions .total-row td:first-child {
    border-left: 0;
    border-bottom: 0;
}
section.dimensions .total-row td:not(:first-child) {
    background-color: hsl(0deg 0% 98%);
}

section.dimensions table tbody :is(td, th):nth-child(2) {
    /* min-width: 12rem; */
    /* white-space: nowrap; */
    padding-right: 1em;
}

/* #endregion */


/* #region ==================== IMAGES */

section.images {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
/* section.images .overflow-container {
    flex-grow: 1;
    display: flex;
    align-items: flex-start;
    flex-basis: 0;
} */

:root {
    --img-grid-col: 2;
    --img-grid-gap: 0.4cm;
}

section.images .image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-columns: repeat(var(--img-grid-col), 1fr);
    gap: var(--img-grid-gap);
}

section.images .image-grid .grid-item {
    display: flex;
    flex-direction: column;
    gap: 0.1cm;
}
section.images .image-grid .grid-item .img-wrapper {
    background-color:hsl(0deg 0% 98%);
}
section.images .image-grid .grid-item img {
    width: 100%;
    aspect-ratio: 4  /3;
    object-fit: contain;
    display: block;
    background-color: hsl(0deg 0% 100%);
    /* box-shadow: 0 0 0 1px hsl(0deg 0% 0% / 5%); */
    outline: 1px solid hsl(0deg 0% 0% / 2%);
    outline-offset: -1px;
    cursor: pointer;
    mix-blend-mode: multiply;
}
section.images .image-grid .grid-item .info {
    text-align: center;
    font-weight: 600;
}

section.images table {
    font-size: 0.95em;
}

/* #endregion */


/* #region ==================== PHOTOSWIPE */

.pswp__caption {
    height: 10vh;
    min-height: 3rem;
    display: flex;
    align-items: center;
}
.pswp__caption__center {
    text-align: center;
    font-size: 1.2rem;
    max-width: none;
}

.pswp.qr-code .pswp__img:not(pswp__img--placeholder) {
    border: 2em solid white;
    border-radius: 1em;
}

@media (orientation: portrait) {
    .pswp__counter {
        font-size: calc(13px * 2);
        margin-left: 0.5em;
        margin-top: 0.8em;
    }
    .pswp__top-bar {
        height: calc(44px * 2);
    }
    .pswp__top-bar .pswp__button {
        scale: 2;
        margin-right: 22px;
        margin-top: 22px;
    }
    .pswp__caption__center {
        font-size: 1.8rem;
    }
}


/* #endregion */


/* #region ==================== EXPIRED */

.page-fade-out {
    height: calc(var(--page-a4-height) / 2) !important;
    overflow: visible;
}
.page-fade-out .watermark {
    opacity: 0.025;
    filter: blur(5px);
}
.page-fade-out .fade-out {
    position: absolute;
    height: 10vh;
    height: calc(var(--page-a4-height) / 4) !important;
    background-image: linear-gradient(to bottom, transparent, gainsboro);
    bottom: -5px;
    width: 110%;
    left: -10px;
    filter: blur(1px);
}

/* #endregion */


/* #region ==================== FOOTER */

footer {
    overflow: auto;
    padding-bottom: 1em;
    font-size: 0.9em;
    line-height: 1;
}
footer p {
    text-align: center;
    font-size: 0.7em;
    font-size: 0.8em;
}
footer p img {
    height: 1.5em;
    height: 2em;
    vertical-align: -0.3em;
    vertical-align: -0.57em;
}

/* #endregion */


table.left-header > :is(thead, tbody, tfoot) > tr > td:nth-child(1) {
    font-weight: 600 !important;
}

@media print {
    .controls {
        display: none;
    }
    section.description p {
        overflow: hidden;
    }
    footer {
        display: none;
    }
}
