/* Обнуление и базовые стили */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');

:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --primary-color: #bb86fc;
    --secondary-color: #03dac6;
    --text-color: #e0e0e0;
    --text-muted: #8e8e8e;
    --red-accent: #cf6679;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: 80px; /* Отступ для липкой шапки */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- ОБНОВЛЕННАЯ ШАПКА --- */
.header {
    padding: 15px 0;
    border-bottom: 1px solid var(--surface-color);
    position: fixed; /* Делаем шапку "липкой" */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(10px);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo-img {
    height: 40px;
}

.nav-links {
    display: flex;
    gap: 25px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 50px;
    transition: background-color 0.3s, color 0.3s;
}

.nav-link:hover {
    background-color: var(--primary-color);
    color: #000;
}

.nav-link.active {
    background-color: var(--secondary-color);
    color: #000;
}

/* Секция "Герой" с поиском */
.hero {
    padding: 80px 0;
    text-align: center;
    background: linear-gradient(rgba(18, 18, 18, 0.8), rgba(18, 18, 18, 0.95)), url('https://www.transparenttextures.com/patterns/clean-gray-paper.png');
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

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

.search-form {
    display: flex;
    border-radius: 50px;
    overflow: hidden;
    border: 1px solid var(--surface-color);
    background-color: var(--surface-color);
}

.search-input {
    flex-grow: 1;
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    background-color: transparent;
    color: var(--text-color);
}

.search-input:focus {
    outline: none;
}

.search-button {
    border: none;
    padding: 0 30px;
    background-color: var(--primary-color);
    color: #000;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: var(--secondary-color);
}

#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 15px 15px;
    z-index: 10;
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
}

#search-suggestions a {
    display: block;
    padding: 15px 25px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

#search-suggestions a:hover {
    background-color: var(--primary-color);
    color: #000;
}

.not-found-message {
    padding: 20px;
    color: var(--text-muted);
}
.not-found-message a {
    color: var(--secondary-color);
    font-weight: 600;
}


/* Сетка рецептов на главной */
.recipes-section {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
}

#recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.recipe-card {
    background-color: var(--surface-color);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.recipe-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(187, 134, 252, 0.2);
}

.recipe-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.recipe-card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.recipe-card-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.recipe-card-source {
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.recipe-card-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-grow: 1;
    margin-bottom: 20px;
}

.recipe-card-link {
    display: inline-block;
    text-decoration: none;
    color: var(--bg-color);
    background-color: var(--secondary-color);
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: 600;
    text-align: center;
    align-self: flex-start;
    transition: background-color 0.3s;
}

.recipe-card-link:hover {
    background-color: var(--primary-color);
}


/* --- СТИЛИ ДЛЯ СТРАНИЦЫ РЕЦЕПТА --- */
body.recipe-body {
    background-color: #1a1a1a;
    background-image: url('https://www.transparenttextures.com/patterns/subtle-carbon.png');
}

.sidebar-carousel {
    width: 320px;
    position: fixed;
    left: 40px;
    top: 120px;
}

.main-content {
    max-width: 800px;
    margin: 40px auto;
    padding-bottom: 40px;
    min-width: 0;
}

.back-button-panel {
    background-color: var(--secondary-color);
    padding: 12px 20px;
    border-radius: 50px;
    margin-bottom: 25px;
    display: inline-block;
    transition: background-color 0.3s;
}
.back-button-panel:hover {
    background-color: var(--primary-color);
}

.back-button {
    display: inline-block;
    text-decoration: none;
    color: #000;
    font-weight: 700;
    font-size: 1.2rem;
}

.sidebar-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 20px;
}

.sidebar-card {
    display: flex;
    flex-direction: column;
    background-color: var(--surface-color);
    border-radius: 15px;
    margin-bottom: 15px; 
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.sidebar-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(187, 134, 252, 0.15);
}

.sidebar-card-img {
    width: 100%;
    height: 150px; 
    object-fit: cover;
}

/* --- ИЗМЕНЕНИЕ ЗДЕСЬ --- */
.sidebar-card-title {
    background-color: #2a2a2a; /* Чуть более светлый фон для текстового блока */
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.1rem; 
    padding: 15px;     
    text-align: center;
    flex-grow: 1; /* Позволяет блоку занимать доступное место, если заголовки разной длины */
}
/* --- КОНЕЦ ИЗМЕНЕНИЯ --- */

.recipe-main-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.recipe-page h1, #recipe-title {
    font-size: 2.8rem;
    color: var(--primary-color);
    text-align: left;
}

.recipe-source {
    font-size: 1.2rem;
    color: var(--text-muted);
    text-align: left;
    margin-bottom: 30px;
}

.details-bar {
    display: flex;
    justify-content: flex-start;
    gap: 20px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.detail-item {
    background-color: var(--surface-color);
    padding: 12px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.detail-item .icon {
    font-size: 1.4rem;
}

.icon-image {
    width: 28px;
    height: 28px;
}

.recipe-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
    margin-top: 40px;
}

.recipe-ingredients {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.recipe-ingredients h3, .recipe-instructions h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--secondary-color);
}

.recipe-ingredients ul {
    list-style: none;
    padding-left: 0;
}

.recipe-ingredients li {
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}
.recipe-ingredients li:last-child {
    border-bottom: none;
}

.recipe-instructions ol {
    list-style: none;
    padding-left: 0;
    counter-reset: steps-counter;
}

.recipe-instructions li {
    background-color: var(--surface-color);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    position: relative;
    padding-left: 60px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.recipe-instructions li::before {
    counter-increment: steps-counter;
    content: counter(steps-counter);
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--primary-color);
    color: #000;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.partner-block {
    background-color: var(--surface-color);
    border-radius: 15px;
    padding: 30px;
    margin-top: 60px;
    text-align: center;
    border: 1px solid var(--primary-color);
}

.partner-block p {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.partner-button {
    display: inline-block;
    text-decoration: none;
    color: #000;
    background-color: var(--secondary-color);
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 700;
    transition: background-color 0.3s;
}

.partner-button:hover {
    background-color: var(--primary-color);
}

/* --- СТИЛИ ДЛЯ СТРАНИЦЫ "ДОБАВИТЬ РЕЦЕПТ" --- */
.form-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 40px;
    background-color: var(--surface-color);
    border-radius: 15px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--secondary-color);
}

.form-control {
    width: 100%;
    padding: 12px;
    background-color: #333;
    border: 1px solid #444;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.submit-button {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #000;
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submit-button:hover {
    background-color: var(--secondary-color);
}


/* --- ИСПРАВЛЕННЫЕ СТИЛИ ДЛЯ СТРАНИЦЫ КАТАЛОГА --- */

.page-layout {
    display: grid;
    /* Уменьшаем сайдбар, чтобы влезло 3 карточки */
    grid-template-columns: 220px 1fr; 
    gap: 30px;
    padding-top: 40px;
    padding-bottom: 40px;
}

.filters-sidebar {
    position: sticky;
    top: 120px;
    align-self: flex-start;
}

.filter-group {
    margin-bottom: 30px;
}

.filter-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.filter-button {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid transparent;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.filter-button:hover {
    background-color: #333;
}

.filter-button.active {
    background-color: var(--primary-color);
    color: #000;
    font-weight: 700;
    border-color: var(--primary-color);
}

.reset-button {
    width: 100%;
    text-align: center;
    background: transparent;
    color: var(--red-accent);
    border: 1px solid var(--red-accent);
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    margin-top: 20px;
}

.reset-button:hover {
    background-color: var(--red-accent);
    color: #000;
}

.content-main .search-container {
    margin-bottom: 40px;
}

/* Сетка теперь всегда будет стараться вместить 3 колонки */
.recipe-grid-full {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* --- СТИЛИ ДЛЯ БЛОКА-ПРИЗЫВА НА ГЛАВНОЙ --- */

.cta-block {
    text-align: center;
    background-color: var(--surface-color);
    padding: 50px 30px;
    border-radius: 15px;
    margin-top: 60px;
    border: 1px solid var(--primary-color);
}

.cta-block h2 {
    font-size: 2.2rem;
    margin-bottom: 15px;
}

.cta-block p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 30px;
}

.cta-button {
    display: inline-block;
    text-decoration: none;
    color: #000;
    background-color: var(--secondary-color);
    padding: 15px 40px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: background-color 0.3s, transform 0.3s;
}

.cta-button:hover {
    background-color: var(--primary-color);
    transform: scale(1.05);
}


/* Подвал */
.footer {
    text-align: center;
    padding: 40px 0;
    margin-top: 40px;
    border-top: 1px solid var(--surface-color);
    color: var(--text-muted);
}

/* Адаптивность */
@media (max-width: 1280px) {
    .sidebar-carousel {
        display: none;
    }
    .main-content {
        margin: 40px auto;
    }
}

@media (max-width: 992px) {
    .page-layout {
        grid-template-columns: 1fr; /* Фильтры уходят наверх */
    }
    .filters-sidebar {
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
    }
    .filter-group {
        width: 100%;
    }
    .recipe-grid-full {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Возвращаем адаптивную сетку на мобильных */
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    .nav-links {
        display: none;
    }
    .hero h1 {
        font-size: 2.5rem;
    }
    .recipe-content {
        grid-template-columns: 1fr;
    }
    .recipe-page h1, #recipe-title {
        font-size: 2.2rem;
    }
}
/* --- СТИЛИ ДЛЯ СТРАНИЦЫ 404 --- */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: calc(100vh - 200px); /* Занимает почти всю высоту экрана, минус хедер и футер */
    padding: 40px 20px;
}

.error-code {
    font-family: 'Montserrat', sans-serif;
    font-size: 12rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
    text-shadow: 0 0 15px rgba(187, 134, 252, 0.2);
}

.error-message {
    font-size: 1.5rem;
    font-weight: 700; /* Сделали текст жирнее (было 600) */
    color: var(--text-color);
    margin-top: 10px;
    margin-bottom: 15px;
}

.error-description {
    color: var(--text-muted);
    max-width: 500px;
    margin-bottom: 30px;
}

.back-home-button {
    display: inline-block;
    text-decoration: none;
    color: #000; /* Текст стал черным */
    background-color: #bb86fc; /* Основной цвет фона, как вы указали */
    padding: 18px 45px; /* Увеличили кнопку */
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.2rem; /* Увеличили шрифт на кнопке */
    transition: background-color 0.3s, transform 0.3s;
    border: none; /* Убираем рамку на всякий случай */
}

.back-home-button:hover {
    background-color: var(--secondary-color); /* Меняем цвет при наведении для контраста */
    transform: scale(1.05);
}