:root {
  --wpi-primary-color: #3f51b5; /* A deep blue for primary actions and headings */
  --wpi-secondary-color: #f5f5f5; /* A light grey for backgrounds */
  --wpi-text-color-dark: #333; /* Dark grey for main text */
  --wpi-text-color-light: #fff; /* White for text on dark backgrounds */
  --wpi-border-color: #e0e0e0; /* A light border color */
  --wpi-success-color: #4caf50; /* Green for success */
  --wpi-pending-color: #ff9800; /* Amber for pending */
  --wpi-failed-color: #f44336; /* Red for failure */
  --wpi-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --wpi-border-radius: 8px;
}

/* Container for the entire invoice and payment form */
.wpi-invoice-container,
.wpi-payment-form-container {
  font-family: var(--font-family), 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--wpi-secondary-color);
  color: var(--wpi-text-color-dark);
  padding: 1.5rem;
  padding-top: 0.5rem;
  /* max-width: 900px; */
  max-width: 100%;
  margin: 3rem auto;
  border-radius: var(--wpi-border-radius);
  box-shadow: var(--wpi-shadow);
  direction: rtl;
  text-align: right;
  line-height: 1.8;
}

/* Invoice and Form Header */
.wpi-invoice-container h2,
.wpi-payment-form-container h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--wpi-primary-color);
  border-bottom: 3px solid var(--wpi-primary-color);
  padding-bottom: 1.2rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* Form Styles */
.wpi-payment-form-container form p {
    /* margin-bottom: 1.5rem; */
}

.wpi-payment-form-container label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
    color: var(--wpi-text-color-dark);
}

.wpi-payment-form-container input[type="text"],
.wpi-payment-form-container input[type="number"],
.wpi-payment-form-container textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--wpi-border-color);
    border-radius: var(--wpi-border-radius);
    box-sizing: border-box; /* Ensures padding doesn't affect the width */
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.wpi-payment-form-container input:focus,
.wpi-payment-form-container textarea:focus {
    outline: none;
    border-color: var(--wpi-primary-color);
    box-shadow: 0 0 0 2px rgba(63, 81, 181, 0.2);
}

.wpi-payment-form-container textarea {
    min-height: 120px;
    resize: vertical;
}


/* Invoice Details (Customer info) */
.wpi-invoice-details {
  background-color: #ffffff;
  padding: 2rem;
  border-radius: var(--wpi-border-radius);
  margin-bottom: 2rem;
  border: 1px solid var(--wpi-border-color);
}

.wpi-invoice-details p {
  margin: 0.8rem 0;
}

.wpi-invoice-details strong {
  color: #555;
  font-weight: 600;
}

/* Table for Invoice Items */
.wpi-invoice-items {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2rem;
  background-color: #ffffff;
  border-radius: var(--wpi-border-radius);
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wpi-invoice-items th,
.wpi-invoice-items td {
  padding: 1.2rem;
  text-align: right;
  border-bottom: 1px solid var(--wpi-border-color);
}

.wpi-invoice-items th {
  background-color: var(--wpi-primary-color);
  color: var(--wpi-text-color-light);
  font-weight: 600;
}

.wpi-invoice-items tbody tr:nth-child(even) {
  background-color: #fafafa;
}

/* Total Amount Section */
.wpi-invoice-total {
  background-color: #e8f5e9;
  border: 1px solid var(--wpi-success-color);
  padding: 2rem;
  border-radius: var(--wpi-border-radius);
  text-align: center;
  margin-top: 2rem;
}

.wpi-invoice-total strong {
  font-size: 1.8rem;
  color: var(--wpi-text-color-dark);
  display: block;
}

.wpi-invoice-total span {
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--wpi-success-color);
}

/* Payment Button */
.wpi-pay-button {
  display: block;
  width: 100%;
  padding: 1rem;
  background-color: var(--wpi-primary-color);
  color: var(--wpi-text-color-light);
  border: none;
  border-radius: var(--wpi-border-radius);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  font-family: var(--font-family), 'Vazirmatn', sans-serif;
  font-weight: bold;
}

.wpi-pay-button:hover {
  background-color: #303f9f;
  transform: translateY(-2px);
}

/* Status Badges */
.wpi-status-pending {
  background-color: var(--wpi-pending-color);
  color: var(--wpi-text-color-light);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: bold;
}

.wpi-status-paid {
  background-color: var(--wpi-success-color);
  color: var(--wpi-text-color-light);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: bold;
}

.wpi-status-failed {
  background-color: var(--wpi-failed-color);
  color: var(--wpi-text-color-light);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: bold;
}

/* Payment Success & Error Messages */
.wpi-payment-success,
.wpi-payment-error {
  background-color: #e8f5e9;
  border: 1px solid var(--wpi-success-color);
  padding: 1.5rem;
  border-radius: var(--wpi-border-radius);
  text-align: center;
  margin-top: 2rem;
}

.wpi-payment-error {
    background-color: #ffebee;
    border-color: var(--wpi-failed-color);
    color: var(--wpi-failed-color);
}

.wpi-payment-success p,
.wpi-payment-error p {
    margin: 0.5rem 0;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
  .wpi-invoice-container,
  .wpi-payment-form-container {
    padding: 1.5rem;
    margin: 1rem;
  }
  .wpi-invoice-container h2,
  .wpi-payment-form-container h2 {
    font-size: 2rem;
  }
  .wpi-invoice-details, .wpi-invoice-items, .wpi-invoice-total {
    padding: 1rem;
  }
  .wpi-invoice-total strong {
    font-size: 1.6rem;
  }
  .wpi-pay-button {
    font-size: 1.1rem;
  }
  .wpi-payment-form-container input,
  .wpi-payment-form-container textarea {
      font-size: 0.9rem;
  }
}