/* ==========================================================================
   Multi-Step WooCommerce Filter — Front-end styles
   All selectors scoped under .mswf-wizard to avoid theme conflicts
   ========================================================================== */

/* Design tokens — overridden per-wizard via inline <style> */
.mswf-wizard {
    --mswf-primary:   #2563eb;
    --mswf-secondary: #1e40af;
    --mswf-accent:    #3b82f6;
    --mswf-bg:        #ffffff;
    --mswf-text:      #1e293b;
    --mswf-font:      inherit;
    --mswf-radius:    0.5rem;
    --mswf-shadow:    0 2px 12px rgba(0,0,0,.08);
    --mswf-transition:250ms ease;

    font-family: var(--mswf-font);
    color: var(--mswf-text);
    background: var(--mswf-bg);
    position: relative;
    max-width: 860px;
    margin: 0 auto;
    padding: 2rem;
    border-radius: var(--mswf-radius);
    box-shadow: var(--mswf-shadow);
    box-sizing: border-box;
}

.mswf-wizard *,
.mswf-wizard *::before,
.mswf-wizard *::after {
    box-sizing: inherit;
}

/* ---- Loading overlay ---- */
.mswf-wizard__loading {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.75);
    z-index: 10;
    align-items: center;
    justify-content: center;
}

.mswf-wizard__loading-results {
    display: flex;
    justify-content: center;
    padding: 3rem;
}

.mswf-wizard__spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--mswf-accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: mswf-spin .6s linear infinite;
}

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

/* ---- Progress ---- */
.mswf-wizard__progress {
    margin-bottom: 1.5rem;
}

.mswf-wizard__step-counter {
    font-size: .875rem;
    color: var(--mswf-text);
    opacity: .7;
    margin-bottom: .5rem;
}

.mswf-wizard__progress-bar-track {
    height: 6px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}

.mswf-wizard__progress-bar-fill {
    height: 100%;
    background: var(--mswf-primary);
    border-radius: 99px;
    transition: width var(--mswf-transition);
}

/* ---- Question ---- */
.mswf-wizard__step {
    margin-bottom: 1.5rem;
}

.mswf-wizard__question-text {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 .5rem;
    color: var(--mswf-text);
}

.mswf-wizard__question-desc {
    color: var(--mswf-text);
    opacity: .7;
    margin: 0 0 1.25rem;
}

/* ---- Options: radio/checkbox ---- */
.mswf-wizard__options {
    display: flex;
    flex-direction: column;
    gap: .625rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mswf-wizard__options--radio,
.mswf-wizard__options--checkbox {
    flex-direction: column;
}

.mswf-wizard__option {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--mswf-radius);
    cursor: pointer;
    transition: border-color var(--mswf-transition), background var(--mswf-transition);
    font-weight: 500;
}

.mswf-wizard__option:hover,
.mswf-wizard__option:focus-within {
    border-color: var(--mswf-accent);
    background: rgba(37,99,235,.04);
}

.mswf-wizard__option.is-selected {
    border-color: var(--mswf-primary);
    background: rgba(37,99,235,.08);
}

.mswf-wizard__option input[type=radio],
.mswf-wizard__option input[type=checkbox] {
    margin-top: .125rem;
    accent-color: var(--mswf-primary);
    flex-shrink: 0;
}

.mswf-wizard__option-copy {
    flex: 1;
    min-width: 0;
}

.mswf-wizard__option-copy--split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.mswf-wizard__option-copy--single {
    display: block;
}

.mswf-wizard__option-text {
    display: block;
    min-width: 0;
}

.mswf-wizard__option-desc {
    display: block;
    font-size: .8125rem;
    font-weight: 400;
    opacity: .7;
    min-width: 0;
}

/* ---- Image options ---- */
.mswf-wizard__options--image {
    flex-direction: row;
    flex-wrap: wrap;
    gap: .875rem;
}

.mswf-wizard__option--image {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
    min-width: 100px;
    flex: 0 1 calc(25% - .875rem);
}

.mswf-wizard__option--image input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mswf-wizard__option-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: calc(var(--mswf-radius) / 2);
    margin-bottom: .5rem;
}

.mswf-wizard__option-swatch {
    display: block;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin: 0 auto .5rem;
    border: 2px solid rgba(0,0,0,.1);
}

/* ---- Dropdown ---- */
.mswf-wizard__dropdown-wrap {
    position: relative;
}

.mswf-wizard__dropdown {
    width: 100%;
    padding: .75rem 2.5rem .75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--mswf-radius);
    font-size: 1rem;
    font-family: var(--mswf-font);
    color: var(--mswf-text);
    background: var(--mswf-bg);
    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='M6 8L0 0h12z' fill='%231e293b'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: border-color var(--mswf-transition);
}

.mswf-wizard__dropdown:focus {
    border-color: var(--mswf-primary);
    outline: none;
}

/* ---- Range slider ---- */
.mswf-wizard__range-wrap {
    padding: 1rem 0;
}

.mswf-wizard__range-display {
    display: flex;
    gap: .5rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--mswf-primary);
}

.mswf-wizard__range {
    width: 100%;
    margin: .5rem 0;
    accent-color: var(--mswf-primary);
}

/* ---- Text input ---- */
.mswf-wizard__text-input {
    width: 100%;
    padding: .75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--mswf-radius);
    font-size: 1rem;
    font-family: var(--mswf-font);
    color: var(--mswf-text);
    background: var(--mswf-bg);
    transition: border-color var(--mswf-transition);
}

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

/* ---- Navigation buttons ---- */
.mswf-wizard__nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.mswf-wizard__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .75rem 1.5rem;
    border: none;
    border-radius: var(--mswf-radius);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--mswf-font);
    cursor: pointer;
    transition: background var(--mswf-transition), opacity var(--mswf-transition);
    text-decoration: none;
}

.mswf-wizard__btn--next,
.mswf-wizard__btn--start,
.mswf-wizard__btn--results,
.mswf-wizard__btn--view-results {
    background: var(--mswf-primary);
    color: #fff;
    margin-left: auto;
}

.mswf-wizard__btn--next:hover,
.mswf-wizard__btn--start:hover,
.mswf-wizard__btn--results:hover {
    background: var(--mswf-secondary);
    color: #fff;
}

.mswf-wizard__btn--back {
    background: #f1f5f9;
    color: var(--mswf-text);
}

.mswf-wizard__btn--back:hover {
    background: #e2e8f0;
}

.mswf-wizard__btn--skip {
    background: none;
    color: var(--mswf-text);
    opacity: .6;
    text-decoration: underline;
    padding: .75rem .5rem;
}

.mswf-wizard__btn--startover {
    background: #f1f5f9;
    color: var(--mswf-text);
}

.mswf-wizard__btn-edit {
    font-size: .8125rem;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--mswf-primary);
    padding: 0;
    margin-left: .5rem;
}

/* ---- Validation error ---- */
.mswf-wizard__validation {
    margin-top: .75rem;
    padding: .625rem 1rem;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: var(--mswf-radius);
    font-size: .875rem;
}

/* ---- Intro ---- */
.mswf-wizard__intro {
    text-align: center;
    padding: 1rem 0;
}

.mswf-wizard__intro-return {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.mswf-wizard__intro-return-text {
    margin: 0 0 .75rem;
    color: var(--mswf-text);
    opacity: .72;
}

.mswf-wizard__btn--return-results {
    background: #f1f5f9;
    color: var(--mswf-text);
}

.mswf-wizard__btn--return-results:hover {
    background: #e2e8f0;
}

/* ---- Summary ---- */
.mswf-wizard__summary {
    padding: 0;
}

.mswf-wizard__summary h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.mswf-wizard__summary-list {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.mswf-wizard__summary-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem;
    background: #f8fafc;
    border-radius: var(--mswf-radius);
    flex-wrap: wrap;
}

.mswf-wizard__summary-q {
    font-weight: 600;
    flex: 1;
}

.mswf-wizard__summary-a {
    color: var(--mswf-primary);
}

/* ---- Results ---- */
.mswf-wizard__results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: .75rem;
}

.mswf-wizard__results-count {
    font-weight: 600;
}

.mswf-wizard__results-sort {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .875rem;
}

.mswf-wizard__sort-select {
    padding: .375rem .75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--mswf-radius);
    font-size: .875rem;
    background: var(--mswf-bg);
    color: var(--mswf-text);
}

.mswf-wizard__results-copy {
    margin: 0 0 1.25rem;
}

.mswf-wizard__results-title {
    margin: 0 0 .5rem;
    font-size: 1.6rem;
    line-height: 1.15;
}

.mswf-wizard__results-intro {
    max-width: 62ch;
    color: var(--mswf-text);
    opacity: .78;
    white-space: pre-line;
}

/* ---- Product grid ---- */
.mswf-wizard__products {
    display: grid;
    gap: 1.25rem;
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
}

.mswf-wizard__products--cols-2 { grid-template-columns: repeat(2, 1fr); }
.mswf-wizard__products--cols-3 { grid-template-columns: repeat(3, 1fr); }
.mswf-wizard__products--cols-4 { grid-template-columns: repeat(4, 1fr); }

.mswf-wizard__products--list {
    grid-template-columns: 1fr;
}

.mswf-wizard__products--list .mswf-wizard__card-link {
    flex-direction: row;
    gap: 1rem;
}

.mswf-wizard__products--list .mswf-wizard__card-image-wrap {
    flex: 0 0 120px;
}

.mswf-wizard__card {
    border: 1px solid #e2e8f0;
    border-radius: var(--mswf-radius);
    overflow: hidden;
    transition: box-shadow var(--mswf-transition);
}

.mswf-wizard__card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
}

.mswf-wizard__card-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--mswf-text);
    height: 100%;
}

.mswf-wizard__card-image-wrap img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.mswf-wizard__card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: .75rem .75rem .25rem;
}

.mswf-wizard__card-price {
    margin: 0 .75rem .5rem;
    font-weight: 600;
    color: var(--mswf-primary);
}

.mswf-wizard__card-excerpt {
    margin: 0 .75rem .5rem;
    font-size: .8125rem;
    opacity: .7;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mswf-wizard__card-rating {
    margin: 0 .75rem .5rem;
    font-size: .875rem;
}

.mswf-star { color: #d1d5db; }
.mswf-star.is-filled { color: #f59e0b; }

.mswf-wizard__card-atc {
    margin: auto .75rem .75rem;
}

.mswf-wizard__card-atc-btn {
    display: inline-block;
    padding: .5rem 1rem;
    background: var(--mswf-primary);
    color: #fff;
    border-radius: var(--mswf-radius);
    font-size: .875rem;
    font-weight: 600;
    text-align: center;
}

/* ---- Results style presets ---- */
.mswf-wizard--results-editorial .mswf-wizard__results-header {
    align-items: end;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.mswf-wizard--results-editorial .mswf-wizard__results-title {
    font-size: 2rem;
    letter-spacing: -.03em;
}

.mswf-wizard--results-editorial .mswf-wizard__card {
    border: none;
    border-radius: 1.1rem;
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.96));
    box-shadow: 0 20px 40px rgba(15, 23, 42, .08);
}

.mswf-wizard--results-editorial .mswf-wizard__card-title {
    font-size: 1.1rem;
    margin: 1rem 1rem .4rem;
}

.mswf-wizard--results-editorial .mswf-wizard__card-price {
    margin: 0 1rem .75rem;
}

.mswf-wizard--results-editorial .mswf-wizard__card-atc {
    margin: auto 1rem 1rem;
}

.mswf-wizard--results-soft {
    background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.mswf-wizard--results-soft .mswf-wizard__results-copy {
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    background: rgba(255,255,255,.82);
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .18);
}

.mswf-wizard--results-soft .mswf-wizard__card {
    border: 1px solid rgba(148, 163, 184, .2);
    border-radius: 1.1rem;
    background: rgba(255,255,255,.92);
    box-shadow: 0 10px 30px rgba(37, 99, 235, .08);
}

.mswf-wizard--results-soft .mswf-wizard__card-atc-btn {
    border-radius: 999px;
    padding: .6rem 1.1rem;
}

.mswf-wizard--results-compact {
    max-width: 980px;
}

.mswf-wizard--results-compact .mswf-wizard__products {
    gap: .85rem;
}

.mswf-wizard--results-compact .mswf-wizard__card {
    border-radius: .75rem;
}

.mswf-wizard--results-compact .mswf-wizard__card-image-wrap img {
    height: 170px;
}

.mswf-wizard--results-compact .mswf-wizard__card-title {
    font-size: .95rem;
    margin: .65rem .65rem .2rem;
}

.mswf-wizard--results-compact .mswf-wizard__card-price,
.mswf-wizard--results-compact .mswf-wizard__card-excerpt,
.mswf-wizard--results-compact .mswf-wizard__card-rating {
    margin-left: .65rem;
    margin-right: .65rem;
}

.mswf-wizard--results-compact .mswf-wizard__card-atc {
    margin: auto .65rem .65rem;
}

/* ---- No results ---- */
.mswf-wizard__no-results {
    text-align: center;
    padding: 3rem 1rem;
}

.mswf-wizard__no-results p {
    margin-bottom: 1.5rem;
    opacity: .7;
}

/* ---- Pagination ---- */
.mswf-wizard__pagination {
    margin: 1rem 0;
}

.mswf-wizard__pagination ul {
    display: flex;
    gap: .375rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.mswf-wizard__page-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 .5rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--mswf-radius);
    background: var(--mswf-bg);
    color: var(--mswf-text);
    font-size: .875rem;
    cursor: pointer;
    transition: background var(--mswf-transition), border-color var(--mswf-transition);
}

.mswf-wizard__page-btn:hover,
.mswf-wizard__page-btn.is-active {
    background: var(--mswf-primary);
    border-color: var(--mswf-primary);
    color: #fff;
}

/* ---- Results footer ---- */
.mswf-wizard__results-footer {
    margin-top: 1.5rem;
    text-align: center;
}

/* ---- Transitions ---- */
.mswf-wizard__content {
    transition: opacity var(--mswf-transition);
}

.mswf-wizard__match-count {
    margin-top: 1rem;
    padding-top: .875rem;
    border-top: 1px solid #e2e8f0;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--mswf-text);
    opacity: .8;
}

.mswf-wizard__debug {
    margin-top: .75rem;
    padding: .875rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--mswf-radius);
    background: #f8fafc;
    color: #334155;
    font-size: .75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.mswf-transition--slide-next { animation: mswf-slide-in-right 250ms ease both; }
.mswf-transition--slide-prev { animation: mswf-slide-in-left  250ms ease both; }
.mswf-transition--fade-next,
.mswf-transition--fade-prev  { animation: mswf-fade-in 250ms ease both; }

@keyframes mswf-slide-in-right {
    from { opacity: 0; transform: translateX(30px);  }
    to   { opacity: 1; transform: translateX(0);      }
}

@keyframes mswf-slide-in-left {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0);     }
}

@keyframes mswf-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---- Error fallback ---- */
.mswf-wizard-error {
    padding: 1rem;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
    border-radius: var(--mswf-radius);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
    .mswf-wizard {
        padding: 1.25rem;
    }

    .mswf-wizard__option-copy--split {
        grid-template-columns: 1fr;
        gap: .25rem;
    }

    .mswf-wizard__products--cols-2,
    .mswf-wizard__products--cols-3,
    .mswf-wizard__products--cols-4 {
        grid-template-columns: 1fr 1fr;
    }

    .mswf-wizard__option--image {
        flex: 0 1 calc(50% - .875rem);
    }
}

@media (max-width: 420px) {
    .mswf-wizard__products--cols-2,
    .mswf-wizard__products--cols-3,
    .mswf-wizard__products--cols-4 {
        grid-template-columns: 1fr;
    }

    .mswf-wizard__option--image {
        flex: 0 1 100%;
    }

    .mswf-wizard__nav {
        flex-direction: column;
        align-items: stretch;
    }

    .mswf-wizard__btn--next {
        margin-left: 0;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
.mswf-wizard__announcer {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.mswf-wizard *:focus-visible {
    outline: 3px solid var(--mswf-primary);
    outline-offset: 2px;
}
