/* ============================================================
   MARKETPLACE — Page liste produits
   Fichier : public/assets/css/pages/products.css
   ============================================================ */

/* ── Layout général ──────────────────────────────────────── */
.km-marketplace {
    background: #FFF;
    min-height: 100vh;
    padding: 32px 0 64px;
}

.km-marketplace__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: flex-start;
    gap: 28px;
}


/* ============================================================
   SIDEBAR FILTRES
   ============================================================ */
.km-filters {
    width: 280px;
    flex-shrink: 0;
    padding: 25px 25px 20px 25px;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    background: #FFF;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: calc(var(--km-header-height) + 52px + 16px); /* header + navbar + gap */
    max-height: calc(100vh - 180px);
    overflow-y: auto;
}

.km-filters__title {
    color: #704B38;
    font-family: var(--km-font);
    font-size: 18px;
    font-weight: 500;
    line-height: 27px;
}

/* Groupe de filtre */
.km-filter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid #F3F4F6;
    padding-bottom: 20px;
}
.km-filter-group:last-of-type { border-bottom: none; }

.km-filter-group__header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.km-filter-group__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.km-filter-group__label {
    flex: 1;
    color: #704B38;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
}

.km-filter-group__chevron {
    flex-shrink: 0;
    transition: transform .2s ease;
}
.km-filter-group__chevron--open {
    transform: rotate(180deg);
}

.km-filter-group__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-left: 4px;
}

/* Checkbox custom */
.km-filter-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.km-filter-check--sub {
    padding-left: 16px;
}

.km-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.10);
    background: #F3F3F5;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,.05);
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    transition: background .15s ease, border-color .15s ease;
}

.km-checkbox:checked {
    background: #F6A936;
    border-color: #F6A936;
}

.km-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 4px;
    width: 5px;
    height: 8px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.km-checkbox--radio {
    border-radius: 50%;
}
.km-checkbox--radio:checked::after {
    top: 3px;
    left: 3px;
    width: 6px;
    height: 6px;
    border: none;
    background: white;
    border-radius: 50%;
    transform: none;
}

.km-filter-check__label {
    color: #364153;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 21px;
}

/* Inputs prix */
.km-filter-price {
    display: flex;
    align-items: center;
    gap: 8px;
}

.km-filter-price__input {
    width: 111px;
    height: 39px;
    padding: 8px 12px;
    border: 1px solid #E5E7EB;
    background: #FFF;
    font-family: var(--km-font);
    font-size: 14px;
    color: #364153;
    outline: none;
    transition: border-color .2s ease;
}
.km-filter-price__input:focus { border-color: #F6A936; }
.km-filter-price__input::placeholder { color: #9CA3AF; }

.km-filter-price__sep {
    color: #9CA3AF;
    font-size: 14px;
}

/* Bouton appliquer */
.km-filters__apply {
    display: flex;
    padding: 12px;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    background: #F6A936;
    color: #FFF;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    border: none;
    cursor: pointer;
    transition: filter .2s ease;
    border-radius: 4px;
    margin-top: 4px;
}
.km-filters__apply:hover { filter: brightness(1.08); }


/* ============================================================
   ZONE PRODUITS
   ============================================================ */
.km-products-zone {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Barre de tri */
.km-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 71px;
    border: 1px solid #E5E7EB;
    background: #FFF;
}

.km-sort-bar__label {
    color: #364153;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 400;
}

.km-sort-bar__select {
    appearance: none;
    -webkit-appearance: none;
    padding: 8px 32px 8px 12px;
    border: 1px solid #E5E7EB;
    background: #FFF url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23704B38' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    color: #704B38;
    cursor: pointer;
    outline: none;
    border-radius: 4px;
    min-width: 180px;
}


/* ============================================================
   GRILLE PRODUITS — 3 colonnes
   ============================================================ */
.km-products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Carte produit */
.km-product-card {
    display: flex;
    flex-direction: column;
    border: 1px solid #E5E7EB;
    background: #FFF;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow .25s ease, transform .25s ease;
}
.km-product-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.10);
    transform: translateY(-3px);
}

/* Image */
.km-product-card__img-wrap {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    flex-shrink: 0;
}

.km-product-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.km-product-card:hover .km-product-card__img {
    transform: scale(1.04);
}

/* Badge avantage */
.km-product-card__badge {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 9999px;
    background: #F6A936;
    color: #FFF;
    font-family: var(--km-font);
    font-size: 12px;
    font-weight: 500;
    line-height: 18px;
    z-index: 1;
}

/* Wishlist */
.km-product-card__wish {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .2s ease;
    z-index: 1;
}
.km-product-card__wish:hover {
    background: #fff;
    transform: scale(1.1);
}
.km-product-card__wish.km-product-card__wish--active svg {
    fill: #F6A936;
    stroke: #F6A936;
}

/* Corps de la carte */
.km-product-card__body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.km-product-card__name {
    font-family: var(--km-font);
    font-size: 15px;
    font-weight: 500;
    color: #1F2937;
    line-height: 1.4;
}
.km-product-card__name a {
    color: inherit;
    text-decoration: none;
    transition: color .2s ease;
}
.km-product-card__name a:hover { color: #704B38; }

.km-product-card__price {
    color: #F6A936;
    font-family: var(--km-font);
    font-size: 24px;
    font-weight: 500;
    line-height: 36px;
}

.km-product-card__stock {
    color: #364153;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 21px;
}
.km-product-card__stock-qty { color: #00A63E; }

.km-product-card__seller {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #704B38;
    font-family: var(--km-font);
    font-size: 13px;
    font-weight: 500;
}

.km-product-card__rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #364153;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 21px;
}
.km-product-card__rating span { color: #9CA3AF; }

.km-product-card__zone {
    color: #364153;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 400;
    line-height: 21px;
}

/* Actions */
.km-product-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.km-product-card__btn-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    padding: 9px 12px;
    background: #F6A936;
    color: #FFF;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    border: none;
    cursor: pointer;
    transition: filter .2s ease;
    border-radius: 4px;
}
.km-product-card__btn-cart:hover { filter: brightness(1.08); }

.km-product-card__btn-detail {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 17px;
    border: 1px solid #704B38;
    color: #704B38;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    text-decoration: none;
    border-radius: 4px;
    transition: background .2s ease, color .2s ease;
    white-space: nowrap;
}
.km-product-card__btn-detail:hover {
    background: #704B38;
    color: #fff;
}


/* ============================================================
   PAGINATION
   ============================================================ */
.km-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 24px 0;
}

/* Bouton Précédent / Suivant cliquable */
.km-pagination__btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 9px 17px;
    color: #704B38;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    text-decoration: none;
    border-radius: 4px;
    transition: background .2s ease;
    cursor: pointer;
}
.km-pagination__btn:hover { background: rgba(112,75,56,.06); }

/* Bouton désactivé */
.km-pagination__btn--disabled {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 9px 17px;
    color: #704B38;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    border: 1px solid #F9FDFF;
    border-radius: 4px;
    opacity: 0.5;
    cursor: not-allowed;
}

/* Numéro de page inactif */
.km-pagination__page {
    display: flex;
    width: 40px;
    padding: 9.5px 0;
    justify-content: center;
    align-items: center;
    border: 1px solid #F9FDFF;
    color: #704B38;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 21px;
    text-decoration: none;
    border-radius: 4px;
    transition: background .2s ease;
    flex-shrink: 0;
}
.km-pagination__page:hover { background: rgba(112,75,56,.06); }

/* Page active */
.km-pagination__page--active {
    background: #F6A936;
    border-color: #F6A936;
    color: #FFF;
    cursor: default;
}


/* ============================================================
   ÉTAT VIDE
   ============================================================ */
.km-products-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 24px;
    text-align: center;
}
.km-products-empty p {
    color: #6B7280;
    font-size: 16px;
    font-family: var(--km-font);
}
.km-products-empty__reset {
    display: inline-flex;
    padding: 10px 24px;
    background: #F6A936;
    color: #fff;
    font-family: var(--km-font);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 4px;
    transition: filter .2s ease;
}
.km-products-empty__reset:hover { filter: brightness(1.08); }


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .km-marketplace__inner { padding: 0 24px; gap: 20px; }
    .km-filters { width: 240px; }
    .km-products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .km-marketplace__inner { flex-direction: column; }
    .km-filters {
        width: 100%;
        position: static;
        max-height: none;
    }
    .km-products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .km-marketplace { padding: 16px 0 40px; }
    .km-marketplace__inner { padding: 0 16px; }
    .km-products-grid { grid-template-columns: 1fr; }
    .km-sort-bar { flex-direction: column; align-items: flex-start; gap: 8px; height: auto; padding: 12px 16px; }
    .km-sort-bar__select { width: 100%; }
}

/* État indéterminé (certaines sous-catégories cochées) */
.km-checkbox:indeterminate {
    background: #F6A936;
    border-color: #F6A936;
    opacity: 0.6;
}
.km-checkbox:indeterminate::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 3px;
    width: 8px;
    height: 2px;
    background: white;
    border: none;
    transform: none;
}