@sale-detail-prefix: pisell-sale-detail;
@invoice-prefix: pisell-sale-detail-invoice;

.@{sale-detail-prefix}-invoice-main {
  min-height: 0;
  padding: 0;
  background: #171a21;

  .@{sale-detail-prefix}-cart-scroll-panel {
    position: relative;
    height: 100%;
    overflow: auto;
    scrollbar-width: thin;
  }
}

.@{invoice-prefix} {
  &__receipt-stage {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    box-sizing: border-box;
    min-height: 100%;
    padding: 18px 12px 32px;
  }

  &__receipt-paper {
    box-sizing: border-box;
    width: min(360px, 100%);
    min-width: 0;
    padding: 17px 16px 22px;
    color: #101010;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
    overflow-wrap: anywhere;
    zoom: 1.5;
  }

  &__receipt-paper--skeleton {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 500px;
    overflow: hidden;
  }

  &__receipt-skeleton-block {
    display: block;
    height: 11px;
    border-radius: 4px;
    background: linear-gradient(90deg, #edf1f5 25%, #f8fafc 37%, #edf1f5 63%);
    background-size: 400% 100%;
    animation: pisell-sale-detail-invoice-skeleton-loading 1.4s ease infinite;
  }

  &__receipt-skeleton-reference {
    width: 34%;
    margin: 2px auto 0;
  }

  &__receipt-skeleton-title {
    width: 46%;
    height: 26px;
    margin: -4px auto 4px;
  }

  &__receipt-skeleton-separator {
    width: 100%;
    height: 3px;
    border-radius: 0;
  }

  &__receipt-skeleton-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 6px 0;

    > :first-child {
      width: 86px;
      height: 58px;
    }

    > :nth-child(2) {
      width: 48%;
      height: 16px;
    }

    > :last-child {
      width: 72%;
    }
  }

  &__receipt-skeleton-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  &__receipt-skeleton-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 12px;

    > :last-child {
      width: 100%;
    }

    &:nth-child(3n) > :first-child {
      width: 72%;
    }
  }

  &__receipt-reference {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
    text-align: center;
    text-transform: uppercase;

    span {
      font-size: 13px;
    }

    strong {
      font-size: 26px;
      font-weight: 900;
      line-height: 1.05;
    }
  }

  &__receipt-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    text-align: center;

    img {
      display: block;
      max-width: 170px;
      max-height: 70px;
      margin: 2px auto 4px;
      object-fit: contain;
    }

    h2 {
      margin: 0;
      font-size: 17px;
      font-weight: 900;
      line-height: 1.2;
    }
  }

  &__receipt-bill-title {
    margin-top: 5px;
    font-size: 14px;
    font-weight: 900;
  }

  &__receipt-separator {
    width: 100%;
    margin: 8px 0 6px;
    overflow: hidden;
    color: #202020;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: 700;
    line-height: 10px;
    letter-spacing: -0.2px;
    white-space: nowrap;
  }

  &__receipt-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  &__receipt-row,
  &__receipt-product-main,
  &__receipt-product-detail,
  &__receipt-savings {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;

    > :first-child {
      min-width: 0;
    }

    > :last-child {
      flex: none;
      max-width: 56%;
      text-align: right;
    }
  }

  &__receipt-row--strong {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.15;

    > :first-child {
      font-weight: 900;
    }
  }

  &__receipt-order-note {
    margin-top: 3px;
    font-size: 13px;
    font-weight: 900;
    text-align: left;
  }

  &__receipt-payment-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-align: center;

    strong {
      font-size: 18px;
      line-height: 1.2;
    }
  }

  &__receipt-payment-notice-title {
    font-size: 15px;
    text-transform: uppercase;
  }

  &__receipt-payment-notice-summary {
    font-size: 14px;
    line-height: 1.3;
  }

  &__receipt-row--single {
    display: block;

    > :first-child,
    > :last-child {
      display: block;
      max-width: none;
      text-align: inherit;
    }
  }

  &__receipt-row--align-left {
    text-align: left;
  }

  &__receipt-row--align-center {
    text-align: center;
  }

  &__receipt-row--align-right {
    text-align: right;
  }

  &__receipt-section-title {
    text-align: left;
    margin: 5px 0 3px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.3;
    text-transform: uppercase;
  }

  &__receipt-line-group {
    margin-top: 7px;

    h4 {
      margin: 0 0 3px;
      font-size: 12px;
      font-weight: 900;
      line-height: 1.3;
    }
  }

  &__receipt-product {
    margin-top: 7px;
  }

  &__receipt-product-main {
    font-weight: 900;
  }

  &__receipt-product-detail {
    padding: 0 12px;
    color: #2d2d2d;
  }

  &__receipt-product-note {
    font-weight: 400;
  }

  &__receipt-records {
    display: flex;
    flex-direction: column;
    gap: 9px;
  }

  &__receipt-record {
    &:not(:first-child) {
      padding-top: 6px;
      border-top: 1px dashed #777;
    }

    .@{invoice-prefix}__receipt-row:first-child {
      font-weight: 900;
    }
  }

  &__receipt-savings {
    align-items: baseline;
    font-size: 18px;
    font-weight: 900;
  }

  &__receipt-savings-description {
    margin: 4px 12px 0;
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
  }

  &__receipt-custom {
    text-align: center;
    white-space: pre-line;

    img {
      display: block;
      max-width: 100%;
      max-height: 190px;
      margin: 5px auto 0;
      object-fit: contain;
    }
  }

  &__receipt-barcode {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    .pisell-lowcode-qrcode-wrap {
      display: inline-flex;
      cursor: default;
    }

    > span:last-child {
      margin-top: 2px;
      font-size: 10px;
    }
  }

  &__preview-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 360px;
    margin: auto;
    padding: 20px;
    color: #d9e2ff;
    text-align: center;

    button {
      min-height: 34px;
      padding: 0 14px;
      border: 1px solid rgba(154, 164, 195, 0.62);
      border-radius: 8px;
      color: #eef4ff;
      background: #07101f;
      cursor: pointer;
    }
  }
}

@keyframes pisell-sale-detail-invoice-skeleton-loading {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

.@{sale-detail-prefix}--phone {
  .@{invoice-prefix}__receipt-stage {
    padding: 8px 6px 24px;
  }

  .@{invoice-prefix}__receipt-paper {
    width: 100%;
    padding-right: 13px;
    padding-left: 13px;
  }
}

@media print {
  .@{sale-detail-prefix}-invoice-main,
  .@{invoice-prefix}__receipt-stage {
    padding: 0;
    background: #fff;
  }

  .@{invoice-prefix}__receipt-paper {
    width: 80mm;
    max-width: 80mm;
    box-shadow: none;
    zoom: 1;
  }
}
