/*
 * Colours are approximated from a screenshot of the live theme, not
 * pulled from its actual stylesheet — close, not exact, per the call
 * made when this was built. Adjust these three variables first if
 * anything looks off; the rest of this file just references them.
 */
.wbf-search-widget,
.wbf-freetext-form {
    --wbf-accent: #c1440e;      /* burnt-orange, matches the nav's active-tab colour */
    --wbf-dark: #2b2b2b;        /* charcoal nav background */
    --wbf-light: #ffffff;
    --wbf-muted: #8a8a8a;
    --wbf-border: #d8d8d8;
}

.wbf-search-widget {
    max-width: 720px;
    margin: 0 0 16px;
    border: 1px solid var(--wbf-border);
    border-radius: 4px;
    overflow: hidden;
}
.wbf-search-widget-title {
    background: var(--wbf-light);
    color: var(--wbf-dark);
    font-weight: 700;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 14px 20px;
    border-bottom: 3px solid var(--wbf-accent);
}
.wbf-search-widget-body {
    background: var(--wbf-dark);
    padding: 18px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.wbf-search-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1 1 auto;
}
.wbf-w-select {
    padding: 9px 12px;
    border: none;
    border-radius: 3px;
    background: var(--wbf-light);
    color: var(--wbf-dark);
    min-width: 150px;
    flex: 1 1 150px;
}
.wbf-w-select:disabled {
    background: #cfcfcf;
    color: #6b6b6b;
    cursor: not-allowed;
}
.wbf-search-btn {
    background: var(--wbf-accent);
    color: var(--wbf-light);
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 11px 28px;
    border-radius: 3px;
    cursor: pointer;
    flex: 0 0 auto;
}
.wbf-search-btn:hover { opacity: 0.9; }

.wbf-freetext-form {
    max-width: 720px;
    margin: 0 0 32px;
    display: flex;
    border: 1px solid var(--wbf-border);
    border-radius: 4px;
    overflow: hidden;
}
.wbf-freetext-input-wrap {
    position: relative;
    flex: 1 1 auto;
    display: flex;
}
.wbf-freetext-input {
    flex: 1 1 auto;
    border: none;
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    width: 100%;
}
.wbf-freetext-input:focus { outline: none; }
.wbf-freetext-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--wbf-muted, #8a8a8a);
    cursor: pointer;
    padding: 4px 6px;
}
.wbf-freetext-clear:hover { color: var(--wbf-dark, #2b2b2b); }
.wbf-freetext-btn {
    background: var(--wbf-dark);
    color: var(--wbf-light);
    border: none;
    padding: 0 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.wbf-freetext-btn:hover { background: var(--wbf-accent); }
.wbf-freetext-btn .dashicons { font-size: 18px; }

.wbf-search-error {
    background: #fdecec;
    color: #a00;
    padding: 10px 14px;
    margin: 0;
    font-size: 13px;
}

.wbf-sort-row {
    max-width: 720px;
    margin: 0 0 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.wbf-sort-row label {
    font-size: 13px;
    color: var(--wbf-dark, #2b2b2b);
    font-weight: 600;
}
.wbf-sort-row .wbf-w-select {
    min-width: 180px;
    flex: 0 0 auto;
    border: 1px solid var(--wbf-border, #d8d8d8);
}

.wbf-loop-year {
    font-size: 12px;
    color: var(--wbf-muted, #8a8a8a);
    text-align: center;
    margin: 4px 0 2px;
}

.wbf-loop-part-number {
    font-size: 12px;
    color: var(--wbf-muted, #8a8a8a);
    text-align: center;
    margin: 0 0 4px;
}

.wbf-product-part-number {
    font-size: 14px;
    margin: 0 0 12px;
}

.wbf-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 24px 0;
}
.wbf-pagination-prev,
.wbf-pagination-next {
    background: none;
    border: 1px solid var(--wbf-border, #d8d8d8);
    color: var(--wbf-dark, #2b2b2b);
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}
.wbf-pagination-prev:hover:not(:disabled),
.wbf-pagination-next:hover:not(:disabled) {
    background: var(--wbf-dark, #2b2b2b);
    color: #fff;
}
.wbf-pagination-prev:disabled,
.wbf-pagination-next:disabled {
    opacity: 0.4;
    cursor: default;
}
.wbf-pagination-info { font-size: 13px; color: var(--wbf-muted, #8a8a8a); }

.wbf-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: #f5f5f5;
    border-left: 4px solid var(--wbf-accent, #c1440e);
    border-radius: 3px;
}
.wbf-results-count { font-weight: 600; }
.wbf-results-clear {
    background: none;
    border: 1px solid var(--wbf-dark, #2b2b2b);
    color: var(--wbf-dark, #2b2b2b);
    padding: 6px 14px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
}
.wbf-results-clear:hover { background: var(--wbf-dark, #2b2b2b); color: #fff; }
.wbf-searching { color: #666; font-style: italic; padding: 12px 0; }
.wbf-search-error-msg { color: #a00; padding: 12px 0; }
#wbf-search-results { margin-bottom: 24px; }

.wbf-back-to-search-link {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--wbf-accent, #c1440e);
    text-decoration: none;
}
.wbf-back-to-search-link:hover { text-decoration: underline; }

/* Deliberately no card/grid styling below this point — the actual
   product tiles come from wc_get_template_part('content','product'),
   which already inherits the theme's real product-card look. Adding
   competing CSS here would fight that, not complement it. */

@media (max-width: 768px) {
    /* Tablet — widget containers already cap at 720px so they fit
       most tablets without changes; the sort/pagination rows are the
       two places with fixed-width children that can start feeling
       cramped before a phone-sized screen is reached. */
    .wbf-sort-row { justify-content: space-between; }
    .wbf-sort-row .wbf-w-select { min-width: 140px; flex: 1 1 auto; }
    .wbf-pagination { flex-wrap: wrap; }
}

@media (max-width: 640px) {
    .wbf-search-widget-body { flex-direction: column; align-items: stretch; }
    .wbf-search-row { flex-direction: column; }
    .wbf-search-btn { width: 100%; }

    .wbf-sort-row { flex-direction: column; align-items: stretch; }
    .wbf-sort-row label { margin-bottom: 4px; }
    .wbf-sort-row .wbf-w-select { width: 100%; min-width: 0; }

    .wbf-freetext-form { flex-direction: column; }
    .wbf-freetext-btn { width: 100%; justify-content: center; padding: 12px 0; }

    .wbf-results-header { flex-direction: column; align-items: stretch; text-align: center; }
    .wbf-results-clear { width: 100%; }

    /* "Page X of Y" above the buttons rather than squeezed between them —
       clearer than the desktop's Prev-info-Next order once everything's
       narrow enough to stack. */
    .wbf-pagination { flex-wrap: wrap; }
    .wbf-pagination-info { order: -1; width: 100%; text-align: center; }
    .wbf-pagination-prev,
    .wbf-pagination-next { flex: 1 1 0; text-align: center; }
}
