* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
    font-family: "Montserrat Thin", sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image:
        linear-gradient(rgba(230, 230, 230, 0.6), rgba(230, 230, 230, 0.7)),
            url('./public/bg.png');
    background-size: 120%;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    gap: 1rem;
}

a {
    text-decoration: none;
    color: black;
}

.content {
    flex: 1 0 auto;
}

.container {
    max-width: 1200px;
    width: 95%;
    margin: 0 auto;
}

header {
    width: 100%;
    border-radius: .5rem;
    display: flex;
    justify-content: space-between;
    padding: .5rem;
    align-items: center;
    background: #fff;

    .logo {
        text-decoration: none;
        font-size: 1.75rem;
        color: black;
        font-weight: 800;

        img {
            width: 150px;
        }
    }
}

.btn {
    width: max-content;
    height: max-content;
    text-decoration: none;
    color: black;
    display: inline-flex;
    padding: .5rem 1rem;
    border-radius: .5rem;
    transition: all .3s ease-in-out;
    text-align: center;
    justify-content: center;
    cursor: pointer;
    background: white;


    &:hover {
        transform: translateY(-5px);
    }

    &.active {
        background: limegreen;
        color: white;

        &:hover {
            background: #2db82d;
        }
    }

    &.edit {
        background: #eaf4fb;
        color: #2980b9;

        &:hover {
            transform: none;
            background: #d4e6f5;
        }
    }

    &.delete {
        background: #fdeded;
        color: #c0392b;

        &:hover {
            transform: none;
            background: #fcd5d5;
        }
    }

    &.show {
        background: limegreen;
        color: white;
        margin-left: auto;

        &:hover {
            transform: none;
            background: #2db82d;
        }
    }
}

/*  Главная страница  */
.category_list {
    margin-top: -1rem;
    overflow-x: scroll;
    scrollbar-width: none;
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: flex-start;
    padding: 1rem;

    a {
        text-wrap: nowrap;

        &:hover {
            transform: translateY(-4px);
            box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
        }
    }
}

.filters {
    display: flex;
    justify-content: flex-end;
    width: 1100px;
    margin-bottom: 1rem;
    gap: 1rem;

    .view {
        display: flex;
        gap: .5rem;
        background: white;
        border-radius: 9px;
        justify-content: center;
        align-items: center;
        padding: 1px;

        .btn:hover {
            transform: none;
        }

        img {
            width: 18px;
            height: 18px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }
}

.recipes {
    max-width: 1100px;
    gap: 1.5rem;

    &.grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    &.lines {
        display: flex;
        flex-direction: column;
    }
}

.recipe {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px 22px 22px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #ededf2;

    &:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    }

    .title {
        font-size: 20px;
        font-weight: 700;
        margin-bottom: 6px;
        color: #1a2632;
        line-height: 1.3;
    }

    .meta {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 16px;
        font-size: 14px;
        color: #6b7a8a;
        margin-bottom: 6px;

        .category {
            background: #ecf0f1;
            padding: 2px 12px;
            border-radius: 30px;
            font-size: 12px;
            font-weight: 600;
            color: #2c3e50;
        }

        .time {
            display: flex;
            align-items: center;
            gap: 4px;
        }
    }

    .rating {
        color: #f1c40f;
        font-size: 18px;
        letter-spacing: 2px;
        margin: 6px 0 10px;

        .empty-star {
            color: #dce0e6;
        }
    }

    .description {
        font-size: 14px;
        line-height: 1.6;
        color: #3d4a5c;
        flex: 1;
        margin-bottom: 16px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        overflow: hidden;
        white-space: pre-line;
    }

    .actions {
        display: flex;
        gap: 12px;
        border-top: 1px solid #f0f2f5;
        padding-top: 16px;
        flex-wrap: nowrap;

        a {
            padding: 6px 16px;
            border-radius: 6px;
            font-size: 14px;
            font-weight: 500;
            transition: background 0.2s, color 0.2s;
            display: inline-flex;
            align-items: center;
            flex-wrap: nowrap;
            gap: 6px;
        }
    }
}

.pagination {
    width: 750px;
    display: flex;
    justify-content: center;
    padding-top: 1rem;
    gap: 1rem;

    overflow-x: scroll;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

/*  Нет рецептов  */
.empty_recipe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;

    h3 {
        font-size: 3rem;
    }

    p {
        font-size: 1.2rem;
        text-wrap: balance;
    }
}


/*  Страница создание | редактирования  */
form {
    width: 650px;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
    margin: 0 auto;

    label {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: .5rem;

        span {
            font-size: 1.1rem;
            color: black;

            i {
                color: gray;
            }
        }

        input, textarea {
            width: 100%;
            border-radius: .5rem;
            border: 1px solid white;
            padding: .75rem .5rem;
            font-size: 1.25rem;
            outline: none;
            resize: none;

            &:focus {
                border: 1px solid limegreen;
            }
        }
    }

    button {
        border: none;
        width: 100% !important;
        text-align: center;
    }
}

/*  Страница просмотра рецепта  */
.recipe_wrapper {
    margin-top: 1rem;
    display: grid;
    gap: 1rem;
    grid-template-columns: 450px auto;
    grid-template-areas:
            "title meta"
            "create_at create_at"
            "ingredients description"
            "rating rating";

    .title {
        grid-area: title;
        text-wrap: nowrap;
    }

    .meta {
        grid-area: meta;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        gap: 1rem;

        .category {
            background: #ecf0f1;
            padding: 2px 12px;
            border-radius: 30px;
            font-size: .85rem;
            font-weight: 500;
            color: #2c3e50;
        }

        .time {
            display: flex;
            align-items: center;
            gap: 4px;
        }
    }

    .create_at {
        margin-top: -1rem;
        color: gray;
        font-size: .85rem;
        grid-area: create_at;
    }

    .ingredients {
        grid-area: ingredients;
        position: sticky;
        align-self: start;
        top: 3.5rem;
        margin-top: 3rem;

        &:before {
            content: "Ингредиенты:";
            position: absolute;
            top: -3rem;
            font-size: 2rem;
            font-weight: 500;
            border-bottom: 2px solid limegreen;
        }

        tr {
            display: flex;
            justify-content: space-between;
            align-items: flex-end;
            border-bottom: 1px dashed #ccc;
        }
    }

    .description {
        grid-area: description;
        font-size: 1.1rem;
        position: relative;
        margin-top: 3rem;
        white-space: pre-line;

        &:before {
            content: "Этап готовки:";
            position: absolute;
            top: -3rem;
            font-size: 2rem;
            font-weight: 500;
            border-bottom: 2px solid limegreen;
        }
    }

    .rating {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        grid-area: rating;
        font-size: 2rem;
        border-top: 1px solid #ccc;
        padding: 1rem;

        a {
            color: #f1c40f;
            transition: all .1s ease-in-out;

            &.empty-star {
                color: #a8a8a8;
            }

            &:hover {
                transform: translateY(-5px);
            }
        }

        p {
            margin-left: 1rem;

            span {
                font-size: 1.5rem;
                color: #a8a8a8;
            }
        }
    }
}