/**
 * EZChurch Giving — Custom Donation Form Styles
 */

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
    --cdg-primary:       #1e3a5f;
    --cdg-primary-light: #2a5298;
    --cdg-surface:       #ffffff;
    --cdg-surface-alt:   #f8f7f5;
    --cdg-border:        #e2ddd8;
    --cdg-border-focus:  #2a5298;
    --cdg-text:          #1c1917;
    --cdg-text-muted:    #78716c;
    --cdg-success:       #16a34a;
    --cdg-error:         #dc2626;
    --cdg-radius:        10px;
    --cdg-radius-sm:     6px;
    --cdg-transition:    all 0.18s ease;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.cd-giving-wrap {
    max-width: 520px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    font-family: inherit;
    color: var(--cdg-text);
}

/* ── Banners ─────────────────────────────────────────────────────────────── */
.cd-giving-demo-banner,
.cd-giving-test-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--cdg-radius-sm);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 20px;
}
.cd-giving-demo-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}
.cd-giving-test-banner {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

/* ── Sections ────────────────────────────────────────────────────────────── */
.cd-giving-section {
    margin-bottom: 20px;
}
.cd-giving-section--payment {
    margin-bottom: 16px;
}

/* ── Logged-in prefill bar ───────────────────────────────────────────────── */
.cd-giving-prefill-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--cdg-bg);
    border: 1.5px solid var(--cdg-border);
    border-radius: var(--cdg-radius-sm);
    font-size: 14px;
}
.cd-giving-prefill-name {
    color: var(--cdg-text);
    font-weight: 500;
}
.cd-giving-prefill-change {
    font-size: 12px;
    color: var(--cdg-text-muted, #9ca3af);
    text-decoration: underline;
    white-space: nowrap;
    margin-left: 12px;
}

/* ── Labels ──────────────────────────────────────────────────────────────── */
.cd-giving-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--cdg-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

/* ── Pill buttons (amounts, frequency, fund) ─────────────────────────────── */
.cd-giving-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cd-giving-pill {
    padding: 10px 20px;
    border: 1.5px solid var(--cdg-border);
    border-radius: 100px;
    background: var(--cdg-surface);
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--cdg-text-muted);
    transition: var(--cdg-transition);
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    line-height: 1;
    font-family: inherit;
}

.cd-giving-pill:hover {
    border-color: var(--cdg-primary-light);
    color: var(--cdg-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.cd-giving-pill.active {
    border-color: var(--cdg-primary);
    background: var(--cdg-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(30,58,95,.25);
    transform: translateY(-1px);
}

/* Frequency pills — segmented style */
.cd-giving-freq-pills {
    flex-wrap: nowrap;
    background: var(--cdg-surface-alt);
    border: 1.5px solid var(--cdg-border);
    border-radius: 100px;
    padding: 3px;
    gap: 0;
    display: inline-flex;
}

.cd-giving-freq-pills .cd-giving-pill {
    flex: 1;
    border: none;
    border-radius: 100px;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    transform: none;
}

.cd-giving-freq-pills .cd-giving-pill:hover {
    background: rgba(30,58,95,.06);
    color: var(--cdg-primary);
    border-color: transparent;
    box-shadow: none;
    transform: none;
}

.cd-giving-freq-pills .cd-giving-pill.active {
    background: var(--cdg-primary);
    color: #fff;
    box-shadow: 0 1px 4px rgba(30,58,95,.2);
    transform: none;
}

/* ── Custom amount input ─────────────────────────────────────────────────── */
.cd-giving-custom-wrap {
    margin-top: 10px;
    animation: cdg-fade-up 0.2s ease;
}

.cd-giving-custom-input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--cdg-border-focus);
    border-radius: var(--cdg-radius-sm);
    background: var(--cdg-surface);
    box-shadow: 0 0 0 3px rgba(42,82,152,.10);
    overflow: hidden;
}

.cd-giving-custom-symbol {
    padding: 0 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--cdg-primary);
    background: #f0f4fb;
    border-right: 1.5px solid var(--cdg-border);
    line-height: 48px;
    user-select: none;
}

#cd-giving-custom-amount {
    flex: 1;
    border: none;
    padding: 12px 14px;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--cdg-primary);
    background: transparent;
    outline: none;
    font-family: inherit;
    width: 100%;
}

#cd-giving-custom-amount::placeholder {
    color: #c5c0bb;
    font-weight: 400;
    font-size: 16px;
    letter-spacing: 0;
}

/* ── Donor fields ────────────────────────────────────────────────────────── */
.cd-giving-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cd-giving-field {
    display: flex;
    flex-direction: column;
}

.cd-giving-field input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--cdg-border);
    border-radius: var(--cdg-radius-sm);
    background: var(--cdg-surface);
    color: var(--cdg-text);
    font-size: 15px;
    font-family: inherit;
    transition: var(--cdg-transition);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.cd-giving-field input:focus {
    outline: none;
    border-color: var(--cdg-border-focus);
    box-shadow: 0 0 0 3px rgba(42,82,152,.12);
}

.cd-giving-field input::placeholder {
    color: #c5c0bb;
}

/* ── Error message ───────────────────────────────────────────────────────── */
#cd-giving-errors {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: var(--cdg-radius-sm);
    color: var(--cdg-error);
    font-size: 14px;
    margin-bottom: 16px;
    animation: cdg-shake 0.3s ease;
}

@keyframes cdg-shake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-4px); }
    75%       { transform: translateX(4px); }
}

/* ── Submit button ───────────────────────────────────────────────────────── */
.cd-giving-submit {
    display: block;
    width: 100%;
    padding: 15px 24px;
    background: var(--cdg-primary);
    color: #fff;
    border: none;
    border-radius: var(--cdg-radius);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: var(--cdg-transition);
    box-shadow: 0 2px 8px rgba(30,58,95,.25);
    font-family: inherit;
    margin-top: 4px;
}

.cd-giving-submit:hover:not(:disabled) {
    background: var(--cdg-primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(30,58,95,.3);
}

.cd-giving-submit:active:not(:disabled) {
    transform: translateY(0);
}

.cd-giving-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Stripe badge ────────────────────────────────────────────────────────── */
.cd-giving-stripe-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 12px;
    color: #b8b4b0;
    letter-spacing: 0.01em;
}

/* ── Success / Thank you ─────────────────────────────────────────────────── */
.cd-giving-thank-you {
    text-align: center;
    padding: 48px 24px;
    animation: cdg-fade-up 0.5s ease;
}

.cd-giving-thank-you-icon {
    width: 64px;
    height: 64px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: var(--cdg-success);
    font-weight: 700;
}

.cd-giving-thank-you h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--cdg-primary);
    margin: 0 0 10px;
}

.cd-giving-thank-you p {
    font-size: 15px;
    color: var(--cdg-text-muted);
    margin: 0 0 6px;
    line-height: 1.6;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes cdg-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media ( max-width: 480px ) {
    .cd-giving-fields-row {
        grid-template-columns: 1fr;
    }
    .cd-giving-pill {
        padding: 9px 14px;
        font-size: 14px;
    }
    .cd-giving-freq-pills .cd-giving-pill {
        font-size: 12px;
        padding: 7px 10px;
    }
    .cd-giving-submit {
        font-size: 15px;
        padding: 14px 20px;
    }
}

/* ── Reports — net fees % ────────────────────────────────────────────────── */
.cd-pct {
    color: #999;
    font-weight: normal;
    font-size: 11px;
}

/* ── Processing fee toggle ───────────────────────────────────────────────── */
.cd-giving-fee-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--cdg-surface-alt);
    border: 1.5px solid var(--cdg-border);
    border-radius: var(--cdg-radius-sm);
    cursor: pointer;
    margin-bottom: 0;
    transition: border-color 0.18s ease;
}

.cd-giving-fee-toggle:hover {
    border-color: var(--cdg-primary-light);
}

.cd-giving-fee-toggle-inner {
    position: relative;
    flex-shrink: 0;
}

.cd-giving-fee-toggle-inner input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cd-giving-fee-toggle-track {
    display: block;
    width: 38px;
    height: 22px;
    background: #d1d5db;
    border-radius: 100px;
    position: relative;
    transition: background 0.18s ease;
    cursor: pointer;
}

.cd-giving-fee-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.18s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.cd-giving-fee-toggle-inner input:checked ~ .cd-giving-fee-toggle-track {
    background: var(--cdg-primary);
}

.cd-giving-fee-toggle-inner input:checked ~ .cd-giving-fee-toggle-track::after {
    transform: translateX( 16px );
}

.cd-giving-fee-toggle-text {
    flex: 1;
}

.cd-giving-fee-toggle-title {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--cdg-text);
    line-height: 1.3;
}

.cd-giving-fee-toggle-desc {
    display: block;
    font-size: 12px;
    color: var(--cdg-text-muted);
    margin-top: 2px;
}

.cd-giving-fee-amount {
    font-size: 13px;
    font-weight: 700;
    color: var(--cdg-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Total row ────────────────────────────────────────────────────────────── */
.cd-giving-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border: 1.5px solid var(--cdg-border);
    border-top: none;
    border-radius: 0 0 var(--cdg-radius-sm) var(--cdg-radius-sm);
    background: var(--cdg-surface);
    margin-bottom: 20px;
}

.cd-giving-total-label {
    font-size: 13px;
    color: var(--cdg-text-muted);
}

.cd-giving-total-amount {
    font-size: 16px;
    font-weight: 700;
    color: var(--cdg-primary);
}
