/**
 * Styles pour les cartes d'entités dans les articles
 * 
 * IMPORTANT: Ce fichier ajoute les styles génériques pour .theme-card
 * qui sont normalement scopés à #ingredientsTable et #ustensilesTable
 * dans page-ingredients-ustensiles-cards.css
 * 
 * Les styles de .recipe-card sont déjà génériques dans components/recipe-card.css
 */

/* ============================================
   GRILLE POUR LES CARTES D'ENTITÉS
   Identique aux pages categories.php, ingredients.php, etc.
   ============================================ */

.article-entity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin: 24px 0;
    width: 100%;
}

/* ============================================
   CONTAINER POUR UNE CARTE UNIQUE (fallback)
   ============================================ */
.article-entity-block {
    margin: 0;
    width: 100%;
}

/* Si une carte est seule (pas dans une grille), la centrer et limiter sa largeur */
.article-content > .article-entity-block {
    max-width: 320px;
    margin: 24px auto;
}

/* ============================================
   STYLES GÉNÉRIQUES POUR .theme-card
   (Ingrédients, Ustensiles, Thèmes dans les articles)
   Copie des styles de page-ingredients-ustensiles-cards.css
   sans le scope #ingredientsTable / #ustensilesTable
   ============================================ */

/* Structure de la carte */
.article-entity-grid .theme-card,
.article-entity-block .theme-card {
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    height: 100%;
}

.article-entity-grid .theme-card:hover,
.article-entity-block .theme-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.dark-mode .article-entity-grid .theme-card,
.dark-mode .article-entity-block .theme-card {
    background-color: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dark-mode .article-entity-grid .theme-card:hover,
.dark-mode .article-entity-block .theme-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

/* ============================================
   IMAGE - INGRÉDIENTS ET USTENSILES
   (fond blanc + object-fit: contain)
   ============================================ */

.article-ingredient-block .theme-image,
.article-ustensile-block .theme-image {
    height: 280px;
    overflow: hidden;
    position: relative;
    z-index: 10;
    background-color: #FFF;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.article-ingredient-block .theme-image img,
.article-ustensile-block .theme-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: var(--transition);
}

.article-ingredient-block .theme-card:hover .theme-image img,
.article-ustensile-block .theme-card:hover .theme-image img {
    transform: scale(1.08);
}

/* Mode sombre - GARDER LE FOND BLANC pour ingrédients/ustensiles */
.dark-mode .article-ingredient-block .theme-image,
.dark-mode .article-ustensile-block .theme-image {
    background-color: #FFF;
}

/* ============================================
   IMAGE - THÈMES
   (object-fit: cover, pas de fond blanc)
   ============================================ */

.article-theme-block .theme-image {
    height: 280px;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.article-theme-block .theme-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.article-theme-block .theme-card:hover .theme-image img {
    transform: scale(1.08);
}

/* ============================================
   IMAGE - RECETTES
   Les styles de .recipe-card sont déjà définis
   dans components/recipe-card.css
   Ici on ajoute seulement les overrides nécessaires
   pour le contexte des articles
   ============================================ */

/* IMPORTANT: La carte de recette ne doit PAS prendre 100% de hauteur
   sinon elle s'étend sur toute la grille quand mélangée avec .theme-card */
.article-entity-grid .recipe-card,
.article-entity-block .recipe-card {
    height: auto;
}

/* Hauteur d'image cohérente */
.article-entity-grid .recipe-image,
.article-entity-block .recipe-image {
    height: 280px;
    overflow: hidden;
    position: relative;
}

/* S'assurer que l'image remplit son container */
.article-entity-grid .recipe-image img,
.article-entity-block .recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Harmoniser le contenu de la recette avec .theme-content */
.article-entity-grid .recipe-content,
.article-entity-block .recipe-content {
    padding: 15px 20px 20px 20px;
    background-color: #1E2A3B;
    color: #ffffff;
}

.dark-mode .article-entity-grid .recipe-content,
.dark-mode .article-entity-block .recipe-content {
    background-color: var(--card-bg);
}

.article-entity-grid .recipe-header,
.article-entity-block .recipe-header {
    padding: 0;
    min-height: auto;
}

.article-entity-grid .recipe-title,
.article-entity-block .recipe-title {
    margin: 0 !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    color: white !important;
    min-height: 3rem;
}

/* ============================================
   BADGES
   ============================================ */

.article-entity-grid .theme-badges,
.article-entity-block .theme-badges {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    z-index: 20 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Badge compteur de recettes - Vert émeraude */
.article-entity-grid .theme-badge.recipe-count-badge,
.article-entity-block .theme-badge.recipe-count-badge,
.article-entity-grid .theme-badges .theme-badge,
.article-entity-block .theme-badges .theme-badge {
    background-color: rgb(5, 150, 105) !important;
    color: #ffffff !important;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
    backdrop-filter: blur(4px) !important;
    text-decoration: none !important;
}

/* Badge prix par personne - identique à categories.php (.badge-price) */
.article-entity-grid .recipe-tags .recipe-tag.price-tag,
.article-entity-block .recipe-tags .recipe-tag.price-tag,
.article-recette-block .recipe-tags .recipe-tag.price-tag,
.article-content .recipe-tags .recipe-tag.price-tag {
    background-color: rgba(36, 138, 189, 0.95) !important; /* Bleu #248ABD */
    padding: 5px 12px !important;
    border-radius: 20px !important;
    color: #ffffff !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
    backdrop-filter: blur(8px) !important;
}

/* ============================================
   CONTENU DE LA CARTE
   ============================================ */

.article-entity-grid .theme-content,
.article-entity-block .theme-content {
    padding: 15px 20px 20px 20px;
    background-color: #1E2A3B;
    color: #ffffff;
    display: flex;
    flex-direction: column;
}

.dark-mode .article-entity-grid .theme-content,
.dark-mode .article-entity-block .theme-content {
    background-color: var(--card-bg);
}

/* Titre */
.article-entity-grid .theme-content h3,
.article-entity-block .theme-content h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: white;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: 3rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablettes (769px - 1024px) : 3 colonnes */
@media (max-width: 1024px) and (min-width: 769px) {
    .article-entity-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
    }
}

/* Tablettes portrait et grands mobiles (321px - 768px) : 2 colonnes */
@media (max-width: 768px) and (min-width: 321px) {
    .article-entity-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin: 20px 0;
    }

    .article-content > .article-entity-block {
        max-width: 100%;
    }

    .article-ingredient-block .theme-image,
    .article-ustensile-block .theme-image,
    .article-theme-block .theme-image,
    .article-entity-grid .recipe-image,
    .article-entity-block .recipe-image {
        height: 210px;
    }

    .article-entity-grid .theme-content,
    .article-entity-block .theme-content {
        padding: 15px;
    }

    .article-entity-grid .theme-content h3,
    .article-entity-block .theme-content h3 {
        font-size: 1.05rem;
    }
}

/* Très petits écrans (≤ 320px) : 1 colonne */
@media (max-width: 320px) {
    .article-entity-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .article-ingredient-block .theme-image,
    .article-ustensile-block .theme-image,
    .article-theme-block .theme-image,
    .article-entity-grid .recipe-image,
    .article-entity-block .recipe-image {
        height: 180px;
    }

    .article-entity-grid .theme-content,
    .article-entity-block .theme-content {
        padding: 12px;
    }

    .article-entity-grid .theme-content h3,
    .article-entity-block .theme-content h3 {
        font-size: 0.9rem;
    }
}
