/* ============================================================
   Donation Modal — Kenya Red Cross Society
   ============================================================ */

/* ── Backdrop ── */
.dm-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 5vh 1rem 2rem; z-index: 9999; overflow-y: auto;
}

/* ── Container ── */
.dm-container {
    background: #ffffff; border-radius: 1rem;
    max-width: 32rem; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    animation: dmSlideIn 0.25s ease-out;
    font-family: 'Public Sans', sans-serif;
}
@keyframes dmSlideIn {
    from { opacity: 0; transform: translateY(-1rem); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.dm-header { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem 1.5rem; border-bottom: 1px solid #e5e7eb; }
.dm-title { font-size: 1.125rem; font-weight: 800; margin: 0; color: #111827; }
.dm-close { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #9ca3af; padding: 0.25rem 0.5rem; border-radius: 0.5rem; transition: background 0.15s, color 0.15s; }
.dm-close:hover { background: #f3f4f6; color: #111827; }

/* ── Step Indicator ── */
.dm-steps { display: flex; align-items: center; justify-content: center; gap: 0; padding: 1rem 1.5rem; border-bottom: 1px solid #f3f4f6; }
.dm-step { display: flex; align-items: center; gap: 0.4rem; }
.dm-step__num { width: 1.75rem; height: 1.75rem; border-radius: 50%; background: #e5e7eb; color: #6b7280; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; transition: background 0.25s, color 0.25s; flex-shrink: 0; }
.dm-step--active .dm-step__num { background: var(--fundraising-brand, #EE2A24); color: #ffffff; }
.dm-step__label { font-size: 0.75rem; font-weight: 600; color: #9ca3af; transition: color 0.25s; }
.dm-step--active .dm-step__label { color: #111827; }
.dm-step__line { width: 2rem; height: 2px; background: #e5e7eb; margin: 0 0.25rem; }

/* ── Body ── */
.dm-body { padding: 1.5rem; }

/* ── Section ── */
.dm-section { margin-bottom: 1.25rem; }
.dm-label { display: block; font-size: 0.8125rem; font-weight: 700; color: #374151; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dm-hint { font-size: 0.75rem; color: #9ca3af; margin-top: 0.35rem; margin-bottom: 0; }

/* ── Amount Presets ── */
.dm-presets { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.dm-preset { padding: 0.5rem 1rem; border: 1.5px solid #d1d5db; border-radius: 9999px; background: #ffffff; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.15s; color: #374151; line-height: 1.25; }
.dm-preset:hover { border-color: var(--fundraising-brand, #EE2A24); color: var(--fundraising-brand, #EE2A24); }
.dm-preset--selected { background: var(--fundraising-brand, #EE2A24); border-color: var(--fundraising-brand, #EE2A24); color: #ffffff; }
.dm-preset--popular { border-color: var(--fundraising-brand, #EE2A24); color: var(--fundraising-brand, #EE2A24); font-weight: 700; }
.dm-preset--popular.dm-preset--selected { color: #ffffff; }
.dm-preset__label { display: block; font-size: 0.65rem; margin-top: 0.15rem; opacity: 0.85; font-weight: 400; }

/* ── Custom Amount ── */
.dm-custom-wrap { display: flex; align-items: stretch; border: 1.5px solid #d1d5db; border-radius: 0.5rem; overflow: hidden; transition: border-color 0.15s; }
.dm-custom-wrap:focus-within { border-color: var(--fundraising-brand, #EE2A24); }
.dm-currency-prefix { display: flex; align-items: center; padding: 0 0.75rem; background: #f3f4f6; border-right: 1.5px solid #d1d5db; font-size: 0.875rem; font-weight: 700; color: #374151; white-space: nowrap; flex-shrink: 0; }
.dm-custom-input { flex: 1; min-width: 0; padding: 0.625rem 1rem; border: none; font-size: 0.875rem; color: #111827; font-family: inherit; background: transparent; }
.dm-custom-input:focus { outline: none; }

/* ── Select ── */
.dm-select { width: 100%; padding: 0.625rem 2.5rem 0.625rem 0.875rem; border: 1.5px solid #d1d5db; border-radius: 0.5rem; font-size: 0.875rem; background: #ffffff; color: #111827; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; font-family: inherit; transition: border-color 0.15s; }
.dm-select:focus { outline: none; border-color: var(--fundraising-brand, #EE2A24); }

/* ── Frequency Toggle ── */
.dm-toggle { display: flex; gap: 0.5rem; }
.dm-toggle-btn { flex: 1; padding: 0.5rem 1rem; border: 1.5px solid #d1d5db; border-radius: 9999px; background: #ffffff; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.15s; color: #374151; font-family: inherit; }
.dm-toggle-btn:hover:not(.dm-toggle-btn--active) { border-color: var(--fundraising-brand, #EE2A24); color: var(--fundraising-brand, #EE2A24); }
.dm-toggle-btn--active { background: var(--fundraising-brand, #EE2A24); border-color: var(--fundraising-brand, #EE2A24); color: #ffffff; }

/* ── Inputs ── */
.dm-input { width: 100%; padding: 0.625rem 0.875rem; border: 1.5px solid #d1d5db; border-radius: 0.5rem; font-size: 0.875rem; color: #111827; font-family: inherit; transition: border-color 0.15s; box-sizing: border-box; }
.dm-input:focus { outline: none; border-color: var(--fundraising-brand, #EE2A24); }

/* ── 2-column row ── */
.dm-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ── Payment Methods ── */
.dm-methods { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.75rem; }
.dm-method { position: relative; padding: 1rem 0.5rem; border: 2px solid #d1d5db; border-radius: 0.75rem; background: #ffffff; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; font-family: inherit; }
.dm-method:hover:not(.dm-method--disabled) { border-color: var(--fundraising-brand, #EE2A24); }
.dm-method--selected { border-color: var(--fundraising-brand, #EE2A24); background: var(--fundraising-brand-soft, rgba(238,42,36,0.04)); }
.dm-method--disabled { opacity: 0.45; cursor: not-allowed; }
.dm-method__icon { font-size: 1.75rem; display: block; margin-bottom: 0.4rem; line-height: 1; }
.dm-method__name { font-size: 0.8125rem; font-weight: 700; color: #374151; display: block; }
.dm-method__soon { position: absolute; top: 0.375rem; right: 0.375rem; font-size: 0.6rem; background: #fef3c7; color: #92400e; padding: 0.1rem 0.35rem; border-radius: 0.25rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }

/* ── Info box ── */
.dm-infobox { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.75rem 1rem; font-size: 0.8125rem; color: #374151; margin-bottom: 1rem; }
.dm-infobox p { margin: 0.2rem 0; }
.dm-infobox p:first-child { margin-top: 0; }
.dm-infobox p:last-child { margin-bottom: 0; }

/* ── Alert ── */
.dm-alert { padding: 0.625rem 0.875rem; border-radius: 0.5rem; font-size: 0.8125rem; margin-bottom: 1rem; }
.dm-alert--info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Checkbox ── */
.dm-checkbox-label { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.875rem; color: #374151; cursor: pointer; line-height: 1.4; }
.dm-terms-label { align-items: flex-start; }
.dm-checkbox { width: 1rem; height: 1rem; accent-color: var(--fundraising-brand, #EE2A24); margin-top: 0.1rem; flex-shrink: 0; cursor: pointer; }

/* ── Summary ── */
.dm-summary { background: #ffffff; border: 1.5px dashed #d1d5db; border-radius: 0.75rem; padding: 1.25rem; margin-bottom: 1.25rem; }
.dm-summary__title { font-size: 0.8125rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; margin: 0 0 0.75rem 0; }
.dm-summary__row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; font-size: 0.875rem; color: #374151; }
.dm-summary__row span:first-child { color: #6b7280; font-weight: 500; }
.dm-summary__row span:last-child { font-weight: 600; color: #111827; }
.dm-summary__divider { height: 1px; background: repeating-linear-gradient(to right,#d1d5db 0,#d1d5db 5px,transparent 5px,transparent 10px); margin: 0.75rem 0; }
.dm-summary__row--total { margin-bottom: 0; }
.dm-summary__row--total span:first-child { font-weight: 700; color: #111827; font-size: 0.9375rem; }
.dm-summary__row--total span:last-child { font-size: 1.25rem; font-weight: 800; color: var(--fundraising-brand, #EE2A24); }

/* ── Error ── */
.dm-err { color: #dc2626; background: #fef2f2; border: 1px solid #fecaca; border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.8125rem; margin-bottom: 0.75rem; }
.dm-err.hidden { display: none; }

/* ── Buttons ── */
.dm-btn { padding: 0.75rem 1.5rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 700; cursor: pointer; transition: all 0.15s; border: 1.5px solid transparent; font-family: inherit; line-height: 1.25; }
.dm-btn--primary { background: var(--fundraising-brand, #EE2A24); color: #ffffff; border-color: var(--fundraising-brand, #EE2A24); width: 100%; }
.dm-btn--primary:hover:not(:disabled) { background: var(--fundraising-brand-dark, #c41118); border-color: var(--fundraising-brand-dark, #c41118); transform: translateY(-1px); box-shadow: 0 4px 12px var(--fundraising-brand-shadow, rgba(238,42,36,0.3)); }
.dm-btn--primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.dm-btn--secondary { background: #ffffff; color: #374151; border-color: #d1d5db; }
.dm-btn--secondary:hover { background: #f9fafb; border-color: #9ca3af; }
.dm-btn--sm { padding: 0.5rem 1rem; font-size: 0.8125rem; width: auto; }
.dm-btn-row { display: flex; gap: 0.75rem; margin-top: 0.25rem; }
.dm-btn-row .dm-btn--secondary, .dm-btn-row .dm-btn--primary { flex: 1; }
.dm-btn-row--center { justify-content: center; }
.dm-btn-row--center .dm-btn { flex: none; min-width: 8rem; width: auto; }

/* ── Link ── */
.dm-link { color: var(--fundraising-brand, #EE2A24); text-decoration: underline; }
.dm-link:hover { color: var(--fundraising-brand-dark, #c41118); }

/* ── Loading ── */
.dm-loading { color: #9ca3af; font-size: 0.875rem; padding: 0.5rem 0; }

/* ── Result pages ── */
.dm-result { text-align: center; padding: 1.5rem 0 0.5rem; }
.dm-result__icon { width: 4rem; height: 4rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.75rem; margin: 0 auto 1rem; font-weight: 900; }
.dm-result__icon--success { background: #dcfce7; color: #16a34a; }
.dm-result__icon--error { background: #fef2f2; color: #dc2626; }
.dm-result__icon--waiting { background: #dbeafe; color: #2563eb; }
.dm-result__title { font-size: 1.375rem; font-weight: 800; color: #111827; margin: 0 0 0.5rem; }
.dm-result__msg { font-size: 0.9375rem; color: #6b7280; margin: 0 0 1.25rem; line-height: 1.5; }
.dm-result__sub { font-size: 0.8125rem; color: #9ca3af; margin: 0 0 1rem; }

/* ── Receipt ── */
.dm-receipt { display: inline-flex; flex-direction: column; align-items: center; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 0.75rem 1.5rem; margin-bottom: 1.5rem; }
.dm-receipt__label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #9ca3af; margin-bottom: 0.2rem; }
.dm-receipt__num { font-family: 'Courier New', monospace; font-size: 1rem; font-weight: 700; color: #111827; }

/* ── Spinner ── */
.dm-spinner { width: 2rem; height: 2rem; animation: dmSpin 0.8s linear infinite; }
.dm-spinner__track { stroke: #bfdbfe; opacity: 1; }
.dm-spinner__arc { fill: #2563eb; }
@keyframes dmSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 480px) {
    .dm-backdrop { padding: 0; align-items: flex-end; }
    .dm-container { border-radius: 1.25rem 1.25rem 0 0; max-width: 100%; }
    .dm-methods { grid-template-columns: 1fr 1fr; }
    .dm-methods .dm-method:last-child { grid-column: span 2; }
    .dm-presets { flex-direction: column; }
    .dm-preset { width: 100%; text-align: left; }
    .dm-row-2 { grid-template-columns: 1fr; }
}

/* ── Badge Unlock Overlay ── */
#dm-badge-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 20;
    animation: dm-badge-in 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

@keyframes dm-badge-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes dm-badge-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.dm-badge-unlock {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border: 2px solid #f5c518;
    border-radius: 20px;
    padding: 36px 32px 28px;
    text-align: center;
    max-width: 300px;
    width: 90%;
    animation: dm-card-pop 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
    box-shadow: 0 0 40px rgba(245,197,24,0.35), 0 20px 60px rgba(0,0,0,0.5);
}

@keyframes dm-card-pop {
    from { transform: scale(0.5) translateY(30px); opacity: 0; }
    to   { transform: scale(1) translateY(0);      opacity: 1; }
}

.dm-badge-unlock__label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #f5c518;
    margin: 0 0 16px;
    animation: dm-label-glow 1.5s ease-in-out infinite alternate;
}

@keyframes dm-label-glow {
    from { text-shadow: 0 0 6px rgba(245,197,24,0.4); }
    to   { text-shadow: 0 0 18px rgba(245,197,24,0.9), 0 0 30px rgba(245,197,24,0.4); }
}

.dm-badge-unlock__icon {
    font-size: 72px;
    line-height: 1;
    margin: 0 0 16px;
    display: block;
    animation: dm-icon-bounce 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.4s both;
    filter: drop-shadow(0 4px 12px rgba(245,197,24,0.6));
}

@keyframes dm-icon-bounce {
    from { transform: scale(0) rotate(-15deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

.dm-badge-unlock__name {
    font-size: 20px;
    font-weight: 900;
    color: #ffffff;
    margin: 0 0 10px;
}

.dm-badge-unlock__msg {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0 0 24px;
}

.dm-badge-unlock__btn {
    width: 100%;
    background: linear-gradient(135deg, #f5c518, #e6a817);
    color: #1a1a1a;
    font-weight: 800;
    border: none;
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.dm-badge-unlock__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245,197,24,0.5);
}

/* Sparkle particles */
.dm-badge-sparkles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    border-radius: inherit;
}

.dm-spark {
    position: absolute;
    color: #f5c518;
    font-size: 14px;
    opacity: 0;
    animation: dm-spark-fly 2s ease-in-out infinite;
}

.dm-spark--1 { top: 15%; left: 10%; animation-delay: 0s;    animation-duration: 2.1s; }
.dm-spark--2 { top: 20%; right: 12%; animation-delay: 0.3s; animation-duration: 1.8s; }
.dm-spark--3 { top: 60%; left: 8%;  animation-delay: 0.6s; animation-duration: 2.4s; }
.dm-spark--4 { top: 70%; right: 10%; animation-delay: 0.9s; animation-duration: 1.9s; }
.dm-spark--5 { top: 40%; left: 5%;  animation-delay: 1.2s; animation-duration: 2.2s; }
.dm-spark--6 { top: 35%; right: 6%; animation-delay: 1.5s; animation-duration: 2s;   }

@keyframes dm-spark-fly {
    0%   { opacity: 0; transform: translateY(0)    scale(0.5) rotate(0deg); }
    20%  { opacity: 1; transform: translateY(-8px)  scale(1)   rotate(20deg); }
    80%  { opacity: 1; transform: translateY(-20px) scale(1)   rotate(-10deg); }
    100% { opacity: 0; transform: translateY(-30px) scale(0.5) rotate(30deg); }
}
