/**
 * Giving Matrix WooCommerce Fallback Styles
 * Additional styles for the giving matrix when iDonate is disabled
 */

/* Giving Matrix Wrapper */
.giving-matrix-wrapper {
    padding: 2rem 0;
    margin-bottom: 2rem;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

/* All Buttons Container */
#allDaButtons {
    text-align: center;
    margin-bottom: 2rem;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

#allDaButtons .previewHeader {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.giving-matrix-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    max-width: 850px;
    margin: 0 auto 1rem;
}

/* Button Styling - extends existing primaryButton styles */
.oneTimeFormButtons {
    min-width: auto;
    width: 100%;
    padding: 1.25rem 2rem;
    cursor: pointer;
    text-decoration: none;
    display: block;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background-color: #1d869a;
    color: #fff;
    border-radius: 10px;
    border: none;
    box-shadow: 0 10px 26px rgba(22, 66, 91, 0.25);
}

.oneTimeFormButtons:hover,
.oneTimeFormButtons:focus {
    background-color: #16657a;
    color: #fff;
}

.oneTimeFormButtons.give-form-button-active {
    background-color: #0f3952 !important;
    color: #fff !important;
    box-shadow: 0 14px 30px rgba(15, 57, 82, 0.45);
    transform: translateY(-1px);
}

.oneTimeFormButtons.give-form-button-inactive {
    background-color: #1d869a !important;
    color: #fff !important;
    box-shadow: 0 10px 26px rgba(22, 66, 91, 0.25);
}

/* Custom Amount Input (styled like a button) */
.custom-amount-input-wrapper {
    position: relative;
    width: 100%;
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    white-space: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.3;
}

.custom-amount-input-wrapper.oneTimeFormButtons {
    cursor: text;
    color: #17415b;
    background-color: #ffffff !important;
    border: 2px solid #17415b;
    box-shadow: 0 8px 20px rgba(23, 65, 91, 0.15);
    transition: color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.custom-amount-input-wrapper .custom-amount-prefix {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    pointer-events: none;
    margin-right: 0.25rem;
    display: inline-block;
    white-space: nowrap;
}

.custom-amount-input-wrapper.oneTimeFormButtons:focus-within {
    box-shadow: 0 0 0 3px rgba(23, 65, 91, 0.18);
    border-color: #17415b;
}

.custom-amount-input-wrapper.oneTimeFormButtons.give-form-button-active,
.custom-amount-input-wrapper.oneTimeFormButtons.give-form-button-inactive {
    background-color: #ffffff !important;
    color: #17415b !important;
    box-shadow: 0 8px 20px rgba(23, 65, 91, 0.15);
    transform: translateY(0);
}

.custom-amount-input-wrapper.custom-has-value {
    color: #17415b !important;
}

.custom-amount-input-wrapper .donationFormAmountValue {
    font-size: 1.8rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
    text-align: center !important;
    font-family: "Gotham A", "Gotham B", sans-serif !important;
    border: none !important;
    background: transparent !important;
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
    display: inline-block !important;
    vertical-align: middle !important;
    min-width: 4ch;
    width: auto;
    white-space: nowrap !important;
    margin: 0 auto;
}

.custom-amount-input-wrapper:not(.custom-has-value) .donationFormAmountValue {
    color: #b5abc2 !important;
    -webkit-text-fill-color: #b5abc2 !important;
}

.custom-amount-input-wrapper.custom-has-value .donationFormAmountValue {
    color: #17415b !important;
    -webkit-text-fill-color: #17415b !important;
}

/* Hide any dollar sign elements */
.custom-amount-input-wrapper .dollar-sign,
.custom-amount-input-wrapper::before,
.custom-amount-input-wrapper::after {
    display: none !important;
    content: none !important;
}

#donationFormAmountValue {
    width: min-content;
    min-width: 0;
    padding: 0;
    font-size: inherit;
    font-weight: inherit;
    text-align: center;
    border: none;
    border-radius: 0;
    background: transparent;
    color: inherit;
    -webkit-text-fill-color: currentColor;
    height: auto;
    text-transform: none;
    letter-spacing: 0.08em;
    caret-color: #17415b;
}

#donationFormAmountValue:focus {
    outline: none;
}

#donationFormAmountValue::placeholder {
    color: #b5abc2;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 1.8rem;
    font-family: "Gotham A", "Gotham B", sans-serif;
    opacity: 1;
}

#donationFormAmountValue:placeholder-shown {
    color: #b5abc2;
    -webkit-text-fill-color: #b5abc2;
}

/* Ensure no pseudo-elements on the input */
#donationFormAmountValue::before,
#donationFormAmountValue::after {
    display: none !important;
    content: none !important;
}

/* Hide number input spinners */
#donationFormAmountValue::-webkit-outer-spin-button,
#donationFormAmountValue::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#donationFormAmountValue[type=number] {
    -moz-appearance: textfield;
}

/* Error Messages */
.amount-error-message {
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    text-align: center;
    display: none !important; /* Hidden by default, shown via JS when validation fails */
}

#minimumAmountMessage,
#invalidAmountMessage {
    display: none !important; /* Ensure error messages are hidden on load */
}

/* Hide WooCommerce Order Review Elements */
.fallback-checkout .woocommerce-checkout-review-order-table,
.fallback-checkout #order_review_heading {
    display: none !important;
}

/* Hide duplicate payment section in order review */
.fallback-checkout #order_review .woocommerce-checkout-payment {
    display: none !important;
}

/* Checkout notices: show under the submit button as a full-width row */
.fallback-checkout .place-order .woocommerce-NoticeGroup-checkout,
.fallback-checkout .place-order .woocommerce-error,
.fallback-checkout .place-order .woocommerce-message,
.fallback-checkout .place-order .woocommerce-info {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0 0 0;
    display: block;
}

.fallback-checkout .woocommerce-error {
    list-style: none;
    padding-left: 1.5rem;
}

/* Keep the giving matrix visible above checkout */
#wooCheckoutFormWrapper {
    margin-top: 3rem;
    padding-top: 2rem;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

#wooCheckoutFormWrapper .checkout-heading {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    text-align: center;
}

.fallback-checkout form.checkout.woocommerce-checkout {
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
}

.fallback-checkout #customer_details {
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
}

.fallback-checkout #payment {
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
}

/* Ensure payment internals span full width */
.fallback-checkout #payment ul.payment_methods,
.fallback-checkout #payment div.payment_box {
    max-width: 850px;
    width: 100%;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
}

.fallback-checkout #payment .form-row {
    width: 100%;
}

.fallback-checkout #payment input.input-text,
.fallback-checkout #payment select,
.fallback-checkout #payment textarea {
    width: 100%;
}

/* Tighten inner columns/padding to match outer width */
.fallback-checkout #customer_details .col-1,
.fallback-checkout #customer_details .col-2 {
    width: 100%;
    max-width: 850px;
    padding-left: 0;
    padding-right: 0;
    margin: 0 auto;
}

.fallback-checkout .billingDetailsContainer,
.fallback-checkout .additionalDetailsContainer {
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0;
}

.fallback-checkout #customer_details .col-1 .woocommerce-billing-fields,
.fallback-checkout #customer_details .col-1 .woocommerce-shipping-fields {
    max-width: 850px;
    margin: 0 auto;
}

.fallback-checkout form.checkout .form-row {
    width: 100%;
    max-width: 850px;
    margin-left: auto;
    margin-right: auto;
}

.fallback-checkout form.checkout input.input-text,
.fallback-checkout form.checkout select,
.fallback-checkout form.checkout textarea {
    width: 100%;
    max-width: 850px;
}

/* Responsive Design */
@media (max-width: 900px) {
    .giving-matrix-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 540px) {
    .giving-matrix-grid {
        grid-template-columns: 1fr;
    }

    .oneTimeFormButtons {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .fallback-checkout form.checkout.woocommerce-checkout {
        max-width: 100%;
    }

    .fallback-checkout #customer_details {
        max-width: 100%;
    }

    .fallback-checkout #payment {
        max-width: 100%;
    }

    .fallback-checkout #customer_details .col-1,
    .fallback-checkout #customer_details .col-2 {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    .fallback-checkout #payment ul.payment_methods,
    .fallback-checkout #payment div.payment_box {
        max-width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
}
