/* Override the main-content max-width for the invoice detail page */
.main-content:has(.invoice-detail-page) {
  max-width: 1200px;
}

.invoice-detail-page {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  width: 100%;

  @media only screen and (width >= 900px) {
    grid-template-columns: 1fr 1fr;
  }

  & h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
  }

  & h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
  }

  & section {
    margin-bottom: 1.5rem;
  }
}

.invoice-detail-page > section {
  & .invoice-summary {
    background: var(--custom-text-background-color, #fff);
    border: 1px solid var(--custom-text-background-color-hover, #e1e1e1);
    border-radius: 0.25rem;
    padding: 1rem;
  }

  & .invoice-details {
    display: grid;
    gap: 0.25rem 1rem;
    grid-template-columns: auto 1fr;

    & dt {
      color: #666;
      font-size: 0.875rem;
    }

    & dd {
      font-size: 0.875rem;
      font-weight: 500;
      text-align: right;
    }
  }

  & .invoice-download-link {
    display: block;
    margin-top: 1rem;
    text-align: center;
  }

  & .invoice-payment-form {
    background: var(--custom-text-background-color, #fff);
    border: 1px solid var(--custom-text-background-color-hover, #e1e1e1);
    border-radius: 0.25rem;
    padding: 1rem;

    & .payment-element {
      min-height: 200px;
    }

    & .button-group {
      margin-top: 1rem;
    }

    & .btn[disabled] {
      cursor: default;
      opacity: 0.4;
    }
  }

  & .invoice-bank-transfer {
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 0.25rem;
    padding: 1rem;

    & p {
      color: #666;
      font-size: 0.875rem;
      margin-bottom: 1rem;
    }

    & .bank-transfer-details {
      background: #fff;
      border: 1px solid #e1e1e1;
      border-radius: 0.25rem;
      display: grid;
      gap: 0.25rem 1rem;
      grid-template-columns: auto 1fr;
      padding: 0.75rem 1rem;

      & dt {
        color: #666;
        font-size: 0.875rem;
      }

      & dd {
        font-size: 0.875rem;
        font-weight: 500;
        text-align: right;
      }
    }

    & .bank-transfer-addresses {
      background: #fff;
      border: 1px solid #e1e1e1;
      border-radius: 0.25rem;
      display: grid;
      gap: 0.25rem 1rem;
      grid-template-columns: 1fr;
      padding: 0.75rem 1rem;

      & dt {
        color: #666;
        font-size: 0.75rem;
        margin-top: 0.5rem;

        &:first-child {
          margin-top: 0;
        }
      }

      & dd {
        font-size: 0.75rem;
      }
    }

    & details {
      margin-top: 1rem;

      & summary {
        color: #666;
        cursor: pointer;
        font-size: 0.75rem;
      }
    }

    & .bank-transfer-note {
      color: #999;
      font-size: 0.75rem;
      font-style: italic;
      margin-top: 1rem;
      margin-bottom: 0;
    }
  }

  & .invoice-paid {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 0.25rem;
    color: #155724;
    padding: 1rem;
    text-align: center;

    & p {
      margin: 0;
    }
  }
}

.invoice-detail-page > aside {
  display: none;

  @media only screen and (width >= 900px) {
    display: block;
  }

  & .invoice-preview-frame {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 0.25rem;
    height: 100%;
    min-height: 600px;
    width: 100%;
  }
}
