/* Pre-loader held from card submit until the destination page renders.
   Paired with assets/js/payment_overlay.js — see that file for why it exists.
   Must be imported by every entrypoint a cart opens from: app.js AND
   drivingschool_cms.js (the public storefront). */

.payment-processing-overlay {
    position: fixed;
    inset: 0;
    /* Above Bootstrap's modal (1055) and its backdrop. */
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(14, 22, 40, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: ppo-fade-in 0.2s ease-out;
}

/* Default placement: inside the checkout modal, so the student stays on the
   screen they paid on. Covers the whole card including its close button. */
.modal-content.ppo-host {
    position: relative;
}

.payment-processing-overlay.ppo-in-modal {
    position: absolute;
    z-index: 50;
    align-items: flex-start;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

/* Long checkout modals scroll inside .modal — keep the loader in view. */
.payment-processing-overlay.ppo-in-modal .ppo-card {
    position: sticky;
    top: max(1.5rem, 22vh);
    margin-top: max(1.5rem, 12vh);
}

@keyframes ppo-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.payment-processing-overlay .ppo-card {
    width: 100%;
    max-width: 24rem;
    padding: 2rem 1.75rem 1.5rem;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 1.25rem 2.5rem rgba(14, 22, 40, 0.25);
    text-align: center;
}

.payment-processing-overlay .ppo-spinner {
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    border: 0.3rem solid #e3f1ea;
    border-top-color: #198754;
    animation: ppo-spin 0.8s linear infinite;
}

@keyframes ppo-spin {
    to { transform: rotate(360deg); }
}

.payment-processing-overlay .ppo-title {
    margin: 0 0 0.35rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

.payment-processing-overlay .ppo-detail {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

.payment-processing-overlay .ppo-warning {
    margin: 1.1rem 0 0;
    font-size: 0.75rem;
    color: #868e96;
}

/* Nothing behind the cover should scroll while it is up. */
body.payment-processing-active {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .payment-processing-overlay { animation: none; }
    .payment-processing-overlay .ppo-spinner { animation-duration: 2s; }
}
