
/* === Global Styles === */
body {
    font-family: 'Roboto', sans-serif;
    /*font-family: Arial, Helvetica, sans-serif;*/
    background-color: #f8f8f8;
    margin: 0;
    padding: 20px;
}

/* === Banner Styles === */
.banner {
    background-image: url('../data/images/Recette01.jpg');
    background-size: cover;
    background-position: center;
    color: #fff;
    text-align: center;
    padding: 50px 20px;
}

.banner-title {
    font-size: 2.5em;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 12px; /* Espace pour l'icône */
    border: 1px solid #ddd;
    border-radius: 0; /* Suppression de l'arrondi */
    font-size: 1em;
    outline: none;
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: #333;
    pointer-events: none; /* Rend l'icône non cliquable */
}

/* === Dropdown Styles === */
.dropdown {
    position: relative;
    width: 200px;
}

.dropdown-container {
    position: relative;
}

/* === Dropdown container === */
.dropdown-options {
    display: none; /* Par défaut caché */
    opacity: 0;
    list-style: none;
    padding: 0;
    margin: 5px 0 0;
    max-height: 200px; /* Ajustez la hauteur si nécessaire */
    overflow-y: auto;
    border: 1px solid #ddd;
    background: #fff;
    position: absolute;
    width: 100%;
    z-index: 10;
    transform: scaleY(0);
    transform-origin: top;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.dropdown-options.show {
    display: block; /* Affiche le dropdown */
    opacity: 1;
    transform: scaleY(1);
}

.dropdown-options li {
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-options li:hover {
    background-color: #f8f8f8;
}

/* === Search input === */
.dropdown-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 0; /* Suppression de l'arrondi */
    font-size: 1em;
    outline: none;
}



.dropdown-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

.dropdown-input::placeholder {
    color: #aaa;
}

/* === Selected Filters Badges === */
.selected-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px;
}


.badge {
    background-color: #007bff;
    color: #fff;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge .remove {
    background-color: #fff;
    color: #007bff;
    border: none;
    font-size: 1em;
    padding: 0 5px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.badge .remove:hover {
    background-color: #ff0000;
    color: #fff;
}

/* === Recipe Grid and Cards === */
.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

/* === Recipe Card === */
.recipe-card-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: #fff;
    overflow: hidden;
    width: 100%;
    max-width: 350px;
    margin: auto;
    max-height: 550px; /* Augmente la hauteur maximale */
}

/* Image Section */
.recipe-card-img {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.recipe-card-img img {
    width: 100%; /* Image prend toute la largeur */
    height: 100%;
    object-fit: cover;
}

.recipe-card-img .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3); /* Overlay semi transparent */
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.2em;
    text-transform: uppercase;
    opacity: 0; /* Par défaut invisible */
    transition: opacity 0.3s ease;
}

.recipe-card-img:hover .overlay {
    opacity: 1;
}

/* Content Section */
/*
.recipe-card-content {
    text-align: left;
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
    min-height: 475px;
    overflow: hidden;
}*/
.recipe-card-content {
    min-height: 350px;
    max-height: unset;
    overflow-y: auto;
    padding: 16px;
    box-sizing: border-box;
}
/*
.recipe-card-content {
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}*/


.recipe-title {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.recipe-subtitle,
.ingredients-title {
    font-size: 0.9em;
    text-transform: uppercase;
    font-weight: bold;
    color: #777;
    margin-bottom: 12px;
    margin-left: 0; /* Pas de marge à gauche */
}



.recipe-description {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 16px;
    line-height: 1.4em;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Limite à 3 lignes */
    -webkit-box-orient: vertical;
    overflow: hidden; /* Coupe le texte qui dépasse */
    text-overflow: ellipsis; /* Ajoute "..." pour les textes coupés */
    white-space: normal; /* Permet le retour à la ligne */
}


/* Ingredients List */
.ingredients-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px; /* Ajout d'un espacement vertical légèrement plus grand */
    margin-top: 8px;
    color: #666;
}



.ingredient {
    font-size: 0.9em;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column; /* Aligne les éléments en colonne */
    margin-bottom: 4px; /* Séparation avec la quantité */
}

.ingredient strong {
    font-weight: bold;
}


.ingredient-quantity {
    font-size: 0.85em;
    color: #777;
}

.ingredient span {
    font-size: 0.85em;
    color: #777;
}

/* === Filter Section === */
.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
}

.filter-left {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.filter-right {
    display: flex;
    gap: 15px;
}


/* === Pagination === */
.pagination {
    text-align: center;
    margin-top: 16px;
}

.pagination button {
    background: #fff;
    border: 1px solid #ddd;
    margin: 0 4px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.pagination button.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.pagination button:hover:not(.active) {
    background: #f0f0f0;
}


.suggestions {
    list-style: none;
    padding: 0;
    margin: 5px 0;
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
}

.suggestions li {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.suggestions li:last-child {
    border-bottom: none;
}

.suggestions li img {
    width: 40px;
    height: 40px;
    border-radius: 5px;
    margin-right: 10px;
}

.suggestions li:hover {
    background: #f0f0f0;
}


.search-container .clear-btn {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: #aaa;
    cursor: pointer;
    display: none;
}


.clear-btn {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    color: #aaa;
    cursor: pointer;
    border: none;
    background: none;
}

.search-container .clear-btn.visible {
    display: inline;
}


/* === No Results Message === */
main p {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    margin: 20px 0;
}

main p strong {
    color: #333;
    font-weight: bold;
}

/* Tags */
.tag {
    background-color: #e9ecef;
    color: #495057;
    padding: 6px 12px;
    border-radius: 16px;
    margin: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s;
}

.tag:hover {
    background-color: #28a745;
    color: white;
}

.active-tag {
    background-color: #28a745;
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    margin: 4px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tag-remove {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.tag-remove:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}

#selected-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

#tags-container {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.show-more-tags,
.back-to-limited-tags {
    display: block;
    margin: 10px auto;
    padding: 8px 12px;
    font-size: 14px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    cursor: pointer;
    text-align: center;
}

.show-more-tags:hover,
.back-to-limited-tags:hover {
    background-color: #ddd;
}


.no-display {
    position: absolute;
    clear: rect(1px, 1px, 1px, 1px); /* Masque visuellement */
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
}


/* === Media Queries === */
/* Largeur ≤ 400px : Une colonne */

@media (max-width: 992px) {
    .filter-header {
        flex-wrap: wrap;
    }

    .filter-left {
        flex-basis: 100%;
        text-align: left;
    }

    .filter-right {
        flex-basis: 100%;
        justify-content: space-between;
        gap: 10px;
    }

    .dropdown {
        flex-grow: 1;
        width: 100%;
    }
}

/* Moyens écrans : Ajustement des filtres et des recettes */
@media (max-width: 768px) {
    .filter-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-right {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .dropdown {
        width: 100%;
    }
}

/* Petits écrans (≤ 700px) : Deux colonnes pour les recettes */
@media (max-width: 700px) {
    .search-container {
        max-width: 90%;
        margin: 0 auto;
    }

    .search-input {
        font-size: 0.9em;
        padding: 10px 40px 10px 10px;
    }

    /* Grille des cartes ajustée */
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .recipe-card-container {
        max-width: 100%;
        margin: 0 auto;
    }

    .recipe-card-img {
        height: 150px;
    }
}

/* Très petits écrans (≤ 600px) : Toujours deux colonnes */
@media (max-width: 600px) {
    .grid-container {
        grid-template-columns: 1fr; /* Une colonnes */
        gap: 15px;
    }
}

@media (max-width: 576px) {
    .filter-header {
        gap: 10px;
    }

    .filter-left {
        font-size: 0.9em;
    }

    .filter-right {
        flex-direction: column;
        align-items: stretch;
    }

    .dropdown {
        width: 100%;
    }
}

@media (max-width: 480px) {

    .search-input {
        font-size: 0.8em;
    }

    .recipe-card-content {
        padding: 12px;
        min-height: unset;
    }

    .ingredients-list {
        gap: 8px;
    }

    .recipe-image {
        height: 150px;
    }
}

/* Largeur d'écran ≤ 400px : Une colonne */
@media (max-width: 400px) {
    .grid-container {
        grid-template-columns: 1fr; /* Une seule colonne */
        gap: 8px; /* Espacement réduit pour les très petits écrans */
    }
}

/* Bannière et barre de recherche pour écrans très petits */
@media (max-width: 400px) {
    .banner-title {
        font-size: 1.5em; /* Réduction de la taille du texte */
        margin-bottom: 10px; /* Moins d'espace en bas */
        padding: 10px; /* Réduction des marges */
    }

    .search-container {
        max-width: 100%; /* S'adapte à toute la largeur */
        margin: 0 auto;
        padding: 0 10px; /* Ajout de padding pour éviter que la barre touche les bords */
    }

    .search-input {
        font-size: 0.8em; /* Texte plus petit dans la barre de recherche */
        padding: 8px 30px 8px 8px; /* Ajustement du padding */
    }

    .search-icon {
        font-size: 1em; /* Réduction de l'icône */
        right: 8px; /* Ajuste la position de l'icône */
    }

    .clear-btn {
        right: 35px; /* Ajuste la position du bouton de suppression */
    }
}
