* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
:root {
    --couleur-rouge: red;
    --couleur-blanche: white;
    --couleur-grise: lightgrey;
    --couleur-noire: black;
    --couleur-fumer: whitesmoke;
    --hombre: 0 10px 20px rgba(0, 0, 0, 0.2);
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: whitesmoke;
    color: #161616;
    font-family: Arial, Helvetica, sans-serif;
    overflow-x: hidden;
}

button,
input {
    font: inherit;
}

/* ===== Entete de la page ===== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 80px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1rem clamp(1rem, 4vw, 4rem);
    background-color: var(--couleur-blanche);
    box-shadow: var(--hombre);
    z-index: 1000;
}

header h1.brand {
    color: var(--couleur-rouge);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    flex-shrink: 0;
}

.main-nav,
.main-nav ul,
.connexion,
.connexion nav ul {
    display: flex;
    align-items: center;
}

.main-nav ul,
.connexion nav ul {
    gap: clamp(0.65rem, 1.5vw, 1.4rem);
    list-style: none;
}

.main-nav a,
.connexion a {
    text-decoration: none;
    font-weight: 700;
}

header nav ul li a {
    color: var(--couleur-noire);
    font-size: large;
    font-family: 'Times New Roman', Times, serif;
    transition: color 0.3s ease;
    white-space: nowrap;
}

header nav ul li a:hover,
header nav ul li a[aria-current="page"] {
    color: var(--couleur-rouge);
}

.menu-toggle {
    display: none;
    border: 0;
    background: transparent;
    color: var(--couleur-noire);
    cursor: pointer;
    font-size: 1.6rem;
}

.connexion {
    justify-content: flex-end;
    gap: 0.8rem;
}

.btn-connexion {
    background-color: var(--couleur-rouge);
    color: var(--couleur-blanche);
    padding: 8px 12px;
    border-radius: 5px;
    font-weight: bold;
    font-size: medium;
    font-family: 'Times New Roman', Times, serif;
    text-decoration: none;
    transition: 0.3s ease;
    white-space: nowrap;
}

.btn-connexion:hover {
    color: var(--couleur-rouge);
    background-color: var(--couleur-fumer);
    border: 1px inset var(--couleur-rouge);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid #d3d7db;
    border-radius: 999px;
    color: #5c6268;
}

.search-box input {
    width: 8rem;
    border: 0;
    outline: 0;
    background: transparent;
}

.cart-count {
    display: inline-grid;
    min-width: 1.25rem;
    min-height: 1.25rem;
    place-items: center;
    border-radius: 50%;
    background: var(--couleur-rouge);
    color: var(--couleur-blanche);
    font-size: 0.75rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ===== Corps de la page ===== */
.container {
    width: min(100%, 1440px);
    margin: 80px auto 0;
}

.container-2 {
    margin: 0;
    padding: 3.5rem clamp(1rem, 5vw, 4rem) 1.5rem;
}

.container-2 h1 {
    font-size: clamp(1.6rem, 4vw, 2.5rem);
}

.container-3 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.25rem;
    padding: 1rem clamp(1rem, 5vw, 4rem) 4rem;
}

.container-3 .article {
    width: auto;
    margin: 0;
    padding: 0 0 1.25rem;
    overflow: hidden;
    text-align: center;
    background: var(--couleur-blanche);
    border-radius: 12px;
    box-shadow: var(--hombre);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.container-3 .article:hover {
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.17);
    transform: translateY(-5px);
}

.container-3 .article img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 0;
    box-shadow: none;
}

.container-3 .article h3 {
    margin: 1rem 1rem 0.75rem;
    font-size: 1.05rem;
}

.container-3 .article > div:not(.article-image) {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: auto;
    min-height: 2.25rem;
    margin: 0 1rem;
    padding: 0;
}

.container-3 .article > div:not(.article-image) p {
    color: var(--couleur-rouge);
    font-weight: bold;
}

.container-3 .article > div:not(.article-image) button {
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    color: var(--couleur-blanche);
    background-color: var(--couleur-rouge);
    font-family: 'Times New Roman', Times, serif;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.container-3 .article > div:not(.article-image) button:hover {
    transform: scale(1.05);
    box-shadow: var(--hombre);
}

/* RUPTURE DE STOCK */
.produit-rupture {
    margin: 8px 0;
    font-weight: 700;
    font-size: 0.9rem;
    color: #161616;
}

/* BOUTON PRODUIT INDISPONIBLE */
.btn-acheter.rupture,
.btn-acheter:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}


.btn-acheter.rupture:hover,
.btn-acheter:disabled:hover {
    transform: none;
}

/* ===== Pied de page (une seule définition) ===== */
footer {
    padding: 3.5rem clamp(1rem, 6vw, 5rem) 1.5rem;
    margin-top: 50px;
    background-color: var(--couleur-noire);
}

footer .footer-1 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    align-items: start;
}

footer .footer-1 div h2 {
    color: var(--couleur-blanche);
    text-decoration: underline;
}

footer .footer-1 div ul li {
    padding: 5px;
    list-style-type: none;
}

footer .footer-1 div ul li a {
    text-decoration: none;
    color: var(--couleur-rouge);
    transition: color 0.2s ease;
}

footer .footer-1 div ul li a:hover {
    color: var(--couleur-fumer);
    text-decoration: underline;
}

footer .footer-2 p {
    color: var(--couleur-blanche);
    text-align: center;
    margin-top: 50px;
}

/* =====================================
   IMAGE PRODUIT + FAVORI
===================================== */

.container-3 .article > .article-image {
    position: relative;
    display: block;
    width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    aspect-ratio: 1 / 1;
    background: #fff;
}


.container-3 .article .article-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}


.btn-favori {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #dc2626;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition:
        transform 0.2s ease,
        background 0.2s ease;
}


.btn-favori:hover {
    transform: scale(1.08);

    background: white;
}


.btn-favori:active {
    transform: scale(0.95);
}


/* Produit déjà favori */
.btn-favori.actif {
    background: #dc2626;
    color: white;
}


.btn-favori.actif i::before {
    content: "\f415";
}

.btn-favori:disabled {
    cursor: wait;
    opacity: 0.65;
}

/* ==============================
   FILTRES CATÉGORIES
============================== */

.filtres-categories {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;

    margin-top: 20px;
    margin-bottom: 25px;
}


.btn-categorie {
    border: 1px solid #ddd;
    background: #fff;

    padding: 10px 18px;

    border-radius: 25px;

    cursor: pointer;

    font-size: 14px;

    transition: 0.2s;
}


.btn-categorie:hover {
    transform: translateY(-2px);
}


.btn-categorie.actif {
    font-weight: bold;
    border-width: 2px;
}

/* ==============================
   AUTHENTIFICATION MOBILE
============================== */

.auth-mobile {
    display: flex;
}


.auth-mobile-contenu {
    width: 100%;

    display: flex;
    flex-direction: column;

    align-items: center;

    gap: 12px;
}


.auth-mobile-profil,
.auth-mobile-admin {
    display: flex;

    align-items: center;

    justify-content: center;

    gap: 8px;
}


.btn-deconnexion-mobile {
    border: none;

    background: transparent;

    cursor: pointer;

    font-weight: 700;

    font-family:
        'Times New Roman',
        Times,
        serif;

    font-size: large;
}

/* ===== Responsive ===== */
@media (max-width: 1050px) {
    header {
        gap: 1rem;
    }

    .search-box input {
        width: 5rem;
    }

    .container-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    header {
        position: relative;
        position: sticky;
        flex-wrap: wrap;
        min-height: 72px;
    }

    .container {
        margin-top: 0;
    }

    .brand {
        margin-right: auto;
    }

    .menu-toggle {
        display: block;
        order: 2;
    }

    .main-nav {
        display: contents;
    }

    .main-nav ul {
        display: none;
        order: 4;
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--couleur-grise);
    }

    .main-nav ul.open {
        display: flex;
    }

    .connexion {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns:
        minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.6rem;
}


    /* ==============================
    RECHERCHE MOBILE
    ============================== */

    .search-box {
        display: flex;
        width: 100%;
        min-width: 0;
    }


    .search-box input {
        width: 100%;
        min-width: 0;
    }

    .container-2 {
        padding-top: 2.5rem;
    }

.container-3 {
    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 12px;

    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: 2.5rem;
}


.container-3 .article {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.container-3 .article h3 {
    margin: 0.75rem 0.5rem 0.6rem;

    font-size: 0.9rem;

    line-height: 1.2;
}


.container-3 .article > div:not(.article-image) {
    margin-left: 0.5rem;
    margin-right: 0.5rem;

    gap: 6px;

    flex-wrap: wrap;
}


.container-3 .article > div:not(.article-image) button {
    min-height: 38px;

    padding: 0.5rem 0.65rem;

    font-size: 0.85rem;
}

.btn-favori {
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

    footer .footer-1 {
        grid-template-columns: 1fr;
    }

    /* ==============================
   CATÉGORIES MOBILE
============================== */

.filtres-categories {
    justify-content: flex-start;

    flex-wrap: nowrap;

    overflow-x: auto;

    padding-bottom: 8px;

    scrollbar-width: thin;
}


.btn-categorie {
    flex: 0 0 auto;

    white-space: nowrap;
}

/* Afficher l'authentification
   à l'intérieur du hamburger */
.auth-mobile {
    display: block;

    width: 100%;

    padding-top: 12px;

    border-top:
        1px solid
        var(--couleur-grise);
}


/* Cacher l'authentification
   extérieure sur mobile */
.connexion #authButtons {
    display: none;
}
}

@media (max-width: 420px) {
    header {
        padding: 0.85rem;
    }

    .container-2 {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .container-3 {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .connexion {
    grid-template-columns:
        minmax(0, 1fr)
        auto;
}


/* Le bloc connexion utilisateur
   peut passer sur sa propre ligne */
#authButtons {
    grid-column: 1 / -1;

    display: flex;
    justify-content: center;
}


.search-box {
    min-height: 42px;
}


.btn-categorie {
    padding: 8px 14px;

    font-size: 0.85rem;
}
}