.protocol-page {
    margin-left: 3%;
    margin-right: 3%;
    width: 100%;
}

.protocol-title {
    display: flex;
    justify-content: center;
    text-align: center;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--global-color-text);
}

.protocol-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.protocol-shop {
    width: 100%;
    max-width: 1280px; /* limite largeur desktop */
    display: flex;
    flex-direction: column;
}

/* --- TOP BAR (filters + search) --- */

.protocol-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start; 
    gap: 1.5rem; 
    margin: 20px 0;
    flex-direction: row;
}

/* bouton Filters */
.filters-toggle {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

#filters {
    height: 60px;
}

#filters_text {
    font-size: 20px;
    margin: 0;
    color: var(--global-color-text);
}

/* barre de recherche */
.search-input {
    flex: 1 1 260px;
    max-width: 500px;
    border: 2px solid #3498db;
    border-radius: 7px;
    padding-left: 2.2rem; /* espace icône si tu en mets une bg-image */
    margin-right: auto;
    width: 100%;
}

/* On peut retirer cette ancienne règle globale qui forçait un left margin énorme.
   Ancienne règle: 
   #searchBar { margin-left:5%; width:100%; ... }
   -> On la remplace par .search-input ci-dessus */


/* --- FILTER TABS ROW --- */

.filters-row {
    display: flex;
    justify-content: center;
    margin-top: -10px; /* remplace margin-top:-2% inline, plus stable */
    transition: max-height 0.6s, opacity 0.4s;
    max-height: 500px;
    opacity: 1;
}

.filters-row.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.tab-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 10px;
    column-gap: 20px;
    margin: 20px;
}

.tab-button {
    padding: 4px 45px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 0.95rem;
}

.tab-button:hover {
    background-color: #2980b9;
}

.tab-button.selected::after {
    content: '';
    position: absolute;
    bottom: -9px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #3498db;
}

.tab-button:not(.selected)::after {
    display: none;
}

/* --- CHIPS GRID + GALLERY --- */

.gallery-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* container des "chips" (Bone, Brain, ...) */
#productGalleryContainer {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* grille des chips */
.button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    padding-bottom: 20px;
    margin: 0 auto;
    width: 100%;
    max-width: 800px;

    transition: max-height 0.6s, opacity 0.4s;
    max-height: 500px;
    opacity: 1;
}

.button-grid.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.button-grid button {
    padding: 10px 13px;
    background-color: #a5b0b8;
    color: rgb(0, 0, 0);
    border: none;
    border-radius: 2px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 13px;
    width: 100%;
    text-align: center;
}

/* --- GALLERY CARDS --- */

/* row venant de Bootstrap, mais on sécurise l'alignement */
#productGallery {
    justify-content: center;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* chaque card colonne -> on laisse Bootstrap gérer les breakpoints,
   mais on évite que ça parte trop large */
.protocol-card {
    cursor: pointer;
    border: 1px solid #ddd;
    transition: transform 0.2s ease-in-out;
    height: 100%;
    display: flex;
    flex-direction: column;
    max-height: 270px;
}

.protocol-card:hover {
    transform: scale(1.05);
}

/* image en haut */
.card-img-top {
    width: 100%;
    height: 140px;
    object-fit: cover;
    object-position: center;
}

/* body de la card */
.protocol-card-body {
    height: 155px;           /* remplace style="height:155px" inline */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.75rem 1rem 1rem 1rem;
}

.card-title {
    font-size: 17px;
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--global-color-text);
}

/* petit trait sous le titre */
.card-separator {
    border: none;
    height: 1px;
    background-color: #000000;
    width: 90%;
    margin: 0 auto 0.5rem auto;
}

/* bloc rating / time / downloads */
.protocol-meta-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    column-gap: 8px;
    row-gap: 4px;
    font-size: 0.9rem;
}

#icon {
    margin-top: 5px;
    height: 14px;
}
#icon2 {
    margin-top: 5px;
    height: 14px;
    margin-left: 8px;
}

/* --- ACCESSOIRES QUI POSAIENT PROBLÈME --- */

/* enlevé: main{ width:77%; } => cassait le mobile */
main {
    width: 100%;
    max-width: 100%;
}

/* enlevé: #sortby / #myprotocol width fixes qui débordent.
   On les rendra flexibles si tu les réutilises ailleurs, mais
   pour l’instant je les neutralise pour pas qu'ils cassent. */

#sortby {
    max-width: 200px;
    min-width: 140px;
    padding: 0.4em 0.5em 0.4em 1.5em;
    border: 2px solid #3498db;
    border-radius: 7px;
    background-image: url("triangle.png");
    background-repeat: no-repeat;
    background-size: 1.3em auto;
    background-position: 0.2em center;
}

#myprotocol {
    background-color: #3f9ce9;
    display: flex;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 4px;
    color: white;
}

/* texte dedans */
#myprotocols_title {
    margin-top: 2%;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
}

.filter-button {
    display: flex;flex-direction: row;align-items: center; text-decoration: none; margin-left: auto; 
}
/* --- RESPONSIVE TWEAKS --- */

/* Sur très petit écran (<576px) :
   - la topbar passe en colonne
   - le bouton Filters et la barre de recherche prennent la largeur
*/
@media (max-width: 575.98px) {

    .filters-toggle {
        width: 100%;
        justify-content: flex-start;
        gap: 10px;
    }
    .filter-button{
        margin-right: -20px;
    }
    #filters{
        width:40px;
        height: 40px;
    }
    #filters_text{
        font-size: 18px;
    }
    .search-input {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 10px;
    }

    .tab-container {
        column-gap: 10px;
        row-gap: 10px;
    }

    .tab-button {
        padding: 6px 16px;
        font-size: 0.9rem;
    }
    .button-grid{
        padding: 10px;
        grid-template-columns: repeat(auto-fill, minmax(80px, max-content));
        justify-content: center;
    }
    
    .button-grid button {
        padding: 6px 6px;
        background-color: #a5b0b8;
        color: rgb(0, 0, 0);
        border: none;
        border-radius: 2px;
        cursor: pointer;
        transition: background-color 0.3s;
        font-size: 13px;
        width: 100%;
        text-align: center;
    }
    .button-grid {
        width: 100%;
    }

    /* icônes alignées plus proprement */
    .protocol-meta-row {
        justify-content: center;
        column-gap: 4px;
    }
    #productGallery {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
        justify-content: center;
        width: 100%;
        margin: 0 auto;
    }
    
}