/* ── Widget (donate button on page) ──────────────────────────────────── */
.sd-widget {
    display: inline-block;
    max-width: 520px;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    background: #fff;
}
.sd-widget__image img {
    width: 100%;
    display: block;
    max-height: 220px;
    object-fit: cover;
}
.sd-widget__text {
    margin: 14px 18px 10px;
    color: #374151;
    font-size: .95rem;
    line-height: 1.5;
}
.sd-open-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 36px);
    margin: 14px 18px 18px;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .4px;
    cursor: pointer;
    transition: filter .18s, transform .12s;
}
.sd-open-btn:hover  { filter: brightness(1.08); }
.sd-open-btn:active { transform: scale(.97); }

/* ── Backdrop ────────────────────────────────────────────────────────── */
.sd-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.sd-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.sd-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: sdFadeIn .2s ease;
}
@keyframes sdFadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes sdSlideUp { from { opacity: 0; transform: translateY(24px) } to { opacity: 1; transform: translateY(0) } }

/* ── Modal box ───────────────────────────────────────────────────────── */
.sd-modal__box {
    position: relative;
    z-index: 1;
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px 28px;
    width: min(94vw, 520px);
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    animation: sdSlideUp .22s ease;
}
/* Wider box when the Stripe checkout is mounted */
.sd-modal__box.is-checkout {
    width: min(94vw, 560px);
}
.sd-modal__box:focus { outline: none; }

.sd-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    line-height: 0;
    transition: color .15s, background .15s;
}
.sd-modal__close:hover { color: #111; background: #f3f4f6; }
.sd-modal__title {
    margin: 0 0 22px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    text-align: center;
}

/* ── Screens ─────────────────────────────────────────────────────────── */
.sd-screen[hidden] { display: none !important; }

/* ── Amount grid ─────────────────────────────────────────────────────── */
.sd-amount-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.sd-amt-btn {
    padding: 12px 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: filter .15s, transform .1s, box-shadow .15s;
    text-align: center;
}
.sd-amt-btn:hover  { filter: brightness(1.1); }
.sd-amt-btn:active { transform: scale(.95); }
.sd-amt-btn.is-selected {
    box-shadow: 0 0 0 3px #fff, 0 0 0 5px currentColor;
    filter: brightness(1.05);
}

/* ── "Other" amount input ────────────────────────────────────────────── */
.sd-other-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 6px;
    transition: border-color .15s;
}
.sd-other-wrap:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.sd-other-prefix {
    padding: 0 10px 0 14px;
    color: #6b7280;
    font-size: 1rem;
    line-height: 46px;
    user-select: none;
}
.sd-other-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 12px 12px 2px;
    font-size: 1rem;
    color: #111827;
    background: transparent;
    -moz-appearance: textfield;
}
.sd-other-input::-webkit-outer-spin-button,
.sd-other-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ── Checkout screen ─────────────────────────────────────────────────── */
.sd-loader {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    color: #6b7280;
    font-size: .9rem;
    padding: 24px 0 16px;
}
.sd-loader[hidden] { display: none !important; }

/* Stripe's embedded checkout iframe fills the container */
#sd-checkout-container { min-height: 100px; }

.sd-back-btn {
    margin-top: 14px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.sd-primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    background: #8B1A1A;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 14px;
    transition: filter .15s;
}
.sd-primary-btn:hover    { filter: brightness(1.1); }
.sd-primary-btn:disabled { opacity: .6; cursor: not-allowed; }
.sd-ghost-btn {
    display: block;
    width: 100%;
    padding: 11px 16px;
    background: transparent;
    color: #374151;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .9rem;
    cursor: pointer;
    text-align: center;
    transition: background .15s, border-color .15s;
}
.sd-ghost-btn:hover { background: #f9fafb; border-color: #9ca3af; }

/* ── Feedback ────────────────────────────────────────────────────────── */
.sd-error {
    color: #dc2626;
    font-size: .875rem;
    margin: 6px 0 0;
}

/* ── Result screens (success / error) ───────────────────────────────── */
.sd-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    text-align: center;
}
.sd-result__icon {
    width: 52px;
    height: 52px;
}
.sd-result p {
    color: #374151;
    font-size: 1rem;
    margin: 0;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.sd-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sdSpin .7s linear infinite;
    flex-shrink: 0;
}
.sd-spinner--dark {
    border-color: rgba(0,0,0,.12);
    border-top-color: #6b7280;
}
@keyframes sdSpin { to { transform: rotate(360deg) } }

/* ── Test mode — widget badge ────────────────────────────────────────── */
.sd-test-badge {
    display: inline-block;
    margin: 10px 18px 0;
    padding: 3px 10px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .4px;
    cursor: default;
}

/* ── Test mode — modal banner ────────────────────────────────────────── */
.sd-modal__test-banner {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: .8rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .sd-modal__box {
        padding: 24px 18px 22px;
        border-radius: 12px 12px 0 0;
    }
    .sd-modal.is-open { align-items: flex-end; }
    .sd-modal__backdrop { backdrop-filter: none; }
}
