/* ============================================================
   Westcan Item Filter Plugin  –  v0.2
   Palette: #B11F28 (brand red) · #111 (text) · #F5F5F5 (bg)
   ============================================================ */

/* ── wrapper ─────────────────────────────────────────────── */
#ifp-wrapper {
    font-family: 'Segoe UI', Arial, sans-serif;
    color: #111111;
}

/* ── top bar ─────────────────────────────────────────────── */
#ifp-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 10px;
    gap: 12px;
    flex-wrap: wrap;
}

.ifp-divider {
    height: 1px;
    background: #D0D0D0;
    margin-bottom: 20px;
}

/* ── breadcrumb ──────────────────────────────────────────── */
.ifp-breadcrumb {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.ifp-breadcrumb span {
    color: #B11F28;
    cursor: pointer;
    transition: color 0.15s;
}
.ifp-breadcrumb span:hover {
    color: #111;
    text-decoration: underline;
}
.ifp-breadcrumb .current-breadcrumb {
    color: #111;
    font-weight: 700;
    cursor: default;
    text-decoration: none;
}

/* ── sort bar ────────────────────────────────────────────── */
.ifp-sort-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sort-label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}
.sort-select {
    font-size: 13px;
    font-family: inherit;
    border: 1px solid #D0D0D0;
    border-radius: 4px;
    padding: 6px 10px;
    background: #fff;
    color: #111;
    cursor: pointer;
    transition: border-color 0.15s;
}
.sort-select:focus {
    outline: none;
    border-color: #B11F28;
}

/* ── card grid (shared by categories + subcategories) ────── */
.ifp-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    padding: 0 0 24px;
}

/* ── base card ───────────────────────────────────────────── */
.ifp-card {
    background: #fff;
    border: 1px solid #D0D0D0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}
.ifp-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    border-color: #B11F28;
}

/* image area */
.card-image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F5F5;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
}
.card-image-wrap .category-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* SVG placeholder */
.category-placeholder {
    width: 64px;
    height: 64px;
    color: #B11F28;
    opacity: 0.35;
    display: flex;
    align-items: center;
    justify-content: center;
}
.category-placeholder svg {
    width: 100%;
    height: 100%;
}
/* Red-tint placeholder bg on hover */
.ifp-card:hover .card-image-wrap {
    background: #FFF5F5;
}
.ifp-card:hover .category-placeholder {
    opacity: 0.6;
}

/* card label — ALWAYS visible */
.card-label {
    padding: 12px 14px 14px;
    background: #fff;
    border-top: 1px solid #EBEBEB;
    flex-shrink: 0;
}
.card-label h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #111;
    text-align: center;
    line-height: 1.3;
}
.ifp-card:hover .card-label h3 {
    color: #B11F28;
}

/* ── vehicle-fit filter panel ────────────────────────────── */
#ifp-fit-panel {
    background: #fff;
    border: 1px solid #D0D0D0;
    border-left: 4px solid #B11F28;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.fit-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.fit-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.fit-panel-title svg {
    color: #B11F28;
    flex-shrink: 0;
}

.fit-clear-btn {
    font-size: 12px;
    font-family: inherit;
    color: #B11F28;
    background: transparent;
    border: 1px solid #B11F28;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.fit-clear-btn:hover {
    background: #B11F28;
    color: #fff;
}

.fit-filter-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    row-gap: 14px;
}

.fit-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.fit-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
}

.fit-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.fit-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-family: inherit;
    padding: 4px 10px;
    border: 1px solid #D0D0D0;
    border-radius: 20px;
    background: #F5F5F5;
    color: #333;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}
.fit-chip:hover {
    border-color: #B11F28;
    color: #B11F28;
}
.fit-chip.active {
    background: #B11F28;
    border-color: #B11F28;
    color: #fff;
}
.fit-chip input[type="checkbox"] {
    display: none; /* visual state driven by .active class */
}

/* ── product count ───────────────────────────────────────── */
.ifp-product-count {
    font-size: 13px;
    color: #555;
    margin-bottom: 14px;
}
.ifp-product-count strong {
    color: #111;
}

/* ── product grid ────────────────────────────────────────── */
.ifp-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 24px;
}

/* ── product card ────────────────────────────────────────── */
.ifp-product-card {
    background: #fff;
    border: 1px solid #D0D0D0;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    position: relative;
}
.ifp-product-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    transform: translateY(-2px);
    border-color: #B11F28;
}
.ifp-product-card.ifp-hidden {
    display: none !important;
}

.ifp-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ifp-product-image {
    background: #F5F5F5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 160px;
}
.ifp-product-image .img-item {
    width: 100%;
    max-height: 140px;
    object-fit: contain;
}

.ifp-product-info {
    padding: 12px 14px;
    flex: 1;
}
.ifp-product-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin: 0 0 5px;
    line-height: 1.35;
}
.ifp-product-sku {
    font-size: 12px;
    color: #888;
    margin: 0 0 8px;
}

/* fit tags on product card */
.ifp-fit-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.ifp-fit-tag {
    font-size: 10px;
    padding: 2px 7px;
    background: #FFF0F0;
    color: #B11F28;
    border: 1px solid #F5C6C8;
    border-radius: 10px;
    white-space: nowrap;
}

/* view button — slides in on hover */
.ifp-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: #B11F28;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s, transform 0.2s;
}
.ifp-product-card:hover .ifp-view-btn {
    opacity: 1;
    transform: translateY(0);
}

/* ── loading spinner ─────────────────────────────────────── */
#loading-spinner {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}
.ifp-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid #E0E0E0;
    border-top-color: #B11F28;
    border-radius: 50%;
    animation: ifp-spin 0.8s linear infinite;
}
@keyframes ifp-spin {
    to { transform: rotate(360deg); }
}

/* ── no-results ──────────────────────────────────────────── */
.ifp-no-results {
    text-align: center;
    color: #888;
    padding: 40px 0;
    font-size: 15px;
}

/* ── responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    .ifp-card-grid,
    .ifp-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
    }
    #ifp-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .fit-filter-groups {
        gap: 14px;
    }
}
