/* 
 * Styles spécifiques pour la page des catégories
 * Version 33 - Mise à jour avec vignettes comme sur la page d'accueil
 */

/* Structure principale de la liste des catégories */
.categories-list {
    position: relative;
    /* Les propriétés flex ont été supprimées pour Masonry */
}

/* Empêcher le débordement */
.categories-list > * {
    min-width: 0;
}

/* Élément de catégorie principal */
.category-item {
    margin: 0 0 30px 0; /* Marge inférieure pour remplacer le gap vertical */
    position: relative;
    display: flex;
    flex-direction: column;
    height: auto;
    width: calc(33.333% - 20px); /* Exactement 1/3 de la largeur moins les marges */
    box-sizing: border-box;
    min-width: 0; /* Empêche le débordement */
    break-inside: avoid; /* Empêche la coupure par Masonry */
}

/* En-tête de la catégorie */
.category-header {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

/* Lien de l'en-tête de catégorie */
.category-header-link {
    color: white;
    text-decoration: none;
    display: block;
    transition: opacity 0.3s ease;
}

.category-header-link:hover {
    opacity: 0.9;
}

.category-header-link:focus {
    outline: none;
}

/* Titre de la catégorie */
.category-title {
    font-size: 1.4rem;
    margin: 0;
    transition: transform 0.2s ease;
}

/* Effet au survol du titre */
.category-header-link:hover .category-title {
    transform: scale(1.02);
}

/* Contenu principal de la catégorie */
.category-content {
    background-color: white;
    border-radius: 0 0 10px 10px;
    padding: 25px 15px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Aligner le contenu en haut */
    width: 100%;
    flex-shrink: 0;
}

/* Mode sombre pour le contenu des catégories */
.dark-mode .category-content {
    background-color: var(--card-bg);
}

/* Conteneur des sous-catégories */
.sous-categories-container {
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
    /* Centrer les éléments horizontalement */
    align-items: center;
    /* Faire en sorte que le conteneur occupe toute la largeur disponible */
    width: 100%;
    align-self: stretch;
}

/* Grille des sous-catégories (nouveau style) */
.sous-categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    justify-content: space-between;
}

/* Carte d'une sous-catégorie (nouveau style) */
.sous-category-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 190px; /* Hauteur fixe pour toutes les cartes */
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    flex-basis: calc(50% - 8px); /* Distribution égale sur 2 colonnes avec l'espacement */
}

.dark-mode .sous-category-card {
    background-color: var(--card-bg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Effet au survol */
.sous-category-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Image de la sous-catégorie */
.sous-category-image {
    height: 130px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0; /* Empêche l'image de rétrécir */
}

.sous-category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Effet de zoom au survol */
.sous-category-card:hover .sous-category-image img {
    transform: scale(1.05);
}

/* Contenu de la sous-catégorie */
.sous-category-content {
    padding: 10px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    height: 60px; /* Hauteur fixe pour tous les contenus */
}

/* Titre de la sous-catégorie */
.sous-category-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limiter à 2 lignes */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-height: 2.4em; /* Limite à 2 lignes basée sur la taille de fonte */
}

.dark-mode .sous-category-title {
    color: #f0f0f0;
}

/* Style pour les images en lazy loading */
img.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease-in;
    min-height: 130px; /* Hauteur minimale pour éviter les sauts de layout */
    background-color: #f0f0f0; /* Couleur de placeholder */
}

/* Images chargées */
img[data-lazy-loaded="true"],
img:not(.lazy-load) {
    opacity: 1;
}

/* Mode sombre - placeholder */
.dark-mode img.lazy-load {
    background-color: #2a2a2a;
}

/* === NOUVEAUX FONDS POUR LES EN-TÊTES DE CATÉGORIE (PAGE CATÉGORIES) === */
/* Application de la palette assombrie et diversifiée */

/* Vert (plus foncé) */
.category-Accompagnements .category-header { background: linear-gradient(to right, #6AAE7B, #4B935B); }

/* Orange/Pêche (plus foncé) */
.category-Apéritifs .category-header { background: linear-gradient(to right, #F78C50, #FABA50); }

/* Gris (plus foncé) */
.category-Bases .category-header { background: linear-gradient(to right, #84939E, #6B7A85); }

/* Bleu (plus foncé) */
.category-Boissons .category-header { background: linear-gradient(to right, #4AA0D1, #248ABD); }

/* Violet/Magenta (plus foncé) */
.category-Desserts .category-header { background: linear-gradient(to right, #B35FBC, #C879C8); }

/* Rouge Corail (plus foncé) */
.category-Entrées .category-header { background: linear-gradient(to right, #F05B5B, #E87A7A); }

/* Jaune/Or (plus foncé) */
.category-Fast-Food .category-header { background: linear-gradient(to right, #F7C833, #EAA80F); }

/* Brun / Terre Cuite (Diversification) */
.category-Pâtisseries .category-header { background: linear-gradient(to right, #C97B61, #A65C44); }

/* Orange Brûlé (Diversification) */
.category-Petits-Déjeuners .category-header { background: linear-gradient(to right, #E88D5A, #D96C3F); }

/* Turquoise / Vert d'eau (plus foncé) */
.category-Plats .category-header { background: linear-gradient(to right, #41B3A9, #1F9088); }

/* Vert Olive (Diversification) */
.category-Salades .category-header { background: linear-gradient(to right, #8DBF58, #6A9E3E); }

/* Rouge Brique (Diversification) */
.category-Sauces .category-header { background: linear-gradient(to right, #D9534F, #C9302C); }

/* ============================================================================== */