/**
 * Multi-Step Form Styles
 *
 * @since 1.8.10
 */

/* Header Row Container - combines step header, progress, and navigation on one line */
.charitable-multistep-header-row {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e5e5;
    flex-wrap: wrap;
}

/* Hide header row when there's only one step */
.charitable-multistep-header-row:has(.charitable-multistep-progress[aria-valuemax="1"]) {
    display: none;
}

/* Alternative: Hide when there's only one step header visible */
.charitable-multistep-header-row:has(.charitable-multistep-step-headers > .charitable-multistep-step-header:only-child) {
    display: none;
}

/* When only navigation is visible (progress bar and step titles hidden), make it full width */
.charitable-multistep-header-row:has(> .charitable-multistep-navigation:only-child) {
    justify-content: flex-end;
}

/* Fallback for browsers that don't support :has() */
.charitable-multistep-header-row > .charitable-multistep-navigation:only-child {
    margin-left: auto;
}

/* Step Headers Container */
.charitable-multistep-step-headers {
    flex: 0 0 auto;
}

/* Progress Indicator */
.charitable-multistep-progress {
    flex: 1 1 auto;
    margin: 20px 0 0 0;
    padding: 0;
    border-bottom: none;
}

.charitable-multistep-progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e5e5e5;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.charitable-multistep-progress-fill {
    height: 100%;
    background-color: var(--charitable-button-bg, #0073aa);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.charitable-multistep-progress-text {
    text-align: center;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.66);
    font-weight: 500;
}

.charitable-multistep-progress-text .charitable-multistep-step-current {
    font-size: 14px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.66);
}

.charitable-multistep-progress-text .charitable-multistep-step-total {
    color: rgba(0, 0, 0, 0.66);
}

/* Progress Bar Dots Style */
.charitable-multistep-progress-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
}

.charitable-multistep-progress-dots-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.charitable-multistep-progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #e5e5e5;
    border: 2px solid #e5e5e5;
    transition: all 0.3s ease;
    cursor: pointer;
    outline: none;
}

.charitable-multistep-progress-dot.active {
    background-color: var(--charitable-button-bg, #0073aa);
    border-color: var(--charitable-button-bg, #0073aa);
    transform: scale(1.2);
}

.charitable-multistep-progress-dot:hover {
    border-color: var(--charitable-button-bg, #0073aa);
    transform: scale(1.1);
}

.charitable-multistep-progress-dot:focus {
    outline: 2px solid var(--charitable-button-bg, #0073aa);
    outline-offset: 2px;
}

.charitable-multistep-progress-dot.active:hover {
    transform: scale(1.3);
}

/* Fields Container */
.charitable-multistep-fields-container {
    position: relative;
    min-height: 300px;
}

/* Individual Fields - Hidden by default, shown via JS */
.charitable-multistep-field {
    display: none;
}

.charitable-multistep-field-visible {
    display: block;
    animation: fadeIn 0.3s ease;
}


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

/* Step Header */
.charitable-multistep-step-header {
    margin: 0;
}

.charitable-multistep-step-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #333;
    line-height: 1.2;
}

/* Step Content */
.charitable-multistep-step-content {
    margin-bottom: 30px;
}

/* Navigation Buttons */
.charitable-multistep-navigation {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
}

/* When navigation is the only child in header-row, make it take full width for proper alignment */
.charitable-multistep-header-row > .charitable-multistep-navigation:only-child {
    flex: 1 1 auto;
    width: 100%;
}

/* Button Alignment Classes */
.charitable-multistep-navigation.align-left {
    justify-content: flex-start;
}

.charitable-multistep-navigation.align-centered {
    justify-content: center;
}

.charitable-multistep-navigation.align-right {
    justify-content: flex-end;
}

.charitable-multistep-navigation.align-full-width {
    width: 100%;
}

.charitable-multistep-navigation.align-full-width .charitable-multistep-button {
    flex: 1;
    text-align: center;
}

/* Footer Navigation Row */
.charitable-multistep-footer-row {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
}

/* Hide footer row when there's only one step (check parent form for single step) */
.charitable-form-multistep:has(.charitable-multistep-progress[aria-valuemax="1"]) .charitable-multistep-footer-row,
.charitable-form-multistep:has(.charitable-multistep-step-headers > .charitable-multistep-step-header:only-child) .charitable-multistep-footer-row {
    display: none;
}

.charitable-multistep-footer-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Apply alignment classes to footer navigation as well */
.charitable-multistep-footer-navigation.align-left {
    justify-content: flex-start;
}

.charitable-multistep-footer-navigation.align-centered {
    justify-content: center;
}

.charitable-multistep-footer-navigation.align-right {
    justify-content: flex-end;
}

.charitable-multistep-footer-navigation.align-full-width {
    width: 100%;
}

.charitable-multistep-footer-navigation.align-full-width .charitable-multistep-button {
    flex: 1;
    text-align: center;
}

.charitable-multistep-button {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    white-space: nowrap;
}

.charitable-multistep-button-prev {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
}

.charitable-multistep-button-prev:hover {
    background-color: #e5e5e5;
    color: #000;
    border: 1px solid #ccc;
}

.charitable-multistep-button-next {
    background-color: #0073aa;
    color: #fff;
    margin-left: 0;
}

.charitable-multistep-button-next:hover {
    background-color: #005a87;
}

.charitable-multistep-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Submit Button Container */
.charitable-multistep-submit {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e5e5;
    text-align: center;
}

/* Visual form donate button alignment (applies to single and multistep submit) */
.charitable-visual-donation-form.donate-align-left .charitable-submit-field,
.charitable-visual-donation-form.donate-align-right .charitable-submit-field,
.charitable-visual-donation-form.donate-align-center .charitable-submit-field {
    display: flex;
}
.charitable-visual-donation-form.donate-align-left .charitable-submit-field { justify-content: flex-start; }
.charitable-visual-donation-form.donate-align-right .charitable-submit-field { justify-content: flex-end; }
.charitable-visual-donation-form.donate-align-center .charitable-submit-field { justify-content: center; }

.charitable-visual-donation-form.donate-width-full .charitable-submit-field .donate-button,
.charitable-visual-donation-form.donate-width-half .charitable-submit-field .donate-button {
    width: 100%;
}
.charitable-visual-donation-form.donate-width-half .charitable-submit-field {
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 600px) {
    .charitable-visual-donation-form.donate-width-half .charitable-submit-field {
        max-width: 100%;
    }
}

/* Field Error States */
.charitable-multistep-step .charitable-field-error {
    border-color: #dc3232 !important;
    box-shadow: 0 0 2px rgba(220, 50, 50, 0.3) !important;
}

.charitable-field-error-message {
    display: block;
    color: #dc3232;
    font-size: 13px;
    margin-top: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Stack header row elements vertically on mobile */
    .charitable-multistep-header-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .charitable-multistep-step-headers {
        min-width: auto;
        width: 100%;
    }

    .charitable-multistep-step-title {
        font-size: 18px;
    }

    .charitable-multistep-progress {
        min-width: auto;
        width: 100%;
        order: 2;
    }

    .charitable-multistep-navigation {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        order: 3;
    }

    .charitable-multistep-button {
        width: 100%;
    }

    .charitable-multistep-button-next {
        order: -1;
    }
}

/* Form-specific adjustments */
.charitable-form-multistep .charitable-form-fields {
    padding: 0;
}

.charitable-form-multistep .charitable-fieldset {
    margin-bottom: 20px;
}

