/* 
|--------------------------------------------------------------------------
| Gurukul Payment Module - Frontend 
|--------------------------------------------------------------------------
*/

.gpm-public-wrapper {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
}

.gpm-public-form {
    width: 100%;
    box-sizing: border-box;
}

.gpm-public-form *,
.gpm-public-form *::before,
.gpm-public-form *::after {
    box-sizing: border-box;
}

/*
|--------------------------------------------------------------------------
| Form Description
|--------------------------------------------------------------------------
*/

.gpm-form-description {
    margin-bottom: 30px;
    font-size: 15px;
    line-height: 1.7;
    color: #555;
}

/*
|--------------------------------------------------------------------------
| Fields
|--------------------------------------------------------------------------
*/

.gpm-fields {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.gpm-field {
    width: 100%;
}

/*
|--------------------------------------------------------------------------
| Labels
|--------------------------------------------------------------------------
*/

.gpm-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #222;
}

.gpm-required {
    color: #d63638;
    margin-left: 3px;
}

/*
|--------------------------------------------------------------------------
| Inputs
|--------------------------------------------------------------------------
*/

.gpm-input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;

    border: 1px solid #d7d7d7;
    border-radius: 6px;

    background: #fff;
    color: #222;

    font-size: 15px;
    line-height: 1.4;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

textarea.gpm-input {
    min-height: 120px;
    resize: vertical;
}

.gpm-input:focus {
    border-color: #777;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.gpm-input.gpm-input-error {
    border-color: #d63638;
}

/*
|--------------------------------------------------------------------------
| Help Text
|--------------------------------------------------------------------------
*/

.gpm-field-help {
    margin-top: 6px;

    font-size: 13px;
    line-height: 1.5;

    color: #777;
}

/*
|--------------------------------------------------------------------------
| Field Errors
|--------------------------------------------------------------------------
*/

.gpm-field-error {
    display: none;

    margin-top: 6px;

    font-size: 13px;
    line-height: 1.4;

    color: #d63638;
}

.gpm-field.has-error .gpm-field-error {
    display: block;
}

/*
|--------------------------------------------------------------------------
| Radio / Checkbox Options
|--------------------------------------------------------------------------
*/

.gpm-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gpm-option {
    display: flex;
    align-items: center;

    gap: 9px;

    cursor: pointer;

    font-size: 15px;
    line-height: 1.4;

    color: #333;
}

.gpm-option input {
    width: 17px;
    height: 17px;

    margin: 0;

    flex: 0 0 auto;
}

.gpm-single-checkbox {
    align-items: flex-start;
}

.gpm-single-checkbox input {
    margin-top: 2px;
}

/*
|--------------------------------------------------------------------------
| Payment Summary
|--------------------------------------------------------------------------
*/

.gpm-payment-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-top: 30px;
    padding: 18px 20px;

    border: 1px solid #e3e3e3;
    border-radius: 8px;

    background: #fafafa;
}

.gpm-payment-summary-label {
    font-size: 15px;
    font-weight: 600;

    color: #333;
}

.gpm-payment-summary-amount {
    font-size: 18px;
    font-weight: 700;

    color: #111;
}

/*
|--------------------------------------------------------------------------
| Submit Button
|--------------------------------------------------------------------------
*/

.gpm-form-submit {
    margin-top: 28px;
}

.gpm-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 48px;

    padding: 12px 28px;

    border: 0;
    border-radius: 6px;

    background: #111;
    color: #fff;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;

    cursor: pointer;

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.gpm-submit-button:hover {
    opacity: 0.9;
}

.gpm-submit-button:active {
    transform: translateY(1px);
}

.gpm-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/*
|--------------------------------------------------------------------------
| Form Messages
|--------------------------------------------------------------------------
*/

.gpm-form-message {
    display: none;

    margin-top: 20px;
    padding: 12px 15px;

    border-radius: 6px;

    font-size: 14px;
    line-height: 1.5;
}

.gpm-form-message.gpm-message-error {
    display: block;

    border: 1px solid #f0b5b5;

    background: #fff5f5;
    color: #a61b1b;
}

.gpm-form-message.gpm-message-success {
    display: block;

    border: 1px solid #b7dfc0;

    background: #f3fff5;
    color: #176b2c;
}

/*
|--------------------------------------------------------------------------
| Public Error Message
|--------------------------------------------------------------------------
*/

.gpm-public-message {
    width: 100%;

    padding: 15px 18px;

    border-radius: 6px;

    font-size: 14px;
}

.gpm-public-error {
    border: 1px solid #f0b5b5;

    background: #fff5f5;
    color: #a61b1b;
}

/*
|--------------------------------------------------------------------------
| Stripe Payment Modal
|--------------------------------------------------------------------------
*/

#gpm-payment-modal {
    position: fixed;
    inset: 0;

    z-index: 999999;

    display: none;

    width: 100%;
    height: 100%;

    overflow: auto;

    padding: 12px;
}

#gpm-payment-modal.is-open {
    display: flex;

    align-items: center;
    justify-content: center;
}

/*
|--------------------------------------------------------------------------
| Modal Overlay
|--------------------------------------------------------------------------
*/

.gpm-payment-modal-overlay {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;

    background: rgba(0, 0, 0, 0.60);

    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/*
|--------------------------------------------------------------------------
| Modal Dialog
|--------------------------------------------------------------------------
*/

.gpm-payment-modal-dialog {
    position: relative;

    z-index: 2;

    width: 100%;
    max-width: 430px;

    max-height: calc(100vh - 24px);

    margin: 0 auto;

    background: #fff;

    border-radius: 10px;

    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.25);

    overflow: hidden;

    display: flex;
    flex-direction: column;
}

/*
|--------------------------------------------------------------------------
| Remove Custom Modal Header
|--------------------------------------------------------------------------
|
| The HTML header remains so the existing JS does not need to change.
| Its title/description are hidden and the close button remains visible.
|--------------------------------------------------------------------------
*/

.gpm-payment-modal-header {
    position: relative;

    width: 100%;
    height: 0;
    min-height: 0;

    padding: 0;

    border: 0;

    background: transparent;
}

/*
|--------------------------------------------------------------------------
| Hide Custom Header Content
|--------------------------------------------------------------------------
*/

.gpm-payment-modal-header > div {
    display: none;
}

/*
|--------------------------------------------------------------------------
| Close Button
|--------------------------------------------------------------------------
*/

.gpm-payment-modal-close {
    position: absolute;

    top: 8px;
    right: 8px;

    z-index: 20;

    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.95);

    color: #555;

    font-size: 19px;
    font-weight: 400;

    line-height: 1;

    cursor: pointer;

    box-shadow:
        0 1px 5px rgba(0, 0, 0, 0.12);

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.gpm-payment-modal-close:hover {
    background: #f2f2f2;
    color: #111;
}

.gpm-payment-modal-close:focus {
    outline: 2px solid #777;
    outline-offset: 2px;
}

/*
|--------------------------------------------------------------------------
| Stripe Checkout Container
|--------------------------------------------------------------------------
*/

.gpm-checkout-container {
    width: 100%;

    min-height: 0;

    padding: 4px 8px 8px;

    background: #fff;

    overflow-y: auto;

    scrollbar-width: thin;
}

.gpm-checkout-container iframe {
    display: block;

    width: 100% !important;
    max-width: 100% !important;

    border: 0;
}

/*
|--------------------------------------------------------------------------
| Payment Loading
|--------------------------------------------------------------------------
*/

.gpm-payment-loading {
    display: flex;

    align-items: center;
    justify-content: center;

    flex-direction: column;

    min-height: 180px;

    padding: 20px;

    text-align: center;

    color: #555;

    font-size: 13px;
}

.gpm-payment-spinner {
    width: 30px;
    height: 30px;

    margin-bottom: 12px;

    border: 3px solid #e5e5e5;

    border-top-color: #111;

    border-radius: 50%;

    animation:
        gpm-payment-spin 0.8s linear infinite;
}

@keyframes gpm-payment-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/*
|--------------------------------------------------------------------------
| Payment Message
|--------------------------------------------------------------------------
*/

.gpm-payment-message {
    margin: 6px 8px;

    padding: 9px 11px;

    border-radius: 6px;

    font-size: 13px;
    line-height: 1.4;
}

.gpm-payment-message:empty {
    display: none;
}

.gpm-payment-message.gpm-payment-error {
    border: 1px solid #f0b5b5;

    background: #fff5f5;

    color: #a61b1b;
}

.gpm-payment-message.gpm-payment-success {
    border: 1px solid #b7dfc0;

    background: #f3fff5;

    color: #176b2c;
}

/*
|--------------------------------------------------------------------------
| Prevent Background Scroll
|--------------------------------------------------------------------------
*/

body.gpm-payment-modal-open {
    overflow: hidden;
}

/*
|--------------------------------------------------------------------------
| Stripe Embedded Checkout
|--------------------------------------------------------------------------
*/

.gpm-checkout-container .__PrivateStripeElement,
.gpm-checkout-container .StripeElement {
    width: 100%;
}

/*
|--------------------------------------------------------------------------
| Desktop - Short Screen
|--------------------------------------------------------------------------
|
| This is useful for laptops where the browser height is limited.
|--------------------------------------------------------------------------
*/

@media (max-height: 750px) and (min-width: 768px) {

    #gpm-payment-modal {
        padding: 8px;
    }

    .gpm-payment-modal-dialog {
        max-height: calc(100vh - 16px);

        max-width: 420px;

        border-radius: 8px;
    }

    .gpm-checkout-container {
        padding: 2px 6px 6px;
    }

    .gpm-payment-modal-close {
        top: 6px;
        right: 6px;

        width: 26px;
        height: 26px;

        font-size: 18px;
    }
}

/*
|--------------------------------------------------------------------------
| Tablet
|--------------------------------------------------------------------------
*/

@media (max-width: 767px) {

    .gpm-fields {
        gap: 18px;
    }

    .gpm-payment-summary {
        align-items: flex-start;

        flex-direction: column;

        gap: 8px;
    }

    .gpm-submit-button {
        width: 100%;
    }

    /*
    |----------------------------------------------------------------------
    | Payment Modal
    |----------------------------------------------------------------------
    */

    #gpm-payment-modal {
        padding: 8px;
    }

    .gpm-payment-modal-dialog {
        width: 100%;

        max-width: 430px;

        max-height: calc(100vh - 16px);

        border-radius: 9px;
    }

    .gpm-checkout-container {
        padding: 3px 6px 6px;
    }

    .gpm-payment-message {
        margin: 5px 6px;
    }

    .gpm-payment-modal-close {
        top: 6px;
        right: 6px;

        width: 27px;
        height: 27px;

        font-size: 18px;
    }
}

/*
|--------------------------------------------------------------------------
| Mobile
|--------------------------------------------------------------------------
*/

@media (max-width: 480px) {

    #gpm-payment-modal {
        padding: 5px;
    }

    .gpm-payment-modal-dialog {
        width: 100%;

        max-width: none;

        max-height: calc(100vh - 10px);

        margin: 0;

        border-radius: 8px;
    }

    .gpm-checkout-container {
        padding: 2px 4px 4px;
    }

    .gpm-payment-message {
        margin: 4px;
        padding: 8px 10px;
    }

    .gpm-payment-modal-close {
        top: 5px;
        right: 5px;

        width: 26px;
        height: 26px;

        font-size: 18px;
    }

    .gpm-payment-loading {
        min-height: 150px;

        padding: 15px;
    }
}

/*
|--------------------------------------------------------------------------
| Very Short Mobile Screens
|--------------------------------------------------------------------------
*/

@media (max-width: 480px) and (max-height: 700px) {

    #gpm-payment-modal {
        padding: 3px;
    }

    .gpm-payment-modal-dialog {
        max-height: calc(100vh - 6px);
    }

    .gpm-checkout-container {
        padding: 0 3px 3px;
    }

    .gpm-payment-modal-close {
        top: 4px;
        right: 4px;

        width: 24px;
        height: 24px;

        font-size: 17px;
    }
}

.gpm-payment-breakdown { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e5e7eb; }
.gpm-breakdown-row { display:flex; justify-content:space-between; gap:20px; margin-top:6px; font-size:.95rem; }
.gpm-calculation-field { display:flex; justify-content:space-between; gap:20px; padding:10px 0; font-weight:500; }
