/* ========================================
 * PAGE-INGREDIENT-ACTIONS-BAR.CSS
 * Barre d'actions style Instagram pour ingrédients
 * ======================================== */

/* Container wrapper pour l'image et la barre d'actions */
#ingredient-image-infos {
    box-shadow: none !important;
    border-radius: 10px 10px 0 0 !important;
}

/* Container principal - Aucun background ni shadow */
.ingredient-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 4px 6px 4px;
    margin-top: -4px;
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Groupes gauche et droite */
.ingredient-actions-left,
.ingredient-actions-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Alignement vertical spécifique pour les icônes de droite */
.ingredient-actions-right .ingredient-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ingredient-actions-right .ingredient-action-btn i {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.5rem;
    line-height: 1;
}

/* Bouton d'action */
.ingredient-action-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    padding: 8px 6px;
    cursor: pointer;
    color: var(--text-color, #262626);
    font-size: 1rem;
    transition: all 0.2s ease;
    text-decoration: none;
    overflow: visible;
}

.ingredient-action-btn:hover > i,
.ingredient-action-btn:hover > .action-icon-svg {
    opacity: 0.7;
}

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

/* Icônes - taille uniforme */
.ingredient-action-btn i {
    font-size: 1.5rem;
    width: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* SVG personnalisé (nutrition) - même taille que les icônes FA */
.ingredient-action-btn .action-icon-svg {
    width: 1.8rem;
    height: 1.8rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Animation du cercle nutrition - remplissage de 0 à 75% */
.ingredient-action-btn .action-icon-svg .nutrition-circle {
    /* Circonférence = 2 * π * 160 = 1005.31 */
    stroke-dasharray: 1005.31;
    stroke-dashoffset: 1005.31; /* 0% visible par défaut */
    transform: rotate(-90deg);
    transform-origin: center;
    animation: fillNutritionCircleIngredient 1000ms ease-out 300ms forwards;
}

@keyframes fillNutritionCircleIngredient {
    from {
        stroke-dashoffset: 1005.31; /* 0% visible */
    }
    to {
        stroke-dashoffset: 251.33; /* 75% visible */
    }
}

/* ======================================
 * ÉTATS SPÉCIFIQUES
 * ====================================== */

/* Habituel actif (carotte orange) */
.ingredient-action-habituel.active i {
    color: #ff9500 !important;
}

/* Exclu actif (ban rouge) */
.ingredient-action-exclu.active i {
    color: #ed4956 !important;
}

/* Animation des boutons */
@keyframes ingredientActionAnimation {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.ingredient-action-btn.animating i {
    animation: ingredientActionAnimation 0.4s ease-in-out;
}

/* Masquer l'icône pendant le chargement */
.ingredient-action-btn.loading i {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ingredient-action-btn:not(.loading) i {
    opacity: 1;
}

/* État disabled pendant le chargement */
.ingredient-action-btn.loading {
    pointer-events: none;
}

/* Allergènes - icône (neutre par défaut, coloré si conflit) */
.ingredient-action-allergenes i {
    color: inherit;
    transition: color 0.2s ease;
}

/* Allergènes - icône avec conflit détecté */
.ingredient-action-allergenes.has-conflict i {
    color: #FF6B6B;
}

/* Nutrition - icône couleur par défaut */
.ingredient-action-nutrition i {
    color: inherit;
}

/* Partage - icône couleur par défaut */
.ingredient-action-share i {
    color: inherit;
}

/* ======================================
 * CONTENU CACHÉ DES TOOLTIPS
 * ====================================== */
.tooltip-content-hidden {
    display: none;
}

/* ======================================
 * TOOLTIPS SIMPLES POUR LES BOUTONS D'ACTION
 * Style identique aux tooltips des recettes
 * ====================================== */

.ingredient-action-btn .tooltip-text {
    position: absolute;
    bottom: calc(100% + 12px);
    left: calc(6px + 0.75rem);
    transform: translateX(-50%);
    background-color: #2a3334;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    border: 2px solid var(--savoor-coral, #FF6B6B);
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    visibility: hidden;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Flèche du tooltip */
.ingredient-action-btn .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: var(--savoor-coral, #FF6B6B);
}

/* Affichage au hover - géré par JavaScript */
.ingredient-action-btn .tooltip-text.visible {
    visibility: visible;
}

/* Mode clair pour les tooltips simples */
body.light-mode .ingredient-action-btn .tooltip-text {
    background-color: #2c3e50;
}

/* ======================================
 * MODE SOMBRE
 * ====================================== */
.dark-mode .ingredient-actions-bar {
    background: transparent;
}

.dark-mode .ingredient-action-btn {
    color: var(--text-color, #f5f5f5);
}

.dark-mode .ingredient-action-habituel.active i {
    color: #ff9500;
}

.dark-mode .ingredient-action-exclu.active i {
    color: #ed4956;
}

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

@media screen and (max-width: 768px) {
    .ingredient-actions-bar {
        padding: 10px 2px;
    }
    
    .ingredient-actions-left,
    .ingredient-actions-right {
        gap: 16px;
    }
    
    .ingredient-action-btn i {
        font-size: 1.4rem;
    }
    
    .ingredient-action-btn .action-icon-svg {
        width: 1.7rem;
        height: 1.7rem;
    }
    
    /* Masquer les tooltips simples sur tablette/mobile */
    .ingredient-action-btn .tooltip-text {
        display: none;
    }
}

@media screen and (max-width: 480px) {
    .ingredient-actions-bar {
        padding: 10px 0;
    }
    
    .ingredient-actions-left,
    .ingredient-actions-right {
        gap: 12px;
    }
    
    .ingredient-action-btn {
        gap: 5px;
        padding: 6px 2px;
    }
    
    .ingredient-action-btn i {
        font-size: 1.3rem;
    }
    
    .ingredient-action-btn .action-icon-svg {
        width: 1.6rem;
        height: 1.6rem;
    }
}

@media screen and (max-width: 320px) {
    .ingredient-actions-left,
    .ingredient-actions-right {
        gap: 8px;
    }
    
    .ingredient-action-btn i {
        font-size: 1.2rem;
    }
    
    .ingredient-action-btn .action-icon-svg {
        width: 1.5rem;
        height: 1.5rem;
    }
}
