/* ============================================
   SECTION DISTRIBUTEURS (ACHETER)
   Hauteurs fixes pour alignement parfait
   Identique à ingredient.php
   Commun aux ingrédients et ustensiles
   ============================================ */

.ingredient-distributeurs-section {
    background: var(--card-bg, #ffffff);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.ingredient-distributeurs-section:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* Titre de section */
.ingredient-distributeurs-section .ingredient-section-title {
    font-weight: 700;
    color: var(--text-primary, #2d3748);
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 3px solid var(--color-primary, #ff6b6b);
}

/* ============================================
   GRILLE DE CARDS - 4 COLONNES comme ingredient.php
   ============================================ */

.distributeurs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-bottom: 30px;
    margin-top: 20px;
}

/* ============================================
   CARD DISTRIBUTEUR - Hauteur totale fixe
   ============================================ */

.distributeur-card {
    background: #2d3748;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* ✅ BOX SHADOW ajouté */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.distributeur-card:hover {
    transform: translateY(-4px);
    /* ✅ BOX SHADOW plus prononcé au hover */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* LIEN - Hauteur fixe totale */
.distributeur-card-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* ============================================
   LOGO DISTRIBUTEUR - Hauteur fixe
   ============================================ */

.distributeur-logo-container {
    background: #ffffff;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 160px; /* ✅ HAUTEUR FIXE identique à ingredient.php */
    flex-shrink: 0; /* Ne pas rétrécir */
}

.distributeur-logo {
    max-width: 100%;
    max-height: 100px; /* Hauteur max du logo lui-même */
    width: auto;
    height: auto;
    object-fit: contain;
}

.distributeur-logo-placeholder {
    width: 100px;
    height: 100px;
    background: #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    color: #718096;
}

/* ============================================
   CONTENU CARD - Hauteur fixe
   ============================================ */

.distributeur-card-content {
    padding: 20px 20px 10px 20px;
    color: #ffffff;
    flex: 1; /* Prend l'espace restant */
    display: flex;
    flex-direction: column;
    min-height: 130px; /* ✅ DESKTOP : 160px */
    /* ✅ CENTRAGE du contenu */
    align-items: center;
    text-align: center;
}

.distributeur-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #ffffff;
    line-height: 1.3;
    /* Limiter à 2 lignes pour éviter débordement */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* ✅ Centré */
    text-align: center;
    width: 100%;
}

.distributeur-marque {
    font-size: 0.9rem;
    color: #cbd5e0;
    margin: 0 0 8px 0;
    /* Limiter à 1 ligne */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* ✅ Centré */
    text-align: center;
    width: 100%;
}

.distributeur-prix {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary, #ff6b6b);
    margin: 0 0 12px 0;
    /* ✅ Centré */
    text-align: center;
    width: 100%;
}

/* ============================================
   BADGES - En bas du contenu
   ============================================ */

.distributeur-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto; /* Pousse les badges en bas */
    margin-bottom: 10px; /* Remonte les badges de 10px */
    /* ✅ Centré horizontalement */
    justify-content: center;
    width: 100%;
}

.distributeur-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-disponible {
    background: rgba(56, 161, 105, 0.2);
    color: #48bb78;
}

.badge-indisponible {
    background: rgba(229, 62, 62, 0.2);
    color: #fc8181;
}

.badge-affiliation {
    background: rgba(237, 100, 166, 0.2);
    color: #ed64a6;
    cursor: help;
}

/* ============================================
   NOTE SUR LES LIENS AFFILIÉS
   ============================================ */

.distributeurs-note {
    background: rgba(66, 153, 225, 0.1);
    border-left: 4px solid #4299e1;
    padding: 16px 20px;
    border-radius: 8px;
    margin-top: 24px;
}

.distributeurs-note p {
    margin: 0;
    color: var(--text-primary, #2d3748);
    font-size: 0.9rem;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.distributeurs-note i {
    color: #4299e1;
    margin-top: 2px;
    flex-shrink: 0;
}

/* ============================================
   MODE SOMBRE
   ============================================ */

body.dark-mode .ingredient-distributeurs-section,
html.dark-mode .ingredient-distributeurs-section {
    background: var(--card-bg, #363636);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

body.dark-mode .ingredient-distributeurs-section:hover,
html.dark-mode .ingredient-distributeurs-section:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .ingredient-distributeurs-section .ingredient-section-title,
html.dark-mode .ingredient-distributeurs-section .ingredient-section-title {
    color: #ffffff;
}

/* ✅ BOX SHADOW en mode sombre */
body.dark-mode .distributeur-card,
html.dark-mode .distributeur-card {
    background: #2d3748;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); /* Plus fort en mode sombre */
}

body.dark-mode .distributeur-card:hover,
html.dark-mode .distributeur-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); /* Encore plus fort au hover */
}

body.dark-mode .distributeur-name,
html.dark-mode .distributeur-name {
    color: #ffffff;
}

body.dark-mode .distributeur-marque,
html.dark-mode .distributeur-marque {
    color: #cbd5e0;
}

body.dark-mode .distributeurs-note,
html.dark-mode .distributeurs-note {
    background: rgba(66, 153, 225, 0.15);
    border-left-color: #63b3ed;
}

body.dark-mode .distributeurs-note p,
html.dark-mode .distributeurs-note p {
    color: #e0e0e0;
}

body.dark-mode .logo-placeholder,
html.dark-mode .logo-placeholder {
    background-color: #4b5563;
    color: #d1d5db;
}

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

/* Desktop (> 1024px) - Remonter badges de 10px supplémentaires */
@media (min-width: 1025px) {
    .distributeur-badges {
        margin-bottom: 20px; /* 10px de base + 10px supplémentaires = 20px */
    }
}

/* Tablette large (1024px - maintient 4 colonnes) */
@media (max-width: 1024px) and (min-width: 769px) {
    .distributeurs-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }

    .distributeur-logo-container {
        height: 160px; /* ✅ TABLETTE */
    }

    .distributeur-card-content {
        padding: 18px;
        min-height: 140px; /* ✅ TABLETTE : 140px */
    }
}

/* Tablette (768px - passe à 3 colonnes) */
@media (max-width: 768px) and (min-width: 481px) {
    .distributeurs-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }



    .distributeur-logo-container {
        height: 180px; /* ✅ MOBILE */
        padding: 20px;
    }

    .distributeur-logo {
        max-width: 100%;
        max-height: 100px;
    }

    .distributeur-card-content {
        padding: 16px;
        min-height: 130px; /* ✅ MOBILE : 130px */
    }

    .distributeur-name {
        font-size: 1rem;
    }

    .distributeur-prix {
        font-size: 1rem;
    }
}

/* Mobile - 2 colonnes entre 321px et 480px */
@media (max-width: 480px) and (min-width: 321px) {
    .ingredient-distributeurs-section {
        padding: 24px 20px;
        margin-bottom: 24px;
        border-radius: 12px;
    }

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



    .distributeur-logo-container {
        height: 160px;
        padding: 16px;
    }

    .distributeur-logo {
        max-width: 90%;
        max-height: 90px;
    }

    .distributeur-card-content {
        padding: 14px;
        min-height: 120px; /* ✅ PETIT MOBILE : 120px */
    }

    .distributeur-name {
        font-size: 0.95rem;
    }

    .distributeur-prix {
        font-size: 0.95rem;
    }
}

/* Très petit mobile - 1 colonne pour ≤320px */
@media (max-width: 320px) {
    .ingredient-distributeurs-section {
        padding: 20px 16px;
        margin-bottom: 20px;
    }

    .distributeurs-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }


    .distributeur-logo-container {
        height: 90px; /* ✅ TRÈS PETIT MOBILE */
        padding: 16px;
    }

    .distributeur-logo {
        max-width: 80%;
        max-height: 80px;
    }

    .distributeur-card-content {
        padding: 16px;
        min-height: 110px; /* ✅ TRÈS PETIT MOBILE : 110px */
    }

    .distributeur-name {
        font-size: 0.95rem;
    }

    .distributeur-prix {
        font-size: 0.95rem;
    }

    .distributeur-badges {
        margin-bottom: 20px; /* 10px de base + 10px supplémentaires = 20px */
    }
}
