/**
 * Vehicle Fitment Filter — Frontend Styles
 *
 * Theme-neutral, clean styles. Override in your child theme as needed.
 * Mobile-first: compact collapsible on small screens, full layout on desktop.
 *
 * @package VehicleFitmentFilter
 */

/* ── Reset / Box Sizing ──────────────────────────────────────────────────── */

.vff-filter-widget *,
.vff-filter-widget *::before,
.vff-filter-widget *::after {
    box-sizing: border-box;
}

/* ── Widget Wrapper ──────────────────────────────────────────────────────── */

.vff-filter-widget {
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 6px;
    margin-bottom: 24px;
    overflow: hidden;
}

/* ── Mobile Toggle Bar (visible on mobile only) ──────────────────────────── */

.vff-mobile-toggle {
    display: none;
    width: 100% !important;
    min-width: 100% !important;
    padding: 13px 16px !important;
    background: #2271b1 !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    cursor: pointer !important;
    text-align: left !important;
    letter-spacing: 0.02em;
    transition: background 0.15s;
    /* flex set in media query */
}

.vff-mobile-toggle:hover,
.vff-mobile-toggle:focus {
    background: #135e96 !important;
    color: #fff !important;
    outline: none;
}

.vff-mobile-toggle .vff-toggle-label {
    flex: 1;
}

.vff-mobile-toggle .vff-toggle-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-style: normal;
    font-size: 12px;
    margin-left: 8px;
    flex-shrink: 0;
}

.vff-filter-widget.vff-open .vff-toggle-icon {
    transform: rotate(180deg);
}

/* ── Filter Body ─────────────────────────────────────────────────────────── */

.vff-filter-body {
    padding: 16px 20px 20px;
}

/* ── Labels ──────────────────────────────────────────────────────────────── */

.vff-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #3c434a;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Selects ─────────────────────────────────────────────────────────────── */

.vff-field select {
    width: 100%;
    padding: 8px 30px 8px 10px;
    font-size: 14px;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    background-color: #fff;
    color: #2c3338;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    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 fill='%23999' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.vff-field select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
    outline: none;
}

.vff-field select:disabled {
    background-color: #f0f0f1;
    color: #a7aaad;
    cursor: not-allowed;
    opacity: 0.7;
}

/* ── Horizontal Layout (desktop default) ─────────────────────────────────── */

.vff-layout-horizontal .vff-filter-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.vff-layout-horizontal .vff-field {
    flex: 1 1 130px;
    min-width: 110px;
}

.vff-layout-horizontal .vff-filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    padding-bottom: 1px;
}

/* ── Vertical Layout ─────────────────────────────────────────────────────── */

.vff-layout-vertical .vff-filter-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vff-layout-vertical .vff-field {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vff-layout-vertical .vff-field label {
    min-width: 80px;
    text-align: right;
    margin-bottom: 0;
}

.vff-layout-vertical .vff-filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-left: 92px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.vff-filter-actions {
    margin-top: 14px;
}

.vff-btn-find,
.vff-btn-reset {
    display: inline-block;
    padding: 9px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.4;
    text-align: center;
    border: 2px solid transparent;
    white-space: nowrap;
}

.vff-btn-find {
    background: #2271b1;
    color: #fff;
    border-color: #2271b1;
}
.vff-btn-find:hover,
.vff-btn-find:focus {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

.vff-btn-reset {
    background: #fff;
    color: #50575e;
    border-color: #c3c4c7;
}
.vff-btn-reset:hover,
.vff-btn-reset:focus {
    background: #f0f0f1;
    border-color: #8c8f94;
    color: #2c3338;
}

.vff-btn-find.vff-loading {
    opacity: 0.7;
    cursor: wait;
}

/* ── Results Info Bar ────────────────────────────────────────────────────── */

.vff-results-info {
    margin-top: 12px;
    font-size: 13px;
    color: #50575e;
    padding: 7px 12px;
    background: #e8f4fd;
    border-left: 3px solid #2271b1;
    border-radius: 2px;
}

/* ── No Results ──────────────────────────────────────────────────────────── */

.vff-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #8c8f94;
    font-style: italic;
    font-size: 15px;
}

/* ── Products Loading Overlay ────────────────────────────────────────────── */

.vff-products-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
}

.vff-products-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid #e0e0e0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: vff-spin 0.8s linear infinite;
}

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

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media ( max-width: 768px ) {

    /* Show the toggle bar */
    .vff-mobile-toggle {
        display: -webkit-box !important;
        display: -ms-flexbox !important;
        display: flex !important;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center !important;
        -webkit-box-pack: justify;
        -ms-flex-pack: justify;
        justify-content: space-between !important;
    }

    /* Widget: no padding, tight margin */
    .vff-filter-widget {
        margin-bottom: 12px !important;
        padding: 0 !important;
    }

    /* Hide body by default */
    .vff-filter-body {
        display: none !important;
        padding: 10px 12px 12px !important;
    }

    /* Show when open */
    .vff-filter-widget.vff-open .vff-filter-body {
        display: block !important;
    }

    /* Kill theme margins/padding on all child elements */
    .vff-filter-body * {
        box-sizing: border-box !important;
    }

    /* Fields: no gap, tight spacing */
    .vff-layout-horizontal .vff-filter-fields,
    .vff-layout-vertical .vff-filter-fields {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .vff-layout-horizontal .vff-field,
    .vff-layout-vertical .vff-field {
        display: block !important;
        width: 100% !important;
        margin: 0 0 8px 0 !important;
        padding: 0 !important;
        float: none !important;
    }

    /* Labels: tight and small */
    .vff-filter-widget .vff-field label {
        display: block !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        margin: 0 0 3px 0 !important;
        padding: 0 !important;
        line-height: 1.2 !important;
    }

    /* Selects: full width, no zoom on iOS */
    .vff-filter-widget .vff-field select {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 9px 30px 9px 10px !important;
        font-size: 16px !important;
        height: auto !important;
        margin: 0 !important;
        line-height: 1.3 !important;
    }

    /* Buttons: stacked, full width */
    .vff-layout-horizontal .vff-filter-actions,
    .vff-layout-vertical .vff-filter-actions {
        display: block !important;
        margin: 8px 0 0 0 !important;
        padding: 0 !important;
    }

    .vff-filter-widget .vff-btn-find,
    .vff-filter-widget .vff-btn-reset {
        display: block !important;
        width: 100% !important;
        margin: 0 0 6px 0 !important;
        padding: 11px !important;
        font-size: 15px !important;
        text-align: center !important;
    }

    /* Results bar */
    .vff-results-info {
        margin-top: 8px !important;
        font-size: 12px !important;
    }
}

/* ── Small phones ────────────────────────────────────────────────── */

/* ── Small phones ────────────────────────────────────────────────────────── */

@media ( max-width: 480px ) {
    .vff-filter-body {
        padding: 10px 12px 14px;
    }

    .vff-field label {
        font-size: 11px;
    }
}
