@import url('https://fonts.googleapis.com/css2?family=Marck+Script&display=swap');

/* Общие стили */
html {
    background-color: #f0f0f0;
}
body {
    font-family: 'Play', sans-serif;
    margin: 0;
    background-color: #f0f0f0;
    color: #333;
}

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

/* --- Стили шапки и навигации --- */
.main-header {
    background-color: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #555;
    font-size: 1.1em;
    padding: 10px 15px;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background-color: #f0f0f0;
    color: #000;
}

.nav-link.active {
    background-color: #007bff;
    color: white;
}


main {
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
}

/* --- Стили для загрузчика --- */
.loader-container {
    padding: 60px 20px;
    text-align: center;
}
.loader {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    visibility: hidden;
}
.gallery-container.loaded {
    visibility: visible;
}

.gallery-item {
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-item img:hover {
    transform: scale(1.05);
}

.gallery-item .item-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- НОВЫЕ СТИЛИ: Витрина категорий --- */
.category-showcase {
    margin-bottom: 40px;
}

.category-showcase h2 {
    text-align: center;
    margin-bottom: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.category-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    text-decoration: none;
    color: white;
    height: 150px; /* Фиксированная высота карточки */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.card-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Масштабирует изображение, чтобы оно полностью покрывало контейнер */
    z-index: 1;
    transition: transform 0.3s ease;
}

.category-card:hover .card-background {
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.3) 100%);
    z-index: 2;
}

.card-title {
    position: absolute;
    bottom: 25px;
    left: 15px;
    right: 15px;
    margin: 0;
    font-size: 1.2em;
    font-weight: bold;
    z-index: 3;
	text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.card-count {
    position: absolute;
    bottom: 10px;
    left: 15px;
    font-size: 0.8em;
    opacity: 0.8;
    z-index: 3;
}

/* Стили для специальной карточки-кнопки */
.category-card-special {
    background-color: #007bff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.category-card-special:hover {
    background-color: #0056b3;
}

.category-card-special .card-title {
    position: static;
    font-size: 1.4em;
}

.category-card-special .card-count {
    position: static;
    opacity: 1;
    margin-top: 5px;
}


/* --- Старые стили тегов (оставляем для страницы галереи) --- */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
	margin: 10px auto;
}

.tag {
    display: inline-block;
    background-color: #f0f0f0;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    text-decoration: none;
    color: #333;
    border: 1px solid #ddd;
    transition: background-color 0.2s;
}

.tag:hover {
    background-color: #007bff;
	color: #FFF;
    border-color: #007bff;
}

.tag.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.hidden {
    display: none !important;
}

/* Стили модального окна */
body.modal-open {
    overflow: hidden;
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    background-color: rgba(0,0,0,0.85);
    /* display: flex; is now set by modal.js when opening */
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    width: 90vw;
    height: 85vh;
    max-width: 1400px;
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
}

.modal-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.modal-image-content {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    object-fit: contain;
}

.modal-info-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 10px;
}

.modal-info-container h3 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

.modal-info-container p {
    margin: 0;
    font-size: 0.9em;
    color: #555;
    white-space: pre-wrap;
    word-break: break-word;
}

.preset-button {
    display: block;
    box-sizing: border-box; /* Учитываем padding в ширине */
    width: 100%;
    padding: 10px;
    background-color: #0088cc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    text-align: center;
    text-decoration: none;
    margin-top: auto; /* Прижимаем кнопку к низу */
}

.preset-button:hover {
    background-color: #0077b3;
}

/* Стили для категорий в модальном окне */
.category-grid-modal {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-grid-modal .category-card {
    height: 60px; /* Более компактные карточки */
}

.category-grid-modal .card-title {
    font-size: 1em;
    bottom: auto;
    top: 50%;
    transform: translateY(-50%);
    left: 70px; /* Оставляем место для миниатюры */
	color: #FFF;
}

.category-grid-modal .card-count {
    display: none; /* Скрываем количество для компактности */
}

.category-grid-modal .card-background {
    width: 60px; /* Делаем миниатюру-иконку */
    height: 60px;
    border-radius: 6px;
}

.category-grid-modal .card-overlay {
    background: linear-gradient(to right, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0) 100%);
}


.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #555;
    font-size: 35px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 1050;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

@media (max-width: 768px) {
    .modal-content-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: 90vh;
        width: 95vw;
        padding: 15px;
        gap: 15px;
    }
    .modal-image-container {
        min-height: 200px;
    }
    .close {
        color: #fff;
        background-color: rgba(0,0,0,0.3);
        border-radius: 50%;
        width: 35px;
        height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
        top: 10px;
        right: 10px;
    }
    .main-header {
        flex-direction: column;
        gap: 10px;
    }
    .main-nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .share-buttons {
        /* Принудительно сохраняем flex-контейнер для мобильных */
        display: flex;
        justify-content: center;
    }
}

.recipe-block {
    background-color: #fdf5e6;
    border: 1px solid #d2b48c;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recipe-block h4 {
    margin: 0 0 15px 0;
	font-family: "Marck Script", cursive;
	font-weight: 400;
	font-style: normal;
    font-size: 2.5em;
    color: #5d4037;
    text-align: center;
}

.recipe-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9em;
}

.recipe-list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #d2b48c;
}

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

.recipe-list .param-name {
    font-weight: bold;
    color: #5d4037;
}

.recipe-list .param-value {
    color: #333;
    text-align: right;
    max-width: 70%;
    word-break: break-word;
}

/* --- Стили для кнопок "Поделиться" --- */
.share-buttons-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: center;
}

.share-buttons-container p {
    margin: 0 0 10px 0;
    font-weight: bold;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.share-btn {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 5px;
    color: #fff;
    text-decoration: none;
    font-size: 0.9em;
    transition: opacity 0.2s;
}

.share-btn:hover {
    opacity: 0.85;
}

.share-btn.telegram { background-color: #0088cc; }
.share-btn.vk { background-color: #4a76a8; }

/* Стили для иконок в навигации */
.main-nav .nav-link-icon {
    font-size: 1.4em; /* Увеличиваем размер иконки */
    padding-top: 7px;
    padding-bottom: 7px;
}