/**
 * WC Donation Form - Multi-Step Frontend Styles
 * Version: 1.3.0
 * Author: Total Teck
 *
 * Matches the reference form design with generous field spacing,
 * rounded inputs, and clean card-based layout.
 * Uses CSS custom properties for dynamic color theming via admin settings.
 */

/* ============================================
   WRAPPER & CONTAINER
   ============================================ */
.wcdf-donation-wrapper {
    --wcdf-primary: #7B2D26;
    --wcdf-secondary: #D4A03C;
    --wcdf-bg: #ffffff;
    --wcdf-border: #e2e8f0;
    --wcdf-text: #1a202c;
    --wcdf-text-muted: #64748b;
    --wcdf-radius: 8px;
    --wcdf-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--wcdf-text);
    box-sizing: border-box;
    max-width: 480px;
    margin: 0 auto;
}

.wcdf-donation-wrapper *,
.wcdf-donation-wrapper *::before,
.wcdf-donation-wrapper *::after {
    box-sizing: border-box;
}

.wcdf-donation-container {
    background: var(--wcdf-bg);
    border-radius: 12px;
    box-shadow: var(--wcdf-shadow);
    overflow: hidden;
    position: relative;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.wcdf-progress-bar {
    height: 6px;
    background: #e2e8f0;
    width: 100%;
}

.wcdf-progress-fill {
    height: 100%;
    background: var(--wcdf-secondary);
    transition: width 0.4s ease;
    width: 33.33%;
    border-radius: 0 3px 3px 0;
}

/* ============================================
   STEP HEADER (Back + Title)
   ============================================ */
.wcdf-step-header {
    display: flex;
    align-items: center;
    padding: 20px 28px 0;
    gap: 12px;
}

.wcdf-back-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    color: var(--wcdf-text);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcdf-back-btn:hover {
    background: #f1f5f9;
}

.wcdf-step-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--wcdf-text);
    flex: 1;
    text-align: center;
    padding-right: 32px;
}

/* ============================================
   STEPS
   ============================================ */
.wcdf-step {
    padding: 32px 28px 28px;
    display: none;
    animation: wcdfFadeIn 0.3s ease;
}

.wcdf-step.active {
    display: block;
}

.wcdf-step[style*="display: none"] {
    display: none !important;
}

@keyframes wcdfFadeIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

.wcdf-step-subtitle {
    font-size: 14px;
    color: var(--wcdf-text-muted);
    margin: 0 0 28px;
}

/* ============================================
   SECTIONS & FIELD GROUPS
   ============================================ */
.wcdf-section {
    margin-bottom: 24px;
}

.wcdf-section:last-child {
    margin-bottom: 0;
}

.wcdf-field-group {
    margin-bottom: 22px;
}

.wcdf-field-group:last-child {
    margin-bottom: 0;
}

/* ============================================
   LABELS
   ============================================ */
.wcdf-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--wcdf-text);
    margin-bottom: 10px;
}

.wcdf-label-sm {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--wcdf-text);
    margin-bottom: 8px;
}

.wcdf-required {
    color: #e53e3e;
}

/* ============================================
   INPUTS & SELECTS (generous spacing to match reference)
   ============================================ */
.wcdf-input,
.wcdf-select {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    border: 2px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius);
    background: #fff;
    color: var(--wcdf-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.wcdf-input:focus,
.wcdf-select:focus {
    border-color: var(--wcdf-primary);
    box-shadow: 0 0 0 3px rgba(123, 45, 38, 0.1);
}

.wcdf-input::placeholder {
    color: #a0aec0;
    font-size: 15px;
}

.wcdf-input.error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.wcdf-input.valid {
    border-color: #38a169;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.08);
}

.wcdf-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
    appearance: none;
}

/* Field hint messages (validation feedback) */
.wcdf-field-hint {
    display: block;
    font-size: 12px;
    margin-top: 6px;
    padding-left: 2px;
}

.wcdf-field-hint.error {
    color: #e53e3e;
}

.wcdf-field-hint.valid {
    color: #38a169;
}

/* ============================================
   FREQUENCY TOGGLE
   ============================================ */
.wcdf-frequency-toggle {
    display: flex;
    border: 2px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius);
    overflow: hidden;
}

.wcdf-freq-btn {
    flex: 1;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    background: #fff;
    color: var(--wcdf-text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.wcdf-freq-btn.active {
    background: var(--wcdf-primary);
    color: #fff;
}

.wcdf-freq-btn:not(.active):hover {
    background: #f7fafc;
}

/* ============================================
   AMOUNT BUTTONS (stacked, full-width)
   ============================================ */
.wcdf-amount-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.wcdf-currency-badge {
    font-size: 13px;
    color: var(--wcdf-text-muted);
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 500;
}

.wcdf-amounts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wcdf-amount-btn {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius);
    background: #fff;
    color: var(--wcdf-text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.wcdf-amount-btn:hover {
    border-color: var(--wcdf-primary);
    background: #fdf8f7;
}

.wcdf-amount-btn.active {
    background: var(--wcdf-primary);
    color: #fff;
    border-color: var(--wcdf-primary);
}

/* Custom Amount */
.wcdf-custom-amount-wrapper {
    position: relative;
}

.wcdf-custom-amount-input {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    border: 2px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius);
    background: #fff;
    color: var(--wcdf-text);
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.wcdf-custom-amount-input:focus {
    border-color: var(--wcdf-primary);
    box-shadow: 0 0 0 3px rgba(123, 45, 38, 0.1);
}

.wcdf-custom-amount-input::placeholder {
    color: #a0aec0;
    font-size: 15px;
}

/* Remove number input spinners */
.wcdf-custom-amount-input::-webkit-outer-spin-button,
.wcdf-custom-amount-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wcdf-custom-amount-input[type=number] {
    -moz-appearance: textfield;
}

/* ============================================
   FEES & NEWSLETTER BOXES
   ============================================ */
.wcdf-fees-box,
.wcdf-newsletter-box {
    border: 2px solid var(--wcdf-primary);
    border-radius: var(--wcdf-radius);
    padding: 18px 20px;
    background: rgba(123, 45, 38, 0.02);
}

.wcdf-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: var(--wcdf-text);
}

.wcdf-checkbox {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--wcdf-primary);
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--wcdf-primary);
    margin-top: 1px;
}

.wcdf-fees-text strong {
    color: var(--wcdf-primary);
}

/* ============================================
   BUTTONS
   ============================================ */
.wcdf-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 18px 24px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: var(--wcdf-radius);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.wcdf-btn-primary {
    background: var(--wcdf-primary);
    color: #fff;
}

.wcdf-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wcdf-btn-primary:active {
    transform: translateY(0);
}

.wcdf-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   SECURE NOTICE
   ============================================ */
.wcdf-secure-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--wcdf-text-muted);
    margin-top: 16px;
    text-align: center;
}

.wcdf-secure-notice svg {
    color: var(--wcdf-secondary);
}

/* ============================================
   DONATION SUMMARY (Step 3)
   ============================================ */
.wcdf-summary-box {
    border: 1px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius);
    padding: 22px 24px;
    margin-bottom: 24px;
}

.wcdf-summary-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--wcdf-text);
}

.wcdf-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}

.wcdf-summary-row:last-child {
    border-bottom: none;
}

.wcdf-summary-row span {
    color: var(--wcdf-text-muted);
}

.wcdf-summary-row strong {
    color: var(--wcdf-text);
    font-weight: 600;
    white-space: nowrap;
}

.wcdf-summary-row small {
    display: block;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.wcdf-summary-total {
    border-top: 2px solid var(--wcdf-border);
    margin-top: 4px;
    padding-top: 14px;
    border-bottom: none;
}

.wcdf-summary-total strong {
    font-size: 18px;
    color: var(--wcdf-primary);
}

/* ============================================
   CARD ELEMENT (Stripe/Clover/Square)
   ============================================ */
.wcdf-stripe-container {
    border: 1px solid var(--wcdf-border);
    border-radius: var(--wcdf-radius);
    overflow: hidden;
}

.wcdf-stripe-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--wcdf-border);
    font-size: 14px;
    font-weight: 500;
    color: var(--wcdf-text);
}

.wcdf-card-element {
    padding: 20px;
    min-height: 60px;
}

.wcdf-card-errors {
    padding: 0 20px 12px;
    font-size: 13px;
    color: #e53e3e;
}

.wcdf-card-errors:empty {
    display: none;
    padding: 0;
}

/* ============================================
   FIELD ROWS (side by side)
   ============================================ */
.wcdf-field-row {
    display: flex;
    gap: 16px;
}

.wcdf-field-half {
    flex: 1;
}

/* ============================================
   SUCCESS STATE
   ============================================ */
.wcdf-step-success {
    text-align: center;
    padding: 48px 28px;
}

.wcdf-success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.wcdf-success-icon {
    color: #38a169;
    margin-bottom: 8px;
}

.wcdf-success-icon svg {
    width: 72px;
    height: 72px;
}

.wcdf-success-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wcdf-text);
    margin: 0;
}

.wcdf-success-message {
    font-size: 15px;
    color: var(--wcdf-text-muted);
    margin: 0;
    max-width: 320px;
}

.wcdf-success-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--wcdf-primary);
    margin: 8px 0 0;
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
.wcdf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
    border-radius: 12px;
}

.wcdf-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--wcdf-primary);
    border-radius: 50%;
    animation: wcdf-spin 0.8s linear infinite;
}

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

.wcdf-loading p {
    font-size: 14px;
    color: var(--wcdf-text-muted);
    margin: 0;
}

/* ============================================
   ERROR MESSAGE
   ============================================ */
.wcdf-error-message {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: var(--wcdf-radius);
    padding: 14px 20px;
    margin: 16px 28px;
    font-size: 14px;
    color: #c53030;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 520px) {
    .wcdf-donation-wrapper {
        max-width: 100%;
    }

    .wcdf-donation-container {
        border-radius: 8px;
        margin: 0 8px;
    }

    .wcdf-step {
        padding: 24px 20px 20px;
    }

    .wcdf-step-header {
        padding: 16px 20px 0;
    }

    .wcdf-input,
    .wcdf-select {
        padding: 14px 14px;
        font-size: 15px;
    }

    .wcdf-freq-btn {
        padding: 14px 16px;
        font-size: 15px;
    }

    .wcdf-amount-btn {
        padding: 14px 16px;
        font-size: 16px;
    }

    .wcdf-btn {
        padding: 16px 20px;
        font-size: 16px;
    }

    .wcdf-field-row {
        flex-direction: column;
        gap: 0;
    }

    .wcdf-summary-box {
        padding: 16px 18px;
    }
}
