/* Filter v2 — base styles. Designed to slot into Amaze theme without conflicts.
   Note: the chunk is dropped directly into Bootstrap's `.row` without a `.col-*`
   wrapper. Since .row carries -15px side margins, we add 15px padding here so
   the inner content lines up with the rest of the page (header, breadcrumbs). */
.cv2 {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    font-family: 'Open Sans', sans-serif;
    width: 100%;
    max-width: 100%;
    padding: 0 15px;
    box-sizing: border-box;
}
.cv2 *, .cv2 *::before, .cv2 *::after { box-sizing: border-box; }
.cv2__results { min-width: 0; } /* grid item must allow shrink */
@media (max-width: 768px) {
    .cv2 { grid-template-columns: 1fr; }
}

.cv2__sidebar { background: #fafafa; border: 1px solid #ececec; border-radius: 6px; padding: 16px; position: sticky; top: 16px; }
.cv2__title   { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.cv2__reset   { display: block; width: 100%; padding: 8px; margin-bottom: 12px; background: #fff; border: 1px solid #d9534f; color: #d9534f; border-radius: 4px; cursor: pointer; }
.cv2__reset:hover { background: #d9534f; color: #fff; }

.cv2__sidebar details { border-bottom: 1px solid #eaeaea; padding: 10px 0; }
.cv2__sidebar details:last-of-type { border-bottom: 0; }
.cv2__sidebar summary { font-weight: 600; cursor: pointer; padding: 4px 0; user-select: none; }
.cv2__sidebar summary::-webkit-details-marker { display: none; }
.cv2__sidebar summary::after { content: '+'; float: right; font-weight: 400; transition: transform .15s; }
.cv2__sidebar details[open] summary::after { content: '−'; }

.cv2__row {
    display: flex; align-items: center; gap: 6px; padding: 4px 0;
    font-size: 14px; color: #333; cursor: pointer;
}
.cv2__row input { margin: 0; }
.cv2__row em { color: #999; font-style: normal; font-size: 12px; margin-left: auto; }

/* Letter facet — pill-style buttons. Hidden checkbox preserves a11y. */
.cv2__letters {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}
.cv2__letters label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: all .12s;
    user-select: none;
}
.cv2__letters label:hover { border-color: #888; }
.cv2__letters input {
    position: absolute;
    width: 0; height: 0;
    opacity: 0;
    pointer-events: none;
}
.cv2__letters label:has(input:checked) {
    background: #5cb85c;
    border-color: #5cb85c;
    color: #fff;
}
.cv2__letters span { font-weight: 700; }
.cv2__letters em { color: #999; font-style: normal; font-size: 11px; }
.cv2__letters label:has(input:checked) em { color: #e8f5e9; }

.cv2__scroll { max-height: 240px; overflow-y: auto; padding-right: 8px; }
.cv2__scroll::-webkit-scrollbar { width: 6px; }
.cv2__scroll::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.cv2__color-row { padding: 3px 0; }
.cv2__swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid #c0c0c0;
    flex-shrink: 0;
    background-size: cover;
}

.cv2__price-slider { margin: 12px 6px 18px; }
.cv2__price-inputs { display: flex; align-items: center; gap: 4px; }
.cv2__price-inputs input { width: 80px; padding: 4px 6px; border: 1px solid #ccc; border-radius: 3px; }

.cv2__sort { margin-top: 16px; }
.cv2__sort label { display: block; font-weight: 600; margin-bottom: 4px; }
.cv2__sort select { width: 100%; padding: 6px; border: 1px solid #ccc; border-radius: 3px; }

.cv2__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.cv2__head h1 { margin: 0; font-size: 24px; }
.cv2__count { color: #666; font-size: 14px; }

.cv2__loading { padding: 40px; text-align: center; color: #999; }

.cv2__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; min-width: 0; }
.cv2__card {
    display: flex; flex-direction: column;
    border: 1px solid #ececec; border-radius: 6px;
    overflow: hidden; background: #fff;
    transition: transform .12s, box-shadow .12s;
}
.cv2__card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.cv2__card-link { display: block; flex: 1 1 auto; text-decoration: none; color: inherit; }
.cv2__card-img { position: relative; padding-top: 100%; overflow: hidden; }
.cv2__card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cv2__badge { position: absolute; top: 8px; right: 8px; background: rgba(50,50,50,.85); color: #fff; padding: 2px 8px; font-size: 11px; border-radius: 3px; }
.cv2__card-body { padding: 12px; }
.cv2__card-name { font-weight: 600; margin-bottom: 4px; min-height: 40px; }
.cv2__card-meta { color: #666; font-size: 12px; min-height: 18px; }
.cv2__card-price { color: #5cb85c; font-weight: 700; font-size: 18px; margin-top: 6px; }

/* Buy button (in-stock) and pre-order link (out-of-stock) */
.cv2__buy {
    display: block;
    width: 100%;
    padding: 10px 12px;
    text-align: center;
    background: #5cb85c;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    border: 0;
    border-top: 1px solid #ececec;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s;
}
.cv2__buy:hover { background: #4cae4c; }
.cv2__buy:disabled { background: #aaa; cursor: wait; }
.cv2__buy--unavailable {
    background: #9a9a9a;
    color: #fff;
    cursor: default;
    pointer-events: none;
}
.cv2__buy--unavailable:hover { background: #9a9a9a; }

/* Toast notification */
.cv2__toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #333;
    color: #fff;
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    cursor: pointer;
    max-width: 380px;
}

.cv2__pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 32px; }
.cv2__pager button { padding: 6px 14px; background: #fff; border: 1px solid #ccc; border-radius: 3px; cursor: pointer; font-size: 16px; }
.cv2__pager button[disabled] { opacity: .4; cursor: default; }
