* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

button {
    cursor: pointer;
}

body {

    overflow: hidden;

    font-family: var(--default-font);
    font-size: 13px;
    line-height: 16px;
    font-weight: 400;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    color-scheme: var(--tg-theme-text-color);

    margin: 0;
    padding: 0;
    width: 1px;
    min-width: 100%;
  
    --default-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    --block-bg-color: var(--tg-theme-bg-color);
    --bg-color: #ebedf0;
    --animation: .15s ease;
    --page-animation-duration: .3s;
    --page-animation: var(--page-animation-duration) ease;
    --status-height: 48px;
    --accent-color: #31b545;
    --main-color: #f8a917;
    --text-color: #222;
    --page-hint-color: #83878a;
    --hint-color: #74787a;
    --placeholder-color: #999da1;
    --ripple-duration: .45s;
    --ripple-end-duration: .3s;
    -webkit-user-select: none;
    user-select: none;
    cursor: default;
}

.pages>div {
    overflow: overlay;
    height: 100vh;
    padding: 10px;
}
.pages>div:not(.open) {
    display: none !important;
}

.pages h1 {
    padding: 10px 0;
}

.pages .list {
    display: flex;
    flex-direction: column;
    row-gap: 10px;

    max-width: 100vw;
}

.list-items {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 10px;
    column-gap: 10px;

    max-width: 100%;
}

.list-items-columns1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}
.list-items-columns2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.list-items-columns3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.list-items-columns4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.list-items-columns5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.list-items-columns4 .list-item-buttons, .list-items-columns5 .list-item-buttons {
    display: none;
}

.list-items-columns4 .list-item, .list-items-columns5 .list-item {
    padding-bottom: .75rem;
}

.list-items-columns4 .list-item-label, .list-items-columns5 .list-item-label {
    justify-content: space-between;
}


.list-item {
    /* border: 1px dashed blue; */

    box-sizing: border-box;
    background: #AAAAAA0F;
    border-radius: 10px;

    position: relative;

    text-align: center;

    display: flex;
    flex-direction: column;
    row-gap: 5px;

    overflow: hidden;
}

.list-item-photo, .product-item-photo, .cart-item-photo {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.list-item-photo {
    border-top-left-radius: .5rem;
    border-top-right-radius: .5rem;
}

.list-item-counter {
    position: absolute;
    display: inline-block;
    top: 1px;
    right: 1px;

    background: #FF0404;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: inherit;

    line-height: 30px;

    font-weight: bold;

    z-index: 20;
}

.list-item[data-item-count="0"] .list-item-counter {
    display: none;
}

.list-item-label {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    gap: 12px;

    padding: .5rem;
    flex: 1;
}

.list-item-label > * {
    max-width: 100%;
}

.list-item-title {
    word-wrap: break-word;
    text-align: left;
    font-weight: bold;
}

.list-item-price {
    display: flex;
    column-gap: .2rem;
    flex-wrap: wrap;
    line-height: 13px;
}

.list-item-buttons {
    margin-top: auto;
    padding: .3rem .25rem;
}

.list-item button, .external-item-btn {
    display: block;
    height: 32px;
    width: 100%;
    border-radius: 10px;
    background-color: var(--tg-theme-bg-color);
    border: 1px solid #AAAAAA;
    color: var(--tg-theme-text-color);
    box-shadow: 0px 2px 8px 0px #FFFFFF14;
}

.external-item-btn {
    display: flex;

    justify-content: center;
    align-items: center;
}

.screen-reader-text {
    display: none;
}

/*Only for debug*/
.test-btns {
    position: fixed;
    bottom: 0px;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 40px;
}

#test-tg-back-btn {
    position: absolute;
    top: 0;
    height: 40px;
}

.test-btns button {
    height: 40px;
}


.cart-items {
    display: flex;
    flex-direction: column;
}

.cart-item {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    height: 112px;
    margin: 10px 0px;
    column-gap: 20px;
}

.cart-item-photo {
    min-width: 112px;
    border-radius: .5rem;
}
.cart-item-photo img {
    border-radius: 10px;
}

.cart-item-product {
    flex: 1;

    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .2rem 0;
}

.cart-item-title {
    font-weight: bold;
}

.cart-item-buttons {
    margin-top: auto;
}

.cart-item-buttons-wrapper{
    width: max-content;
    border: 1px solid #AAAAAA;
    border-radius: 10px;
    box-shadow: 0px 2px 8px 0px #FFFFFF14;
    overflow: hidden;
}
.cart-item-buttons button {
    width: 35px;
    height: 30px;

    background-color: transparent;
    color: var(--tg-theme-text-color);
    border: none;
}

.cart-item-count {
    display: inline-block;
    width: 30px;
    text-align: center;
    padding: 5px;
}

.cart-item-end-block {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-btn-clear-all {
    padding: 0.4rem 0.4rem;
    font-size: 0.8rem;
    border-radius: 10px;
    border: 1px solid;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    text-align: center;
}

.cart-btn-clear-all:active {
    background-color: var(--tg-theme-text-color);
    color: var(--tg-theme-bg-color);
}

.cart-btn-icon-trash {
    width: 2rem;
    height: 2rem;
    background-color: var(--tg-theme-bg-color);
    border: 1px solid;
    border-color: var(--tg-theme-text-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, fill 0.2s ease;
}

.cart-btn-icon-trash svg {
    width: 50%;
    height: 50%;
    fill: var(--tg-theme-text-color);
}

/* .autoComplete_wrapper {
    width: 100%;
}
.autoComplete_wrapper>input {
    width: 100%;
    border: .05rem solid #AAAAAA0F;
    border-radius: 10px;
}

.autoComplete_wrapper {
    color: var(--tg-theme-bg-color);
} */

#autoComplete {
    height: 40px;
    width: 100%;
    border-radius: 10px;
    border: none;
    padding: 10px;
}


.list-category {
    background: #AAAAAA0F;
    border-radius: 10px;
    padding: 10px;
    justify-content: space-between;
}

.list-category-label {
    display: block;
    font-weight: 700;
}


.category-items {
    display: flex;
    flex-direction: column;
    padding: 15px;
}
.category-items label {
    display: flex;
    justify-content: space-between;
    height: 40px;
    align-items: center;
}

.category-items input {
    height: 1.4em;
    width: 1.4em;
    vertical-align: middle;
}
.category-item-wrap {
    padding-left: 10px;
}
.category-item-wrap:first-child {
    padding-left: 0;
}

.product {
    padding: 0 !important;
}

.product-item {
    display: flex;
    flex-direction: column;
}

.product-item-photo {
    position: sticky;
    top: 0;
    left: 0;
}

.product-item-main::before {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    height: 1rem;

    border-top-left-radius: 1rem;
    border-top-right-radius: 1rem;

    background-color: var(--tg-theme-bg-color);

    content: '';
}

.product-item-main {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 16px;
    padding-top: 0;
    padding-bottom: 4rem;
    background-color: var(--tg-theme-bg-color);
}

.product-item-label {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;

    gap: 1rem;
}

.product-item-price {
    font-weight: bold;
}

.product-item-price-loading {
    width: 7rem;
    height: 1.5rem;
    background: var(--tg-theme-text-color);

    border-radius: .5rem;

    animation: loading-fade 700ms infinite linear;
}

/*.product-item-wrapper {*/
/*    background: #AAAAAA0F;*/
/*    border-radius: 10px;*/
/*    position: relative;*/
/*    text-align: center;*/
/*}*/

.product-item-title {
    font-size: 1.25rem;
    font-weight: bold;
    word-wrap: break-word;
}

.variations-wrapper {
    display: flex;
    flex-direction: column;
    gap: .5rem;

    margin-top: .5rem;
}

.variations {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.variation-placeholder {
    color: gray;
}

.product-item-variations {
    width: 100%;
    padding: 1rem .5rem;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    /*border: none;*/
    /*border-bottom: solid 1px;*/
    /*border-bottom-color: #4D4D4D;*/

    font-size: 1rem;
    font-weight: normal;

    border: 1px solid gray;
    border-radius: .25rem;

    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 1rem auto;
}

.product-item-descriptions {
    flex-grow: 1;
}

.product-item-buttons {
    position: relative;
    display: flex;
    gap: 2rem;
    padding: 10px;
    background-color: var(--tg-theme-secondary-bg-color);
    border-radius: 10px;
    justify-content: space-between;
    align-items: center;
    color: var(--tg-theme-text-color);

    margin-top: 3rem;
}

.product-item-number {
    outline:none;
    background-color: var(--tg-theme-secondary-bg-color);
    text-align: center;
    color: var(--tg-theme-text-color);

    font-size: 1rem;
    border: 1px solid gray;
    border-radius: 8px;
    padding: .2rem .25rem;

    width: calc(3rem + 1rem);

    height: 100%;
}

.product-item-quantity {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;

    height: 100%;
}

.btn-product {
    text-align: center;
    outline:none;
    border-radius: 8px;
    background-color: var(--tg-theme-bg-color);
    color: var(--tg-theme-text-color);
    font-size: 1.3rem;
    padding-right: 1rem;
    padding-left: 1rem;
    border: 1px solid;
    border-color: var(--tg-theme-text-color);
}

.btn-product:active {
    background-color: var(--tg-theme-text-color);
    color: var(--tg-theme-bg-color);
}

.product-item-success, .product-item-notice {
    opacity: 0%;

    position: absolute;
    bottom: 100%;
    width: 100%;
    left: 0;

    margin-bottom: .5rem;
    padding: 10px;

    border: solid 2px #32cd32;
    border-radius: 10px;

    text-align: center;
    color: white;

    transition-duration: var(--page-animation-duration);
}

.product-item-success {
    background-color: rgba(50, 205, 50, 0.80);
    z-index: 10;
}

.product-item-notice {
    border-color: red;
    background-color: rgba(255, 0, 0, 0.80);
}

.checkout {
    display: flex;
    flex-direction: column;
    row-gap: 10px;
}

.checkout > h1,.checkout > h3 {
    margin-top: 1rem;
    margin-bottom: .25rem;
}

.checkout button {
    height: 40px;
}

.payment-btns {
    position: fixed;
    bottom: 0px;
    display: flex;
    flex-direction: column;
    width: 100%;
    left: 0;
    bottom: 0;
    row-gap: 5px;
}

.payment-btns button {
    height: 50px;
    background-color: var(--tg-theme-button-color);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

.thankyou .order-details {
    margin: 10px;
}

.thankyou h2, .thankyou table {
    margin: 10px 0;
}

.js-pr-item-incr-btn {
    height: 32px;
    padding: 0 .75rem;
    border-radius: 10px;
    border: 1px solid;
}

.btn-item-product-active {
    border-color: var(--tg-theme-text-color);
    color: var(--tg-theme-text-color);
    background-color: var(--tg-theme-bg-color);
}

.btn-item-product-inactive {
    background-color: var(--tg-theme-secondary-bg-color);
    border-color: var(--tg-theme-text-color);
    color: var(--tg-theme-bg-color);
}

.js-pr-item-incr-btn.btn-item-product-active:active  {
    background-color: var(--tg-theme-text-color);
    color: var(--tg-theme-bg-color);
}

.done-elem, .loading-elem {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: .4rem;
}

.done-elem > svg, .loading-elem > svg{
    height: 100%;
    width: auto;
    aspect-ratio: 1/1;
    fill: var(--tg-theme-text-color);
}

.loading-elem {
    animation: rotating 1s infinite linear;
}

.empty-cart {
    font-size: 2rem;
    text-align: center;
    margin-top: 1rem;
}

.product-item-number::-webkit-outer-spin-button,
.product-item-number::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.customer-details {
    display: flex;
    flex-direction: column;
    row-gap: 10px;
}

.customer-details input, .customer-details select, .shipping-option {
    height: 35px;
    border-radius: 10px;
    background-color: var(--tg-theme-bg-color);
    border: 1px solid #AAAAAA;
    color: var(--tg-theme-text-color);
    padding: 0 10px;
    margin: 0;
}

.shipping-option {
    display: flex;
    gap: .5rem;
    align-items: center;
}

.shipping-option > label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.customer-details select {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, gray 50%), linear-gradient(135deg, gray 50%, transparent 50%), linear-gradient(to right, #ccc, #ccc);
    background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 15px) calc(1em + 2px), calc(100% - 2.5em) 0.5em;
    background-size: 5px 5px, 5px 5px, 1px 1.5em;
    background-repeat: no-repeat

}


.customer-details input.checked:invalid,
.customer-details input.invalid {
    border: 1px solid red;
}

.shipping-details {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.total-details {
    display: flex;
    flex-direction: column;

    gap: 1rem;

    padding-top: 1rem;
    padding-bottom: 3rem;

    font-size: .9rem;
}

.total-details > hr {
    border: none;
    border-top: 1px solid var(--tg-theme-text-color);
    opacity: 30%;
}

.total-details > div {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 1rem;
}

.total-details > div > h4, .total-details > div > p {
    font-weight: normal;
    font-size: 1.2em;
}

.total-details > div > h4 > span {
    font-size: .7em;
}

.total-details > div > p {
    font-weight: 700;
}

.total-details-total {
    margin-top: 1rem;
}

.total-details-total > h3, .total-details-total > p {
    font-size: 1.25rem;
}

@keyframes loading-fade {
    0%   { opacity: 10%; }
    70% { opacity: 80%; }
    100%   { opacity: 10%; }
}

@keyframes rotating {
    0%   { transform: rotate(0deg); }
    100%   { transform: rotate(360deg); }
}