/* =======  Главные контейнеры  ======= */
#cocktails, #ingredients {
    max-height: 75vh;
    overflow: auto;

    h2 {
        font-weight: bold;
        color: var(--red-color);
    }

    ul {
        list-style: none;
    }

}

/* ======= Кнопка добавления  ======= */
.add {
    background: none;
    color: grey;
    border-radius: 6%;
    border-width: 2px;
    border-color: rgba(0, 0, 0, 0);
    margin: 1em;

    &:hover {
        font-weight: bold;
        color: black;
        border-color: rgba(0, 0, 0);
        background: var(--green-color);
        box-shadow: 3px 4px 4px;

    }
}

#cocktails-list, #ingredients-list {
    overflow: auto;
}

/*  ======= Список коктейлей ======= */
#cocktails-list {

}

/*  ======= Коктейль ======= */
.cocktail {
    display: flex;
    height: 12em;
    padding: 0.5em;
    border-color: white;
    border-width: 0 0 2px 0;
    border-style: solid;
    position: relative;

    img {
        width: 20%;
        flex-grow: 1;
        object-fit: contain;
    }

    h3 {
        font-weight: bold;
        color: var(--black-color);

        .telegram {
            width: 1em;
            margin-right: 0.5em;
            visibility: hidden;
            cursor: pointer;
        }

        .update {
            width: 1em;
            visibility: hidden;
            cursor: pointer;
        }

        .remove {
            margin-left: 0.5em;
            visibility: hidden;
            cursor: pointer;

            &:hover {
                color: red;
            }
        }

    }

    .cocktail-ingredients {
        height: 80%;
        display: flex;
        flex-wrap: wrap;
        flex-direction: column;
    }


    .description {
        display: flex;
        flex-direction: column;
        height: 100%;
        width: 50%;
        flex-grow: 2;
        position: relative;
    }

    .instruction {
        overflow: auto;
        max-height: 100%;
        width: 25%;
        flex-grow: 1;
        padding: 1em;
    }

}

/* Мобильная вёрстка */
@media screen and (max-width: 800px) {
    #cocktails-list {
        padding-left: 0;
    }

    .cocktail {
        font-size: 12px;

        img {
            width: 25%;
            flex-shrink: 0;
        }

        h3 {
            font-size: 1em
        }

        .cocktail-ingredients {
            flex-wrap: nowrap;
            overflow: auto;
        }

        .instruction {
            display: none;
        }
    }
}

.cocktail:hover {
    .remove, .update, .telegram {
        visibility: visible;
    }
}


/* ======= Список ингредиентов ======= */
#ingredients-list {
    display: grid;
    position: relative;
    grid-template-columns: 50% 50%;
}


/*  =======  Ингредиент ======= */
.ingredient {
    position: relative;

    img {
        height: 4em;
        /*width: 3em;*/
    }

    .update, .remove {
        position: absolute;
        display: none;
        background: none;
        border-width: 0;

    }

    .update {
        left: 10%;
        top: 20%;

        img {
            height: 2em;
            width: 2em;
        }

        &:hover {
            filter: hue-rotate(80deg);
        }
    }

    .remove {
        right: 10%;
        top: 20%;
        font-size: 1.5em;

        &:hover {
            color: red;
        }
    }

}

.ingredient:hover {
    .update, .remove {
        display: block;
    }
}

.ingredient[data-available="False"]::before, .cocktail[data-available="False"]::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(128, 128, 128, 0.5); /* Серый цвет с прозрачностью 50% */
    z-index: 1; /* Помещаем фильтр выше содержимого */
    pointer-events: none; /* Позволяет взаимодействовать с элементами под фильтром */
    border-radius: 5px; /* Опционально: скругление углов */
    border: 1px solid black;
}


/* ======= Форма добавления ингредиентов ======= */
.hide {
    display: none;
}

#new-ingredient-form {
    margin: 1em;
    padding: 1em;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    position: relative;
}

.form-header {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
    padding: 0 0.5em;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.form-row {
    display: flex;
    gap: 1em;
    align-items: center;
}

.image-upload {
    position: relative;
    width: 4em;
    height: 4em;
}

.image-upload-label {
    width: 100%;
    height: 100%;
    border: 2px dashed #ccc;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.image-upload-label span {
    font-size: 24px;
    color: #ccc;
}

.image-upload-label:hover {
    border-color: #999;
}

.image-upload-label:hover span {
    color: #999;
}

#ingredient-image {
    display: none;
}

#ingredient-name {
    width: 70%;
    border-width: 0 0 1px 0;
    background: #f9f9f9;
}

#image-preview {
    /*position: absolute;*/
    top: 0;
    left: 0;
    /*width: 100%;*/
    height: 100%;
    object-fit: cover;
}

.fields-group {
    flex: 1;
}

.form-group {
    margin-bottom: 1em;
    display: flex;
}

.form-group.availability {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.save-btn {
    position: absolute;
    right: 1em;
    bottom: 1em;
    padding: 0.3em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background-color: var(--green-color);
    color: white;
    height: fit-content;
    margin-left: auto;
}

.save-btn:hover {
    opacity: 0.9;
}


/* ======================== Форма для коктейлей ================ */
/* Форма добавления коктейлей */
#new-cocktail-form {
    margin: 1em;
    padding: 1em;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    position: relative;

    .image-upload {
        height: 6em;
        width: 6em;
    }
}

#cocktail-name {
    border-width: 0 0 1px 0;
    background: #f9f9f9;
}

#cocktail-image {
    width: 0;
}

#cocktail-image-preview {
    height: 6em;
}

.ingredients-section {
    margin-top: 1em;
    padding-top: 1em;
}

.ingredient-selector {
    display: flex;
    gap: 0.5em;
    margin-bottom: 1em;
    align-items: center;
}

#ingredient-amount {
    width: 4em;
}

.ingredient-selector select,
.ingredient-selector input {
    padding: 0.3em;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.add-ingredient-btn {
    padding: 0.3em 0.5em;
    background-color: var(--green-color);
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.selected-ingredients {
    list-style: none;
    padding: 0;
    margin: 0;

    max-height: 5em;
    overflow: auto;
}

.selected-ingredients li {
    display: flex;
    justify-content: space-between;
    padding: 0.5em;
    border-bottom: 1px solid #eee;
}

.selected-ingredients li button {
    background: none;
    border: none;
    color: red;
    cursor: pointer;
}

textarea#cocktail-instructions {
    margin-top: 1em;
    min-height: 80px;
    padding: 0.5em;
    border: 1px solid #ddd;
    border-radius: 3px;
    resize: none;
}

.text-section {
    display: flex;
    flex-direction: column;
    width: 30%;
}

/* ========== Кастомный селект ==================*/
/* Стили для кастомного селекта */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
    width: 200px;
}

.custom-select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
}

.custom-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    z-index: 1000;
    display: none;
}

.custom-select-option {
    padding: 8px;
    cursor: pointer;
}

.custom-select-option:hover {
    background-color: #f5f5f5;
}

.custom-select-option.selected {
    background-color: #e6f7e6; /* Светло-зеленый фон */
    color: #2e7d32; /* Темно-зеленый текст */
    font-weight: bold;
}

/* Скрываем оригинальный select */
.original-select {
    display: none;
}
