/* =========================================
   DONATION CHECKOUT COMPONENT
   ========================================= */

/* Container */
.growfund-donation-checkout {
  max-width: 800px;
  margin: var(--growfund-spacing-16) auto;
  padding: 20px;
  background-color: var(--growfund-gray-4);
  border-radius: var(--growfund-radius-16);
}

/* Header Section */
.growfund-donation-checkout__header {
  background: var(--growfund-white);
  border-radius: var(--growfund-radius-4);
  padding: 24px 0 0;
  margin-bottom: 24px;
  box-shadow: var(--growfund-shadow-sm);
}

.growfund-donation-checkout__campaign-info {
  display: flex;
  align-items: center;
  gap: var(--growfund-spacing-6);
  margin-bottom: 24px;
}

.growfund-donation-checkout__campaign-image {
  width: 156px;
  border-radius: var(--growfund-radius-3);
  object-fit: cover;
}

.growfund-donation-checkout__campaign-text p {
  font-size: var(--growfund-font-size-4);
  color: var(--growfund-gray-13);
  line-height: 150%;
}

.growfund-donation-checkout__campaign-title {
  font-size: var(--growfund-font-size-6);
  font-weight: var(--growfund-font-weight-semibold);
  color: var(--growfund-gray-15);
  line-height: 1.3;
}

/* Donation Amount Section */
.growfund-donation-checkout__donation-section {
  margin-bottom: 24px;
}

.growfund-donation-checkout__section-title {
  font-size: var(--growfund-font-size-5);
  font-weight: var(--growfund-font-weight-semibold);
  color: var(--growfund-gray-15);
  margin-bottom: 16px;
}

.growfund-donation-checkout__amount-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.growfund-donation-checkout__amount-btn {
  padding: 12px 16px;
  border: 2px solid var(--growfund-gray-8);
  border-radius: var(--growfund-radius-3);
  background: var(--growfund-white);
  color: var(--growfund-gray-15);
  font-size: var(--growfund-font-size-3);
  font-weight: var(--growfund-font-weight-medium);
  cursor: pointer;
  transition: all 0.2s ease;
}

.growfund-donation-checkout .growfund-library-support-label {
  font-size: var(--growfund-font-size-5);
  line-height: 122%;
  font-weight: var(--growfund-font-weight-semibold);
  color: var(--growfund-gray-15);
  padding-bottom: var(--growfund-spacing-4);
}

.growfund-donation-checkout .growfund-form-section > .growfund-contact-info-title {
  font-size: var(--growfund-font-size-6);
  font-weight: var(--growfund-font-weight-medium);
  line-height: 122%;
  color: var(--growfund-gray-15);
  margin-bottom: var(--growfund-spacing-3);
}

.growfund-donation-checkout__amount-btn:hover {
  border-color: var(--growfund-gray-10);
  background: var(--growfund-gray-1);
}

.growfund-donation-checkout__amount-btn--active {
  border-color: var(--growfund-blue-6);
  background: var(--growfund-blue-1);
  color: var(--growfund-blue-7);
}

.growfund-donation-checkout__custom-amount {
  margin-bottom: 16px;
}

.growfund-donation-checkout__custom-amount input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--growfund-gray-8);
  border-radius: var(--growfund-radius-3);
  font-size: var(--growfund-font-size-3);
  transition: border-color 0.2s ease;
  height: 40px;
  max-height: 40px;
  box-sizing: border-box;
}

.growfund-donation-checkout__custom-amount input:focus {
  outline: none;
  border-color: var(--growfund-blue-6);
}

.growfund-donation-checkout__amount-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--growfund-gray-1);
  border-radius: var(--growfund-radius-3);
  font-size: var(--growfund-font-size-3);
  font-weight: var(--growfund-font-weight-semibold);
}

.growfund-tribute-group .growfund-form-title {
  font-size: var(--growfund-font-size-5);
  font-weight: var(--growfund-font-weight-semibold);
  line-height: 122%;
  color: var(--growfund-gray-15);
  margin-bottom: var(--growfund-spacing-4);
}

/* New amount input styling to match the image */
.growfund-donation-checkout__amount-input {
  margin-bottom: 16px;
  position: relative;
  cursor: pointer;
}

.growfund-donation-checkout__amount-input-content {
  width: 100%;
  padding: var(--growfund-spacing-5);
  border: 1px solid var(--growfund-gray-8);
  border-radius: var(--growfund-radius-3);
  background: var(--growfund-gray-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.growfund-donation-checkout__amount-input-content:hover {
  border-color: var(--growfund-gray-10);
}

.growfund-donation-checkout__amount-input-content:focus-within {
  border-color: var(--growfund-blue-6);
  box-shadow: 0 0 0 3px rgba(112, 135, 172, 0.1);
}

.growfund-donation-checkout__amount-label {
  font-size: var(--growfund-font-size-3);
  color: var(--growfund-gray-10);
  font-weight: var(--growfund-font-weight-normal);
}

.growfund-donation-checkout__amount-value {
  font-size: var(--growfund-font-size-4);
  font-weight: var(--growfund-font-weight-semibold);
  color: var(--growfund-gray-15);
}

.growfund-donation-checkout__amount-input input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--growfund-gray-8);
  border-radius: var(--growfund-radius-3);
  font-size: var(--growfund-font-size-4);
  font-weight: var(--growfund-font-weight-medium);
  background: var(--growfund-white);
  color: var(--growfund-gray-15);
  transition: all 0.2s ease;
  box-sizing: border-box;
  height: 40px;
  max-height: 40px;
}

.growfund-donation-checkout__amount-input input:focus {
  outline: none;
  border-color: var(--growfund-blue-6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.growfund-donation-checkout__amount-input input::placeholder {
  color: var(--growfund-gray-10);
  font-weight: var(--growfund-font-weight-normal);
}

/* Separator line between amount section and form fields */
.growfund-donation-checkout__separator {
  border: none;
  height: 1px;
  background-color: var(--growfund-gray-8);
  width: 100%;
}

/* Summary Section */
.growfund-donation-checkout__summary {
  margin: 24px 0;
}

.growfund-donation-summary__title {
  font-size: var(--growfund-font-size-3);
  font-weight: var(--growfund-font-weight-semibold);
  color: var(--growfund-gray-15);
  margin-bottom: var(--growfund-spacing-5);
}

.growfund-donation-summary__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--growfund-spacing-5) 0;
  font-size: var(--growfund-font-size-3);
}

.growfund-donation-summary__donation {
  font-size: var(--growfund-font-size-4);
  font-weight: var(--growfund-font-weight-normal);
  color: var(--growfund-text-accent-foreground);
  line-height: 122%;
}

.growfund-donation-summary__total {
  font-size: var(--growfund-font-size-6);
  font-weight: var(--growfund-font-weight-normal);
  color: var(--growfund-gray-15);
  line-height: 122%;
}

.growfund-donation-summary__separator {
  background-color: var(--growfund-border-primary);
  border: none;
  height: 1px;
}

.growfund-donation-checkout__summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--growfund-font-size-3);
}

.growfund-donation-checkout__summary-row--total {
  border-top: 1px solid var(--growfund-gray-8);
  margin-top: 8px;
  padding-top: 16px;
  font-weight: var(--growfund-font-weight-semibold);
  font-size: var(--growfund-font-size-4);
}

/* Legal Text */
.growfund-donation-checkout__legal-text {
  font-size: var(--growfund-font-size-2);
  color: var(--growfund-gray-12);
  line-height: 1.5;
  margin-top: 16px;
}

.growfund-donation-checkout__legal-text a {
  color: var(--growfund-blue-6);
  text-decoration: underline;
}

.growfund-donation-checkout__legal-text a:hover {
  text-decoration: underline;
}

/* Form Builder Customizations */
.growfund-donation-checkout .growfund-form-builder {
  background: var(--growfund-white);
  border-radius: var(--growfund-radius-4);
  box-shadow: var(--growfund-shadow-sm);
  margin-top: var(--growfund-spacing-8);
}

/* .growfund-donation-checkout .growfund-form-section {
}

.growfund-donation-checkout .growfund-form-section:last-child {
  margin-bottom: 0;
} */

/* Dedicate checkbox wrapper styling */
.growfund-dedicate-checkbox-wrapper {
  background: var(--growfund-gray-1);
  padding: var(--growfund-spacing-5);
  border-radius: var(--growfund-radius-3);
  border: 1px solid var(--growfund-border-primary);
  position: relative;
}

/* Tribute content animation - let JavaScript handle height calculations */
/* Remove duplicate tribute content styles - they're handled in form-builder.css */

/* Responsive Design */
@media (max-width: 768px) {
  .growfund-donation-checkout {
    padding: 16px;
  }

  .growfund-donation-checkout__campaign-info {
    flex-direction: column;
    text-align: center;
  }

  .growfund-donation-checkout__amount-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .growfund-donation-checkout .form-row {
    grid-template-columns: 1fr;
  }
}

/* Tribute Notification Fields */
.growfund-notification-field {
  transition: all 0.3s ease;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  width: 100%; /* Ensure full width */
  box-sizing: border-box; /* Include padding in width calculation */
}

.growfund-notification-field.growfund-ecard-fields,
.growfund-notification-field.growfund-postmail-fields {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
}

.growfund-notification-field.growfund-ecard-fields.show,
.growfund-notification-field.growfund-postmail-fields.show {
  opacity: 1;
  max-height: 1000px;
  overflow: visible;
}

.growfund-field-hidden {
  display: none !important;
}

/* Ensure proper spacing when notification fields are shown */
.growfund-notification-field.show {
  margin-top: var(--growfund-spacing-4);
  margin-bottom: var(--growfund-spacing-4);
}

/* Add proper spacing between notification field rows */
.growfund-notification-field .growfund-form-row-half {
  margin-bottom: var(--growfund-spacing-4);
}

.growfund-notification-field .growfund-form-row-half:last-child {
  margin-bottom: 0;
}

/* Ensure form fields within notification fields have proper spacing */
.growfund-notification-field .growfund-form-field {
  margin-bottom: var(--growfund-spacing-3);
}

.growfund-notification-field .growfund-form-field:last-child {
  margin-bottom: 0;
}

/* Ensure notification fields participate in form builder grid spacing */
.growfund-notification-field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px; /* Match form-builder section gap */
}

/* Ensure notification field rows have proper spacing */
.growfund-notification-field > .growfund-form-row-half {
  margin-bottom: 12px; /* Match the gap */
}

.growfund-notification-field > .growfund-form-row-half:last-child {
  margin-bottom: 0;
}

/* Fix vertical alignment in two-column layout */
.growfund-notification-field .growfund-form-row-half {
  align-items: start; /* Align items to the top */
}

.growfund-notification-field .growfund-form-row-half .growfund-form-field {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: flex-start;
}

/* Ensure labels are aligned */
.growfund-notification-field .growfund-form-row-half .growfund-form-label {
  height: auto;
  line-height: 1.2;
  margin-bottom: var(--growfund-spacing-1-5);
}

/* Ensure inputs are aligned */
.growfund-notification-field .growfund-form-row-half input,
.growfund-notification-field .growfund-form-row-half textarea {
  height: 40px;
  max-height: 40px;
  min-height: 40px; /* Consistent input height */
  box-sizing: border-box;
}

/* Ensure form elements don't overflow their containers */
.growfund-form-builder {
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.growfund-form-section {
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Ensure textarea and inputs don't overflow */
.growfund-textarea {
  max-width: 100%;
  box-sizing: border-box;
  resize: vertical; /* Only allow vertical resizing for textarea */
}

/* Ensure inputs maintain consistent height */
.growfund-input {
  max-width: 100%;
  box-sizing: border-box;
  height: 40px;
  max-height: 40px;
}

/* Ensure textarea is properly contained within form sections */
.growfund-form-section .growfund-textarea {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Ensure notification fields don't cause overflow */
.growfund-notification-field {
  max-width: 100%;
  overflow-x: hidden;
}

/* Ensure the personalized message textarea is properly sized */
.growfund-form-section .growfund-textarea[name='tribute_message'] {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Fix for wrapper extension content cutoff */
.growfund-dedicate-checkbox-wrapper {
  /* Ensure content is always visible when expanded */
  min-height: auto;
  height: auto;
}

/* Ensure tribute content is fully visible */
.growfund-tribute-content {
  /* Override any conflicting height restrictions */
  min-height: auto !important;
  height: auto !important;
  overflow: visible !important;
}

/* When tribute is hidden, use proper animation */
.growfund-tribute-content.growfund-tribute-hidden {
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0;
  transition: height 0.3s ease, opacity 0.3s ease;
}

/* Ensure form fields within tribute content are always visible */
.growfund-tribute-content .growfund-form-field {
  opacity: 1;
  visibility: visible;
  height: auto;
  overflow: visible;
}

/* Fix for notification fields visibility */
.growfund-notification-field.show {
  opacity: 1 !important;
  max-height: none !important;
  overflow: visible !important;
  visibility: visible !important;
}

/* Additional fixes for wrapper extension content cutoff */
.growfund-dedicate-checkbox-wrapper {
  /* Ensure content is always visible when expanded */
  min-height: auto;
  height: auto;
  /* Prevent any content from being hidden */
  overflow: visible;
}

/* Ensure all form fields within the wrapper are visible */
.growfund-dedicate-checkbox-wrapper .growfund-form-field {
  opacity: 1;
  visibility: visible;
  height: auto;
  overflow: visible;
}

/* Override any hidden states from parent containers */
.growfund-dedicate-checkbox-wrapper .growfund-form-field,
.growfund-dedicate-checkbox-wrapper .growfund-form-field.growfund-tribute-hidden,
.growfund-dedicate-checkbox-wrapper .growfund-form-field.growfund-field-hidden {
  opacity: 1;
  visibility: visible;
  height: auto;
  overflow: visible;
}

/* Fix for notification field containers */
.growfund-notification-field {
  /* Ensure proper width and prevent overflow */
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Ensure form rows within notification fields are properly sized */
.growfund-notification-field .growfund-form-row-half {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Fix for textarea overflow issues */
.growfund-notification-field textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  resize: vertical;
  overflow-x: hidden;
}

.growfund-dedicate-checkbox-wrapper .growfund-form-section:last-child {
  margin-bottom: 0;
}

/* Fix for tribute content visibility */
.growfund-tribute-content:not(.growfund-tribute-hidden) {
  /* Ensure content is fully visible when not hidden */
  margin-top: var(--growfund-spacing-6) !important;
  opacity: 1 !important;
  visibility: visible !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}

/* Ensure smooth transitions without content cutoff */
.growfund-tribute-content {
  transition: height 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.growfund-page-container .growfund-form-label p {
  margin-block-end: 0;
}
