/* =========================================================
   STPI UPI QR Payment Form - Custom Styling
   Author: A K
   Module: stpi_upi_qr
   Description: Responsive, modern layout for UPI payment form
========================================================= */

/* =========================================
   Overall Layout - Centered Two-Column Design
========================================= */
form#stpi-upi-qr-public-payment-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 2rem;
  margin: 2rem auto;
  max-width: 1000px;
  padding: 1rem;
  box-sizing: border-box;
}

/* =========================================
   Maintain Two-Column Layout Even When Empty
========================================= */
form#stpi-upi-qr-public-payment-form:has(#upi-qr-wrapper:empty) {
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
}

form#stpi-upi-qr-public-payment-form:has(#upi-qr-wrapper:empty) .payment-form-wrapper {
  flex: 0 0 48%;
  max-width: 480px;
}

/* =========================================
   Payment Form Wrapper (Left Section)
========================================= */
.payment-form-wrapper {
  background: #f9fafc;
  border: 1px solid #dcdcdc;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  flex: 0 0 48%;
  max-width: 480px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 482px;
}

.payment-form-wrapper .form-item {
  margin-bottom: 1rem;
}

.payment-form-wrapper label {
  font-weight: 600;
  color: #333;
  margin-bottom: 0.4rem;
  display: inline-block;
}

.payment-form-wrapper input.form-text,
.payment-form-wrapper select,
.payment-form-wrapper textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease-in-out;
  box-sizing: border-box;
}

.payment-form-wrapper input.form-text:focus,
.payment-form-wrapper select:focus,
.payment-form-wrapper textarea:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

/* =========================================
   Submit Button Styling
========================================= */
form#stpi-upi-qr-public-payment-form .form-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

form#stpi-upi-qr-public-payment-form .form-actions input[type="submit"] {
  background-color: #00bcd4;
  color: #fff;
  padding: 0.7rem 1.8rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

form#stpi-upi-qr-public-payment-form .form-actions input[type="submit"]:hover {
  background-color: #0097a7;
}

/* =========================================
   QR Code Wrapper (Right Section)
========================================= */
#upi-qr-wrapper {
  flex: 0 0 45%;
  max-width: 400px;
  text-align: center;
  background: #fff;
  padding: 2rem 1.5rem;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  min-height: 482px;
}

/* === Background Image Layer === */
#upi-qr-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../images/upi.jpg") center top / contain no-repeat;
  opacity: 1;
  z-index: 0;
  transition: opacity 0.3s ease-in-out;
}

/* === Placeholder Text When Empty === */
#upi-qr-wrapper:empty::after {
  content: "Your QR code will appear here.";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #666;
  font-weight: 500;
  z-index: 1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* === QR Image Layer === */
#upi-qr-wrapper img {
  position: relative;
  z-index: 2;
  width: 250px;
  height: auto;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #ddd;
  padding: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* === QR Details Text === */
#upi-qr-wrapper p {
  margin-top: 0.75rem;
  font-size: 1rem;
  color: #444;
  line-height: 1.4;
  position: relative;
  z-index: 3;
}

#upi-qr-wrapper p strong {
  color: #222;
}

/* =========================================
   Responsive Adjustments
========================================= */
@media (max-width: 1024px) {
  form#stpi-upi-qr-public-payment-form {
    max-width: 90%;
  }

  .payment-form-wrapper,
  #upi-qr-wrapper {
    flex: 0 0 48%;
  }
}

@media (max-width: 768px) {
  form#stpi-upi-qr-public-payment-form {
    flex-direction: column;
    align-items: center;
  }

  .payment-form-wrapper,
  #upi-qr-wrapper {
    width: 100%;
    max-width: 480px;
  }

  #upi-qr-wrapper {
    margin-top: 1.5rem;
  }

  form#stpi-upi-qr-public-payment-form .form-actions {
    justify-content: center;
  }

  #upi-qr-wrapper img {
    width: 180px;
  }
}

@media (max-width: 480px) {
  form#stpi-upi-qr-public-payment-form {
    padding: 0.5rem;
  }

  .payment-form-wrapper {
    padding: 1rem;
  }

  #upi-qr-wrapper {
    padding: 1rem;
  }

  #upi-qr-wrapper img {
    width: 160px;
  }
}

/* =========================================
   Validation Highlights
========================================= */
input.error,
select.error {
  border-color: #e53935 !important;
  background: #fff6f6;
}
