/* ================================================================
   CamiBijoux – Boutique  v2.0
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────── */
.cbj-shop {
    --cbj-pink:       #e05c8a;
    --cbj-pink-dark:  #c94878;
    --cbj-green-bg:   #e6f4ec;
    --cbj-green-txt:  #2a7d50;
    --cbj-perso-bg:   #fce9f2;
    --cbj-perso-txt:  #b84f7a;
    --cbj-sale-bg:    #fde8e8;
    --cbj-sale-txt:   #c0392b;
    --cbj-border:     #e8e8e8;
    --cbj-bg:         #f9f8f6;
    --cbj-card-bg:    #ffffff;
    --cbj-text:       #1a1a1a;
    --cbj-muted:      #777777;
    --cbj-radius:     14px;
    --cbj-gap:        20px;

    font-family: inherit;
    color: var(--cbj-text);
}

/* ── TOP BAR (catégories + tri) ─────────────────────────────── */
.cbj-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--cbj-border);
    margin-bottom: 14px;
}

.cbj-topbar__cats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Boutons catégories */
.cbj-cat-btn {
    padding: 6px 16px;
    border-radius: 50px;
    border: 1.5px solid var(--cbj-border);
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--cbj-muted);
    cursor: pointer;
    transition: border-color .18s, color .18s, background .18s, font-weight .18s;
    white-space: nowrap;
    line-height: 1.5;
}
.cbj-cat-btn:hover {
    border-color: var(--cbj-pink);
    color: var(--cbj-pink);
}
.cbj-cat-btn.is-active {
    border-color: var(--cbj-pink);
    background: var(--cbj-pink);
    color: #fff;
    font-weight: 600;
}

/* Select tri */
.cbj-topbar__sort-wrap {
    position: relative;
    flex-shrink: 0;
}
.cbj-topbar__sort-wrap::after {
    content: "";
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--cbj-muted);
    pointer-events: none;
}
.cbj-sort-select {
    padding: 7px 36px 7px 14px;
    border-radius: 50px;
    border: 1.5px solid var(--cbj-border);
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: var(--cbj-text);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    transition: border-color .18s;
    min-width: 160px;
}
.cbj-sort-select:hover,
.cbj-sort-select:focus {
    border-color: var(--cbj-pink);
}

/* ── BARRE PERSONNALISABLE ──────────────────────────────────── */
.cbj-perso-bar {
    margin-bottom: 18px;
}

/* ── LAYOUT : SIDEBAR + GRILLE ─────────────────────────────── */
.cbj-layout {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.cbj-sidebar {
    flex: 0 0 200px;
    min-width: 160px;
    max-width: 220px;
}

.cbj-filter-block {
    background: var(--cbj-card-bg);
    border: 1px solid var(--cbj-border);
    border-radius: var(--cbj-radius);
    padding: 18px 16px;
}

.cbj-filter-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--cbj-text);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--cbj-border);
}

.cbj-filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--cbj-muted);
    cursor: pointer;
    padding: 5px 0;
    transition: color .15s;
    user-select: none;
}
.cbj-filter-option:hover { color: var(--cbj-text); }
.cbj-filter-option input[type="checkbox"]:checked + .cbj-checkbox-custom {
    background: var(--cbj-pink);
    border-color: var(--cbj-pink);
}
.cbj-filter-option input[type="checkbox"]:checked + .cbj-checkbox-custom::after {
    opacity: 1;
}

/* ── CHECKBOX CUSTOM ────────────────────────────────────────── */
.cbj-checkbox-wrap {
    position: relative;
    flex-shrink: 0;
    display: inline-flex;
    width: 17px;
    height: 17px;
}
.cbj-checkbox-wrap input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.cbj-checkbox-custom {
    display: block;
    width: 17px;
    height: 17px;
    border-radius: 4px;
    border: 1.5px solid var(--cbj-border);
    background: #fff;
    transition: background .15s, border-color .15s;
    position: relative;
}
.cbj-checkbox-custom::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 6px;
    height: 10px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity .15s;
}
.cbj-checkbox-wrap input[type="checkbox"]:checked ~ .cbj-checkbox-custom {
    background: var(--cbj-pink);
    border-color: var(--cbj-pink);
}
.cbj-checkbox-wrap input[type="checkbox"]:checked ~ .cbj-checkbox-custom::after {
    opacity: 1;
}

/* ── PERSONNALISABLE LABEL ──────────────────────────────────── */
.cbj-perso-label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--cbj-muted);
    cursor: pointer;
    user-select: none;
    transition: color .15s;
}
.cbj-perso-label:hover { color: var(--cbj-text); }

/* ── ZONE GRILLE ────────────────────────────────────────────── */
.cbj-grid-wrapper {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
}

.cbj-grid {
    display: grid;
    gap: var(--cbj-gap);
}
.cbj-cols-1 { grid-template-columns: repeat(1, 1fr); }
.cbj-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cbj-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cbj-cols-4 { grid-template-columns: repeat(4, 1fr); }
.cbj-cols-5 { grid-template-columns: repeat(5, 1fr); }
.cbj-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* ── CARTE PRODUIT ──────────────────────────────────────────── */
.cbj-card {
    background: var(--cbj-card-bg);
    border-radius: var(--cbj-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform .22s ease, box-shadow .22s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.cbj-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(0,0,0,.10);
}

/* Image */
.cbj-card__img-link {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #f5f4f2;
    flex-shrink: 0;
}
.cbj-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.cbj-card:hover .cbj-card__img {
    transform: scale(1.04);
}

/* ── BADGES ─────────────────────────────────────────────────── */
.cbj-badge {
    position: absolute;
    top: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 50px;
    pointer-events: none;
    line-height: 1.4;
    white-space: nowrap;
}
.cbj-badge--perso {
    left: 10px;
    background: var(--cbj-perso-bg);
    color: var(--cbj-perso-txt);
}
.cbj-badge--best {
    right: 10px;
    background: var(--cbj-green-bg);
    color: var(--cbj-green-txt);
}
.cbj-badge--sale {
    right: 10px;
    background: var(--cbj-sale-bg);
    color: var(--cbj-sale-txt);
}

/* ── BOUTON WISHLIST (cœur) ─────────────────────────────────── */
.cbj-wish {
    position: absolute;
    right: 10px;
    bottom: 70px;   /* ajuster selon la hauteur du corps de carte */
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    color: #ccc;
    z-index: 2;
    padding: 0;
    transition: color .2s, transform .2s;
    backdrop-filter: blur(4px);
}
.cbj-wish:hover          { color: var(--cbj-pink); transform: scale(1.12); }
.cbj-wish.is-active      { color: var(--cbj-pink); }
.cbj-wish.is-active svg  { fill: var(--cbj-pink); stroke: var(--cbj-pink); }
.cbj-wish svg {
    width: 16px; height: 16px;
    display: block;
    fill: none;
    transition: fill .2s, stroke .2s;
}

/* ── CORPS CARTE ────────────────────────────────────────────── */
.cbj-card__body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cbj-card__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--cbj-text);
    text-decoration: none;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s;
}
.cbj-card__name:hover { color: var(--cbj-pink); }

.cbj-card__price {
    font-size: 13px;
    color: var(--cbj-muted);
    margin: 0;
}
.cbj-card__price .woocommerce-Price-amount {
    font-weight: 700;
    color: var(--cbj-text);
}
.cbj-card__price del .woocommerce-Price-amount {
    font-weight: 400;
    color: #aaa;
}
.cbj-card__price ins { text-decoration: none; }

/* ── ÉTAT CHARGEMENT ─────────────────────────────────────────── */
.cbj-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(249,248,246,.7);
    border-radius: var(--cbj-radius);
    z-index: 10;
}
.cbj-loading[hidden] { display: none; }

.cbj-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--cbj-border);
    border-top-color: var(--cbj-pink);
    border-radius: 50%;
    animation: cbj-spin .7s linear infinite;
}
@keyframes cbj-spin { to { transform: rotate(360deg); } }

/* ── MESSAGE VIDE ────────────────────────────────────────────── */
.cbj-no-result {
    text-align: center;
    color: var(--cbj-muted);
    font-size: 14px;
    padding: 40px 20px;
}
.cbj-no-result[hidden] { display: none; }
.cbj-notice {
    color: var(--cbj-muted);
    font-style: italic;
    padding: 20px 0;
}

/* ── GRILLE EN CHARGEMENT ───────────────────────────────────── */
.cbj-grid.is-loading {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity .2s;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .cbj-cols-4,
    .cbj-cols-5,
    .cbj-cols-6 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .cbj-sidebar { flex: 0 0 170px; min-width: 140px; }
    .cbj-cols-3,
    .cbj-cols-4,
    .cbj-cols-5,
    .cbj-cols-6 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .cbj-layout  { flex-direction: column; gap: 20px; }
    .cbj-sidebar { max-width: 100%; width: 100%; flex: unset; }
    .cbj-filter-block { display: flex; flex-wrap: wrap; gap: 0 24px; }
    .cbj-filter-title { width: 100%; }

    .cbj-cols-2,
    .cbj-cols-3,
    .cbj-cols-4,
    .cbj-cols-5,
    .cbj-cols-6 { grid-template-columns: repeat(2, 1fr); }

    .cbj-grid { gap: 12px; }
    .cbj-topbar { gap: 10px; }
    .cbj-topbar__cats { gap: 6px; }
    .cbj-cat-btn { padding: 5px 12px; font-size: 12px; }
}

@media (max-width: 400px) {
    .cbj-cols-2,
    .cbj-cols-3,
    .cbj-cols-4,
    .cbj-cols-5,
    .cbj-cols-6 { grid-template-columns: repeat(2, 1fr); }
    .cbj-card__body { padding: 9px 10px 11px; }
}
