/* =========================================================
   Marketplace Styles – redesign with groups & category filter
   ========================================================= */

/* Design tokens */
:root {
    --card-min-width: 210px;
    --accent: #4F7F34;
    --accent-light: #f3f8ed;
    --accent-border: #b8d99a;
    --accent-dark: #5a8a3c;
    --accent-text-strong: #2e581d;
}

/* ---------- Layout ---------- */
main#content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 30px 7%;
    gap: 28px;
    width: 100%;
    box-sizing: border-box;
}

/* ---------- Breadcrumb ---------- */
nav#ariane {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

nav#ariane a {
    text-decoration: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    color: #434343;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.2s;
}

nav#ariane a:hover {
    color: #4F7F34;
}

nav#ariane .ariane-sep {
    color: rgba(0, 0, 0, 0.35);
    font-size: 16px;
}

nav#ariane .ariane-current {
    font-size: 13px;
    font-weight: 700;
    color: #4F7F34;
}

nav#ariane .icon.home-icon {
    background-color: rgba(0, 0, 0, 0.65);
    width: 14px;
    height: 14px;
    -webkit-mask: url('/svg/home_icon.svg') center / contain no-repeat;
    mask: url('/svg/home_icon.svg') center / contain no-repeat;
}

/* ---------- Title & actions ---------- */
#title_container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    width: 100%;
}

#title_container h1 {
    font-style: normal;
    font-weight: 800;
    font-size: 40px;
    color: #4F7F34;
    line-height: 1.15;
    margin: 0;
}

.marketplace_intro {
    margin: 0;
    max-width: 880px;
    font-size: 16px;
    line-height: 1.6;
    color: #2f2f2f;
}

.marketplace_intro strong {
    color: #4F7F34;
}

/* "Back to all categories" button */
.btn-all-categories {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: #f3f8ed;
    border: 2px solid #4F7F34;
    border-radius: 50px;
    color: var(--accent-text-strong);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.btn-all-categories:hover {
    background: #4F7F34;
    color: #fff;
}

/* Category quick-nav pills */
#category_nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

.cat-pill {
    display: inline-block;
    padding: 6px 16px;
    background: var(--accent-light);
    border: 1.5px solid var(--accent-border);
    border-radius: 50px;
    color: var(--accent-text-strong);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.cat-pill:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ---------- Categories container ---------- */
#categories {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 50px;
    width: 100%;
}

/* ---------- Single category block ---------- */
.categorie {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
}

.categorie_header {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}

h2.titre_categorie {
    font-weight: 800;
    font-size: 26px;
    color: #1a1a1a;
    margin: 0;
}

.categorie_count {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-text-strong);
    background: #f3f8ed;
    border: 1px solid #b8d99a;
    border-radius: 20px;
    padding: 2px 10px;
}

.categorie_separator {
    width: min(35%, 220px);
    height: 6px;
    background: linear-gradient(90deg, #4F7F34, #b8d99a);
    border-radius: 10px;
}

/* Products grid */
.produits {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
    gap: 24px;
    width: 100%;
}

/* ---------- Product card ---------- */
a.produit {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-radius: 16px;
    text-decoration: none;
    background: #fff;
    border: 1.5px solid #e8e8e8;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    color: inherit;
}

a.produit:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 28px rgba(79,127,52, 0.25);
    border-color: #4F7F34;
}

/* Image wrapper */
.product_image_wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

img.product_main_image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 12px;
    box-sizing: border-box;
    transition: transform 0.3s ease;
}

a.produit:hover img.product_main_image {
    transform: scale(1.05);
}

/* Card text area */
.product_content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 14px 6px;
    flex: 1;
}

h3.product_title {
    font-weight: 700;
    font-size: 13px;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

span.product_price {
    font-weight: 700;
    font-size: 17px;
    color: #4F7F34;
}

/* CTA strip at card bottom */
.product_cta {
    padding: 10px 14px;
    background: #f3f8ed;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-text-strong);
    border-top: 1px solid #e2f0d4;
    transition: background 0.2s, color 0.2s;
}

a.produit:hover .product_cta {
    background: #4F7F34;
    color: #fff;
}

/* =========================================================
   Cart button on product cards
   ========================================================= */

/* Card wrapper to group link + add-to-cart button */
.produit-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    border: 1.5px solid #e8e8e8;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    background: #fff;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.produit-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 28px rgba(79,127,52, 0.25);
    border-color: #4F7F34;
}

/* Make the link fill the card (above the button) */
.produit-card a.produit {
    border-radius: 0;
    border: none;
    box-shadow: none;
    flex: 1;
    transition: none;
}

.produit-card a.produit:hover {
    transform: none;
    box-shadow: none;
    border-color: transparent;
}

.produit-card:hover a.produit .product_cta {
    background: #4F7F34;
    color: #fff;
}

.produit-card:hover a.produit img.product_main_image {
    transform: scale(1.05);
}

/* "Ajouter au panier" button at bottom of card */
.btn-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    padding: 10px 14px;
    background: var(--accent-light);
    border: none;
    border-top: 1.5px solid var(--accent-border);
    color: var(--accent-text-strong);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
    flex-shrink: 0;
}

.btn-add-to-cart:hover,
.btn-add-to-cart:focus-visible {
    background: var(--accent);
    color: #fff;
    outline: none;
}

.btn-add-to-cart svg {
    flex-shrink: 0;
}

/* =========================================================
   Responsive
   ========================================================= */

/* Tablet: 992px and below */
@media (max-width: 992px) {
    main#content {
        padding: 24px 5%;
    }

    #title_container h1 {
        font-size: 32px;
    }

    h2.titre_categorie {
        font-size: 22px;
    }

    .produits {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 18px;
    }
}

/* Mobile: 576px and below */
@media (max-width: 576px) {
    main#content {
        padding: 18px 4%;
        gap: 20px;
    }

    #title_container h1 {
        font-size: 26px;
    }

    h2.titre_categorie {
        font-size: 18px;
    }

    .categorie_separator {
        height: 4px;
    }

    .produits {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    h3.product_title {
        font-size: 12px;
    }

    span.product_price {
        font-size: 15px;
    }

    .product_cta {
        font-size: 11px;
        padding: 8px 12px;
    }

    .btn-all-categories {
        font-size: 13px;
        padding: 8px 16px;
    }

    .cat-pill {
        font-size: 11px;
        padding: 5px 12px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .produits {
        grid-template-columns: 1fr;
    }
}
