/**
 * Donation Form Shared Styles
 * Single source of truth for donation form styling
 * Used by: donor5 actual form, admin5html preview, client5 preview
 *
 * URL: https://donor.theauxilia.dev/public/shared/donation-form.css
 */

:root {
    --df-primary-color: #2563eb;
    --df-secondary-color: #10b981;
    --df-text-dark: #1f2937;
    --df-text-light: #6b7280;
    --df-text-muted: #9ca3af;
    --df-border-color: #e5e7eb;
    --df-bg-light: #f3f4f6;
    --df-bg-white: #ffffff;
    --df-success-color: #10b981;
    --df-danger-color: #ef4444;
    --df-font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ==================== BASE STYLES ==================== */
.df-body {
    font-family: var(--df-font-family);
    background: var(--df-bg-light);
    min-height: 100vh;
    color: var(--df-text-dark);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.df-body *, .df-body *::before, .df-body *::after {
    box-sizing: border-box;
}

/* ==================== HEADER SECTION ==================== */
.df-header-section {
    position: relative;
    background: linear-gradient(135deg, var(--df-primary-color), var(--df-secondary-color));
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2rem 5rem;
}

.df-header-section.has-image {
    min-height: 0;
    padding: 0;
    display: block;
    background: transparent;
    /* Match the public donate page banner cap so the image doesn't span the
       full viewport on wide screens. */
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    /* Rounded corners — clip the inner img to match. */
    border-radius: 12px;
    overflow: hidden;
}

.df-header-section.has-image img {
    width: 100%;
    display: block;
    max-width: 800px;
    max-height: 250px;
    object-fit: cover;
    border-radius: 12px;
}

.df-header-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.df-header-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.df-header-logo {
    max-height: 80px;
    max-width: 200px;
    margin: 0 auto 1rem;
    display: block;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.df-header-text {
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 0.5rem;
    text-align: center;
}

.df-header-message {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* ==================== LOGO SECTION (below header) ==================== */
.df-logo-section {
    text-align: center;
    padding: 1.5rem 1rem;
    background: transparent;
}

.df-logo-section img {
    max-height: 80px;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ==================== FORM CONTAINER ==================== */
.df-form-container {
    max-width: 500px;
    margin: -3rem auto 2rem;
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

.df-form-card {
    background: var(--df-bg-white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.df-form-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--df-text-dark);
    text-align: center;
}

.df-form-description {
    color: var(--df-text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-align: center;
}

.df-client-name-line {
    color: var(--df-text-light);
    font-size: 0.9rem;
    margin-top: 1rem;
    margin-bottom: 0;
    text-align: center;
}

.df-client-name-line strong {
    color: var(--df-primary-color);
}

/* ==================== GOAL SECTION ==================== */
.df-goal-section {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.df-goal-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.df-goal-raised {
    font-weight: 700;
    color: var(--df-primary-color);
}

.df-goal-target {
    font-weight: 600;
}

.df-progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.df-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--df-primary-color), var(--df-secondary-color));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.df-goal-percentage {
    font-size: 0.8rem;
    color: var(--df-text-muted);
    margin-top: 0.5rem;
}

/* ==================== FORM SECTIONS ==================== */
.df-form-section {
    margin-bottom: 1.5rem;
}

.df-form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--df-text-dark);
}

.df-form-label.required::after {
    content: " *";
    color: var(--df-danger-color);
}

/* ==================== DONATION TYPE BUTTONS ==================== */
.df-type-options {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.df-type-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--df-border-color);
    border-radius: 8px;
    background: var(--df-bg-white);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}

.df-type-btn:hover {
    border-color: var(--df-primary-color);
    color: var(--df-primary-color);
}

.df-type-btn.selected {
    border-color: var(--df-primary-color);
    background: rgba(37, 99, 235, 0.1);
    color: var(--df-primary-color);
}

.df-type-btn i {
    margin-right: 0.5rem;
}

/* ==================== FREQUENCY OPTIONS ==================== */
.df-frequency-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.df-freq-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--df-border-color);
    border-radius: 20px;
    background: var(--df-bg-white);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.df-freq-btn:hover,
.df-freq-btn.selected {
    border-color: var(--df-primary-color);
    background: rgba(37, 99, 235, 0.1);
    color: var(--df-primary-color);
}

/* ==================== AMOUNT BUTTONS ==================== */
.df-amount-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.df-amount-btn {
    padding: 0.75rem;
    border: 2px solid var(--df-border-color);
    border-radius: 8px;
    background: var(--df-bg-white);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.df-amount-btn:hover {
    border-color: var(--df-primary-color);
    color: var(--df-primary-color);
}

.df-amount-btn.selected {
    border-color: var(--df-primary-color);
    background: rgba(37, 99, 235, 0.1);
    color: var(--df-primary-color);
}

/* ==================== CUSTOM AMOUNT ==================== */
.df-custom-amount {
    display: flex;
    align-items: center;
    border: 2px solid var(--df-border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.df-custom-amount:focus-within {
    border-color: var(--df-primary-color);
}

.df-custom-amount span {
    padding: 0.75rem 1rem;
    background: #f9fafb;
    font-weight: 500;
    color: var(--df-text-light);
}

.df-custom-amount input {
    flex: 1;
    border: none;
    padding: 0.75rem;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

/* ==================== FORM INPUTS ==================== */
.df-form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--df-border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.df-form-input:focus {
    outline: none;
    border-color: var(--df-primary-color);
}

.df-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ==================== CARD ELEMENT ==================== */
.df-card-element {
    padding: 0.75rem 1rem;
    border: 2px solid var(--df-border-color);
    border-radius: 8px;
    background-color: white;
    transition: border-color 0.2s;
}

.df-card-element.StripeElement--focus {
    border-color: var(--df-primary-color);
}

.df-card-element.StripeElement--invalid {
    border-color: var(--df-danger-color);
}

.df-card-errors {
    color: var(--df-danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

/* ==================== FEE COVERAGE ==================== */
.df-fee-coverage {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.df-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.df-checkbox-wrapper input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 18px;
    height: 18px;
    accent-color: var(--df-secondary-color);
    cursor: pointer;
}

.df-fee-label {
    flex: 1;
    font-size: 0.9rem;
}

.df-fee-label strong {
    color: var(--df-text-dark);
}

.df-fee-amount {
    font-weight: 600;
    color: var(--df-primary-color);
}

.df-fee-description {
    margin-top: 0.25rem;
    color: var(--df-text-muted);
    font-size: 0.8rem;
}

/* ==================== TOTAL SECTION ==================== */
.df-total-section {
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.df-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: var(--df-text-dark);
    padding: 0.25rem 0;
}

.df-total-row.subtotal {
    font-weight: 400;
    color: var(--df-text-light);
}

.df-total-row.fee-row {
    font-weight: 400;
    color: var(--df-text-light);
    font-size: 0.9rem;
}

.df-total-row.fee-row .fee-rate {
    font-size: 0.8rem;
    color: #9ca3af;
}

.df-total-row.grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    border-top: 1px solid #e5e7eb;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

/* ==================== DONATE BUTTON ==================== */
.df-donate-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--df-primary-color), var(--df-secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.df-donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.df-donate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.df-donate-btn.processing {
    pointer-events: none;
}

/* ==================== SECURE NOTE ==================== */
.df-secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--df-text-muted);
}

.df-secure-note svg {
    width: 14px;
    height: 14px;
}

/* ==================== FOOTER SECTION ==================== */
.df-footer-section {
    text-align: center;
    padding: 2rem 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.df-footer-image {
    max-width: 100%;
    max-height: 150px;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.df-footer-text {
    font-size: 0.875rem;
    color: var(--df-text-light);
    line-height: 1.6;
}

.df-powered-by {
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--df-text-muted);
}

/* ==================== SUCCESS STATE ==================== */
.df-donation-success {
    text-align: center;
    padding: 2rem 0;
}

.df-success-icon {
    width: 80px;
    height: 80px;
    background: var(--df-success-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.df-success-icon i {
    font-size: 2.5rem;
    color: white;
}

.df-donation-success h2 {
    color: var(--df-text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

.df-donation-success > p {
    color: var(--df-text-light);
    margin-bottom: 1.5rem;
}

.df-donation-details {
    background: var(--df-bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    text-align: left;
}

.df-donation-details .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--df-border-color);
}

.df-donation-details .detail-row:last-child {
    border-bottom: none;
    font-weight: 600;
}

/* ==================== LOADING STATE ==================== */
.df-loading {
    text-align: center;
    padding: 4rem 2rem;
}

.df-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid var(--df-border-color);
    border-top-color: var(--df-primary-color);
    border-radius: 50%;
    animation: df-spin 1s linear infinite;
}

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

/* ==================== ERROR STATE ==================== */
.df-error-message {
    max-width: 500px;
    margin: 4rem auto;
    background-color: #fef2f2;
    border: 1px solid var(--df-danger-color);
    color: var(--df-danger-color);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

/* ==================== TIERS SECTION ==================== */
.df-tiers-section {
    margin-bottom: 1.5rem;
}

.df-tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.df-tier-card {
    position: relative;
    border: 2px solid var(--df-border-color);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--df-bg-white);
    text-align: center;
    overflow: hidden;
}

/* DN-FRM-046 (7/14 AF reopen): render the tier image at its own aspect
   ratio — the fixed-height box + object-fit: cover zoomed in and cut off
   any image that wasn't exactly the box shape.
   AF 7/16: max-width instead of width — forcing width: 100% upscaled images
   narrower than the card and made them blurry; smaller images now render at
   native size (crisp), centered. */
.df-tier-image {
    margin: -1.25rem -1.25rem 1rem -1.25rem;
    overflow: hidden;
    text-align: center;
}

.df-tier-image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.df-tier-card:hover {
    border-color: var(--df-primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.df-tier-card.selected,
.df-tier-card.active {
    border-color: var(--df-primary-color);
    background: rgba(37, 99, 235, 0.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.df-tier-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--df-secondary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    white-space: nowrap;
}

.df-tier-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--df-text-dark);
    margin-bottom: 0.5rem;
}

.df-tier-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--df-primary-color);
    margin-bottom: 0.5rem;
}

.df-tier-description {
    font-size: 0.85rem;
    color: var(--df-text-light);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.df-tier-recurring {
    font-size: 0.75rem;
    color: var(--df-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.df-tier-recurring i {
    font-size: 0.7rem;
}

.df-custom-amount-toggle {
    margin-top: 1rem;
}

.df-custom-amount-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--df-text-light);
}

.df-custom-amount-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--df-primary-color);
}

.df-hidden {
    display: none !important;
}

/* ==================== PREVIEW BADGE ==================== */
.df-preview-badge {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #f59e0b;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 1000;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 640px) {
    .df-header-section {
        min-height: 180px;
        padding: 2rem 1rem 4rem;
    }

    .df-header-text {
        font-size: 1.5rem;
    }

    .df-header-message {
        font-size: 1rem;
    }

    .df-form-container {
        margin-top: -2rem;
    }

    .df-form-card {
        padding: 1.5rem;
    }

    .df-amount-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .df-input-row {
        grid-template-columns: 1fr;
    }

    .df-type-options {
        flex-direction: column;
    }

    .df-type-btn {
        min-width: auto;
    }

    .df-tiers-grid {
        grid-template-columns: 1fr;
    }

    .df-tier-card {
        padding: 1rem;
    }

    .df-tier-amount {
        font-size: 1.5rem;
    }
}
