/* Donation popup: compact, desktop fits without scroll; mobile-friendly */
html.donation-popup-open,
body.donation-popup-open {
    overflow: hidden;
    height: 100%;
}

.donation-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: 100vh;
    max-height: 100vh;
    min-height: 100dvh;
    max-height: 100dvh;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    box-sizing: border-box;
    overflow: hidden;
    overscroll-behavior: none;
    animation: donationPopupFadeIn 0.25s ease;
}

@keyframes donationPopupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.donation-popup-container {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    max-height: min(88vh, 100vh - 1.5rem);
    max-height: min(88dvh, 100dvh - 1.5rem);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    animation: donationPopupSlide 0.25s ease;
}

@keyframes donationPopupSlide {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.donation-popup-container .donation-form {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0 1.1rem 1.1rem;
    margin: 0;
}

.donation-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    padding: 0.9rem 1.1rem 0.75rem;
    border-bottom: 1px solid #eee;
}

.donation-popup-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1f26;
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.donation-popup-close {
    background: #f3f4f6;
    border: none;
    font-size: 1.1rem;
    color: #5c6370;
    cursor: pointer;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    border-radius: 50%;
    flex-shrink: 0;
}

.donation-popup-close:hover {
    color: #1a1f26;
    background: #e8eaed;
}

.donation-popup-close:focus-visible {
    outline: 2px solid #ff431e;
    outline-offset: 2px;
}

/* Tight vertical stack (replaces large .form-section gaps) */
.donation-form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.donation-popup-container .form-group--tight {
    margin-bottom: 0;
}

.donation-popup-container .form-group--consent {
    margin-top: 0.1rem;
}

.donation-popup-container .form-group--inline-custom {
    margin-top: 0.15rem;
}

.donation-popup-container .form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #2d333b;
    margin-bottom: 0.35rem;
    letter-spacing: 0.01em;
}

.required-asterisk {
    color: #c0392b;
    margin-left: 2px;
    font-weight: 700;
}

.donation-popup-container .form-control {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid #d8dce0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1a1f26;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
    line-height: 1.4;
}

.donation-popup-container .form-control:hover {
    border-color: #c0c4cc;
}

.donation-popup-container .form-control:focus {
    outline: none;
    border-color: #ff431e;
    box-shadow: 0 0 0 3px rgba(255, 67, 30, 0.12);
}

.donation-popup-container .form-row--tight {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem 0.65rem;
    align-items: flex-end;
}

.donation-popup-container .form-group-half {
    flex: 1 1 160px;
    min-width: 0;
}

/* Amount: compact horizontal radios */
.donation-amount-radios {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.55rem;
    margin-top: 0.2rem;
}

.donation-amount-radios .radio-option {
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
}

.donation-amount-radios .radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.donation-amount-radios .radio-option label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.25rem;
    padding: 0.4rem 0.75rem;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #2d333b;
    border: 1.5px solid #dde1e6;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    user-select: none;
}

.donation-amount-radios .radio-option label:hover {
    border-color: #ff431e;
    color: #ff431e;
    background: #fff8f6;
}

.donation-amount-radios .radio-option input[type="radio"]:focus-visible + label {
    outline: 2px solid #ff431e;
    outline-offset: 2px;
}

.donation-amount-radios .radio-option input[type="radio"]:checked + label {
    border-color: #ff431e;
    color: #ff431e;
    background: #fff5f2;
    box-shadow: 0 0 0 1px rgba(255, 67, 30, 0.25);
}

#custom_amount_group {
    animation: donationCustomReveal 0.2s ease;
}

@keyframes donationCustomReveal {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Payment: two equal cells, side by side, minimal gap */
.donation-payment-block {
    padding-top: 0.1rem;
}

.donation-payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin-top: 0.2rem;
}

.donation-payment-methods .payment-method-item {
    min-width: 0;
    display: flex;
    margin: 0;
    padding: 0;
    position: relative;
}

.donation-payment-methods .payment-method-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.donation-payment-methods .payment-method-item label {
    flex: 1;
    text-align: center;
    display: block;
    padding: 0.45rem 0.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #2d333b;
    border: 1.5px solid #dde1e6;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    margin: 0;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    user-select: none;
    line-height: 1.3;
}

.donation-payment-methods .payment-method-item label:hover {
    border-color: #ff431e;
    color: #c43210;
    background: #fff8f6;
}

.donation-payment-methods .payment-method-item input[type="radio"]:focus-visible + label {
    outline: 2px solid #ff431e;
    outline-offset: 1px;
}

.donation-payment-methods .payment-method-item input[type="radio"]:checked + label {
    border-color: #ff431e;
    color: #b82e0f;
    background: #fff5f2;
    box-shadow: inset 0 0 0 1px rgba(255, 67, 30, 0.2);
}

/* Consent: lighter row */
.donation-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.2rem;
    padding: 0.55rem 0.6rem;
    background: #f6f7f9;
    border: 1px solid #e8ebef;
    border-radius: 8px;
    line-height: 1.45;
}

.donation-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 0.1rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #ff431e;
}

.donation-checkbox label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 400;
    color: #3a424d;
    cursor: pointer;
    user-select: none;
}

.donation-form .form-actions {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid #eee;
    text-align: center;
}

.donation-form .btn-donate {
    background: #ff431e;
    color: #fff;
    border: none;
    padding: 0.7rem 1.5rem;
    font-size: 0.98rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
    width: 100%;
    max-width: 100%;
    box-shadow: 0 3px 10px rgba(255, 67, 30, 0.28);
}

.donation-form .btn-donate:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 67, 30, 0.32);
}

.donation-form .btn-donate:active {
    transform: translateY(0);
}

.donation-form .btn-donate:disabled {
    background: #adb5bd;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.donation-form .alert {
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    margin-bottom: 0.7rem;
    font-size: 0.85rem;
    border: none;
}

.donation-form .alert-success { background: #d4edda; color: #155724; }
.donation-form .alert-danger { background: #f8d7da; color: #721c24; }

.donation-popup-container .donation-form::-webkit-scrollbar {
    width: 6px;
}

.donation-popup-container .donation-form::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.donation-popup-container .donation-form::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 6px;
}

/* Mobile: stack email/phone, allow payment to stay 2-col on wide phones or stack on tiny */
@media (max-width: 520px) {
    .donation-popup-container {
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        max-height: min(92dvh, 100dvh - env(safe-area-inset-top));
    }

    .donation-popup-container .form-row--tight {
        flex-direction: column;
        gap: 0.4rem;
    }

    .donation-popup-container .form-group-half {
        flex: 1 1 auto;
        width: 100%;
    }

    .donation-amount-radios {
        justify-content: flex-start;
    }
}

@media (max-width: 360px) {
    .donation-payment-methods {
        grid-template-columns: 1fr;
    }
}
