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

.@{sale-detail-prefix}-invoice-main {
  padding: 8px 10px;
}

.@{sale-detail-prefix}-cart-scroll-panel {
  position: relative;
  overflow: auto;
  scrollbar-width: none;

  &::-webkit-scrollbar {
    display: none;
  }
}

.@{sale-detail-prefix}-scroll-content {
  display: flex;
  flex-direction: column;
  gap: 8px;

  .pisell-sale-detail-cart-items {
    flex: unset;
  }
}

.@{invoice-prefix} {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;

  &__section,
  &__summary-detail {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
  }

  &__section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
  }

  &__section-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    color: #d9e2ff;
    font-size: 16px;
    font-weight: 800;
    line-height: 22px;

    .pisell-iconfont {
      flex: none;
      color: #aebbe0;
      font-size: 16px;
    }
  }

  &__edit-button {
    flex: none;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(154, 164, 195, 0.62);
    border-radius: 9px;
    color: #eef4ff;
    background: rgba(7, 16, 31, 0.88);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;

    &:disabled {
      color: rgba(238, 244, 255, 0.45);
      border-color: rgba(154, 169, 208, 0.32);
      cursor: not-allowed;
    }
  }

  &__appointment-card,
  &__open-items-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
    padding: 8px;
    border: 1px solid rgba(92, 108, 148, 0.72);
    border-radius: 12px;
    color: #eef4ff;
    background: #07101f;
  }

  &__appointment-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #f5f8ff;
    font-size: 14px;
    font-weight: 900;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__appointment-meta {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 6px 8px;
    min-width: 0;
  }

  &__appointment-meta-label,
  &__appointment-meta-value {
    min-width: 0;
    font-size: 13px;
    font-weight: 800;
    line-height: 18px;
  }

  &__appointment-meta-label {
    color: #aebbe0;
  }

  &__appointment-meta-value {
    overflow-wrap: anywhere;
    color: #eef4ff;
  }

  &__line-list {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  &__line-row,
  &__subtotal-row {
    display: grid;
    grid-template-columns:
      minmax(0, 1.55fr)
      minmax(74px, 0.65fr)
      minmax(80px, 0.68fr)
      minmax(84px, 0.75fr);
    min-width: 0;
  }

  &__line-row {
    border-top: 1px solid rgba(92, 108, 148, 0.42);

    &--head {
      border-top: 0;
      border-bottom: 1px solid rgba(92, 108, 148, 0.72);
    }

    &--head + .@{invoice-prefix}__line-row {
      border-top: 0;
    }

    &--option,
    &--bundle,
    &--bundle-option,
    &--variant,
    &--note {
      .@{invoice-prefix}__line-name {
        color: #aebbe0;
        font-weight: 800;
      }
    }

    &--option,
    &--bundle,
    &--bundle-option,
    &--add-time {
      .@{invoice-prefix}__line-name {
        padding-left: 20px;
      }
    }

    &--add-time {
      .@{invoice-prefix}__line-name {
        color: #c4b5fd;
      }
    }
  }

  &__line-head-cell,
  &__line-cell {
    min-width: 0;
    padding: 8px;
  }

  &__line-head-cell {
    color: #aebbe0;
    font-size: 13px;
    font-weight: 900;
    line-height: 18px;
  }

  &__line-cell {
    display: flex;
    align-items: center;
    color: #eef4ff;
    font-size: 13px;
    font-weight: 800;
    line-height: 18px;
  }

  &__line-cell--amount,
  &__line-cell--quantity {
    justify-content: flex-start;
    text-align: left;
    white-space: nowrap;
  }

  &__line-cell--total {
    color: #f5f8ff;
    font-weight: 900;
  }

  &__line-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &__mobile-label {
    display: none;
    color: #aebbe0;
    font-size: 12px;
    font-weight: 900;
    line-height: 16px;
  }

  &__subtotal-row {
    align-items: center;
    padding: 0;
    border-top: 1px solid rgba(92, 108, 148, 0.72);
  }

  &__subtotal-label {
    grid-column: 3;
    min-width: 0;
    padding: 8px;
    color: #aebbe0;
    font-size: 13px;
    font-weight: 900;
    line-height: 18px;
    text-align: right;
  }

  &__subtotal-value {
    grid-column: 4;
    min-width: 0;
    padding: 8px;
    color: #f5f8ff;
    font-size: 13px;
    font-weight: 900;
    line-height: 18px;
    text-align: left;
  }

  &__empty {
    min-width: 0;
    padding: 14px 12px;
    border: 1px dashed rgba(92, 108, 148, 0.72);
    border-radius: 8px;
    color: #aebbe0;
    background: #07101f;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
  }

  &__summary-card {
    min-width: 0;
    border: 1px solid rgba(92, 108, 148, 0.72);
    border-radius: 8px;
    background: #07101f;

    .pisell-sale-summary-detail {
      background: transparent;
    }
  }
}

.@{sale-detail-prefix}--phone {
  .@{invoice-prefix} {
    &__appointment-card,
    &__open-items-card {
      padding: 8px;
      border-radius: 10px;
    }

    &__appointment-meta {
      grid-template-columns: minmax(90px, 0.34fr) minmax(0, 1fr);
    }

    &__line-row {
      display: flex;
      flex-direction: column;
      gap: 6px;
      padding: 8px;

      &--head {
        display: none;
      }
    }

    &__line-cell {
      display: grid;
      grid-template-columns: minmax(84px, 0.34fr) minmax(0, 1fr);
      gap: 8px;
      padding: 0;
      text-align: left;
      white-space: normal;
    }

    &__line-cell--amount,
    &__line-cell--quantity {
      justify-content: stretch;
      text-align: left;
    }

    &__line-name {
      overflow: visible;
      text-overflow: clip;
      white-space: normal;
    }

    &__mobile-label {
      display: block;
    }

    &__subtotal-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      padding: 8px;
    }

    &__subtotal-label,
    &__subtotal-value {
      grid-column: auto;
      padding: 0;
    }
  }
}
