/* ===== Masonry-сетка ===== */
.masonry-grid {
    columns: 4 280px;
    column-gap: 16px;
    padding: 20px 0;
    position: relative;
    overflow: hidden; /* чтобы при пересчёте колонок не было видимых скачков */
}

/* ===== Карточка рецепта ===== */
.recipe-card {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 16px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    min-width: 160px;
    
}

.recipe-card img,
.recipe-card video {
    pointer-events: none; /* предотвращает появление контекстного меню изображения */
}

.recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.recipe-card.quick-active {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
    box-shadow: 0 12px 35px rgba(0,0,0,0.4);
    z-index: 9999;
}

.card-media {
    position: relative;
    line-height: 0;
    overflow: hidden;
}
.card-media > img,
.card-media > video {
    width: 100%;
    display: block;
    object-fit: cover;
}

.play-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    pointer-events: none;
}

.card-body {
    background: var(--surface);
    position: relative;
    z-index: 1;
    padding: 12px;
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Ленивая загрузка изображений ===== */
.lazy-img {
    background: #f0f0f0;
    min-height: 200px;
    width: 100%;
    object-fit: cover;
}

/* ===== Фильтры на главной ===== */
.filters-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    gap: 8px;
    padding: 8px;
    margin-bottom: 15px;
    background: transparent;
    border-radius: 14px;
    box-shadow: none;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

/* Кастомный скроллбар для WebKit (Chrome, Safari) */
.filters-bar::-webkit-scrollbar {
    height: 5px;
}

.filters-bar::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 4px;
}
.filters-bar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
    opacity: 0.6;
}
.filters-bar::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ===== Фильтры-кнопки с выпадающим списком ===== */
.filters-bar {
    position: relative; /* для абсолютного позиционирования dropdown */
}

.filter-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text);
    transition: border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.filter-button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-button.active {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.filter-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.filter-arrow {
    font-size: 0.8rem;
    color: inherit;
}

.filter-dropdown {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    min-width: 180px;
    padding: 4px 0;
}

.filter-option {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    transition: background 0.15s;
}

.filter-option:hover {
    background: var(--bg);
}

.filter-option.selected {
    background: var(--primary);
    color: white;
}

/* ===== Профиль ===== */
.profile-card {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}
.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}
.profile-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.profile-avatar-xl,
.profile-avatar-large {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--primary);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}
.profile-username {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}
.profile-details {
    max-width: 600px;
    margin: 0;
    padding: 0 20px;
}
.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: left;
}
.detail-icon {
    font-size: 1.4rem;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}
.detail-text {
    flex: 1;
}
.placeholder-text {
    color: #aaa;
    font-style: italic;
}
.profile-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 15px 0;
}
.profile-bio {
    font-size: 1.15rem;
    margin-bottom: 10px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.profile-meta {
    font-size: 1rem;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

/* ===== Аватар автора (крупный) ===== */
.author-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ===== Toast-уведомления ===== */
.toast-container {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}
.toast {
    background: var(--surface, #fff);
    color: var(--text, #333);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.3s, transform 0.3s;
    border-left: 4px solid var(--primary);
}
.toast.toast-info { border-left-color: var(--secondary, #2EC4B6); }
.toast.toast-like { border-left-color: #e74c3c; }
.toast.toast-comment { border-left-color: var(--primary); }
.toast.toast-error { border-left-color: #e74c3c; }

/* ===== Колокольчик уведомлений ===== */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 6px 10px;
    display: flex;
    align-items: center;
}
.bell-icon {     
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle; 
}

/* Картинки в мобильной нижней навигации */
.mobile-bottom-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
}
.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 200;
    padding: 10px;
}
.notification-item {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}
.notification-item:hover { background: var(--bg); }
.notification-item.unread {
    font-weight: bold;
    background: rgba(var(--primary-rgb, 255,107,53), 0.05);
}
.notification-item .time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-left: 10px;
}
.mark-read-btn {
    font-size: 0.8rem;
    color: var(--primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    align-self: center;
    margin-top: 5px;
    background: none;
    border: 1px solid var(--primary);
}
.mark-read-btn:hover {
    background: var(--primary);
    color: white;
}

/* ===== Выпадающее меню действий (⋮) ===== */
.actions-menu {
    position: relative;
    display: inline-block;
}
.actions-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.95rem;
    color: var(--text);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.active {
    color: var(--primary);
    font-weight: 500;
}
.dropdown-item-danger { color: #e74c3c; }
.dropdown-item-danger:hover { background: #ffeaea; }

.dropdown-item .bookmark-icon-img {
    margin-right: 6px;
}

/* ===== Новые стили для ингредиентов (create/edit) ===== */
.ingredient-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* Автокомплит продукта */
.ingredient-autocomplete {
    position: relative;
    flex: 2;
    min-width: 150px;
}
.ing-product-name {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
}
.ing-amount {
    flex: 0.8;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    width: 100%;
    box-sizing: border-box;
}
.ing-unit {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: white;
}
.ing-grams-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}
.ing-grams-value {
    font-weight: 600;
    color: var(--text);
}

.btn-remove-row {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 5px;
}
.btn-add-row {
    margin-top: 10px;
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}
.btn-add-row:hover { background: var(--primary-dark); }

/* Подсказки (выпадашка продуктов) */
.suggest-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
}
.suggest-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}
.suggest-item:hover { background: var(--bg); }

/* Сводка КБЖУ */
.nutrition-summary {
    background: var(--bg);
    border-radius: 12px;
    padding: 15px;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}
.nutrition-summary h4 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: var(--text);
}
.nutrition-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.nutrition-card {
    flex: 1;
    min-width: 80px;
    background: #FFFF00;
    border: 1px solid #FFFF00;
    border-radius: 12px;
    padding: 8px;
    text-align: center;
    box-sizing: border-box;
    max-width: 110px;
}
.nutrition-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: black;
    margin-bottom: 6px;
}
.nutrition-card-inner {
    background: white;
    border-radius: 8px;
    padding: 8px 4px;
}
.nutrition-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: black;
    line-height: 1.2;
}
.nutrition-unit {
    font-size: 0.7rem;
    color: black;
    margin-top: 2px;
}

/* ===== Строки инструкций (без изменений) ===== */
.instruction-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.instr-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.instruction-row .instr-text,
.instr-content textarea {
    min-height: 60px !important;
    height: 60px;
}
.time-container {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
}
.time-label {
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ===== Загрузка фото в шагах ===== */
.image-upload-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.btn-add-photo,
.btn-remove-photo {
    font-size: 0.9rem;
    color: var(--primary);
    background: none;
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 2px 10px;
    cursor: pointer;
}
.btn-add-photo:hover,
.btn-remove-photo:hover {
    background: var(--primary);
    color: white;
}
.instr-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 5px;
}

/* ===== Стили для форм в fieldset (как в create/edit) ===== */
.form-fieldset {
    border: none;
    padding: 0;
    margin: 0 0 20px;
}
.form-fieldset legend {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--text);
}

/* ===== Кнопка "В закладки" (нейтральная) ===== */
.btn-bookmark {
    font-size: 0.9rem;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-bookmark:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-bookmark.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== Поиск на главной (строка + подсказки) ===== */
.suggest-box {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 0;
}
.suggest-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    transition: background 0.15s;
}
.suggest-item:hover { background: var(--bg); }

/* Теги ингредиентов (поиск) */
.ingredient-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ingredient-tag {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
    cursor: default;
    transition: background 0.2s;
}

.ingredient-tag:hover {
    background: var(--primary-dark);
}

.tag-remove {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}
.tag-remove:hover { opacity: 1; }

.ingredient-list-area {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    /* НЕ задаём display: flex или none здесь — JS управляет */
}

.ingredient-list-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 4px;
    font-size: 0.9rem;
}

/* ===== Закладка (иконка в карточке) ===== */
.bookmark-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.5);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    pointer-events: none;
}

/* ===== Редактирование аватарки (профиль) ===== */
.avatar-edit-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: #f0f0f0;
}
.avatar-edit-wrapper::after {
    content: "";
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 4px solid var(--primary);
    pointer-events: none;
    z-index: 10;
}
#imageManipulator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
    z-index: 5;
    background: rgba(255,255,255,0.2);
}
#cropperImage {
    display: block;
    max-width: none;
}
#manipulatorImage {
    position: absolute;
    transform-origin: center;
    max-width: none;
}
.avatar-preview-circle {
    width: 100%;
    height: 100%;
}
.avatar-preview-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#cropperContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    overflow: visible;
    z-index: 5;
    background: rgba(255,255,255,0.3);
}

/* ===== Карусель на главной ===== */
.feed-carousel-section {
    margin-bottom: 30px;
}
.feed-carousel-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text);
}
.feed-carousel-container {
    display: flex;
    align-items: center;
    position: relative;
}
.feed-carousel {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 15px;
    flex: 1;
    padding: 5px 45px;
    scrollbar-width: none;
}
.feed-carousel::-webkit-scrollbar { display: none; }
.feed-carousel-card {
    min-width: 200px;
    max-width: 200px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    overflow: hidden;
}
.feed-carousel-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.feed-carousel-card .card-media {
    height: 140px;
    overflow: hidden;
}
.feed-carousel-card .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.feed-carousel-card .card-body {
    padding: 8px 10px;
}
.feed-carousel-card .card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.carousel-author-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 4px 10px 4px 4px;
    border-radius: 20px;
    color: white;
    font-size: 0.8rem;
}
.carousel-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.5);
}
.carousel-author-name {
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.carousel-arrow {
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text);
    transition: background 0.2s;
    flex-shrink: 0;
    width: 40px;
    height: 100%;
    position: absolute;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border-radius: 18px;
}
.carousel-arrow.left { left: 0; }
.carousel-arrow.right { right: 0; }
.carousel-author-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 4px;
    background: var(--surface);
}
.carousel-author-row .carousel-author-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}
.carousel-author-row .carousel-author-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
}
.carousel-arrow:hover { background: var(--bg); }
.feed-show-all {
    display: block;
    width: fit-content;
    margin: 15px auto 0;
}

/* Карточка ленты */
.feed-card-author-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface);
}
.feed-card-author-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.feed-card-author-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
}

.profile-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
.tab-btn {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: background 0.2s;
}
.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.draft-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 193, 7, 0.9);
    color: #856404;
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    white-space: nowrap;
    z-index: 5;
}

/* ===== Скелетоны ===== */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.skeleton-card .skeleton-img {
    width: 100%;
    height: 200px;
}
.skeleton-card .skeleton-line {
    height: 14px;
    margin: 10px;
    width: 80%;
}
.skeleton-card .skeleton-line.short { width: 50%; }
.skeleton-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px 0;
}
.skeleton-table .skeleton-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}
.skeleton-table .skeleton-cell {
    height: 20px;
    flex: 1;
}
.skeleton-recipe {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}
.skeleton-recipe .skeleton-left { width: 350px; }
.skeleton-recipe .skeleton-right { flex: 1; }
.skeleton-recipe .skeleton-img-large {
    width: 100%;
    height: 350px;
    margin-bottom: 20px;
}
.skeleton-recipe .skeleton-line {
    height: 16px;
    margin-bottom: 12px;
}
.skeleton-recipe .skeleton-line.title {
    height: 28px;
    width: 60%;
    margin-bottom: 20px;
}
.skeleton-comment {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.skeleton-comment .skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}
.skeleton-comment .skeleton-text {
    flex: 1;
    height: 14px;
    margin-bottom: 8px;
}
.skeleton-profile {
    display: flex;
    gap: 20px;
    align-items: center;
}
.skeleton-profile .skeleton-avatar-xl {
    width: 120px;
    height: 120px;
    border-radius: 50%;
}
.skeleton-profile .skeleton-line {
    height: 20px;
    width: 200px;
    margin-bottom: 10px;
}

.card-media-loading {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--border) 25%, rgba(255,255,255,0.5) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.spinner {
    border: 4px solid rgba(0,0,0,0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Отображение вычисленного веса */
.ing-grams-display {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    padding: 8px 0;
}

/* ===== Кулинарный калькулятор ===== */
.calculator-form {
    max-width: 500px;
}

.calculator-result {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    text-align: left;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
}

/* Строка с результатом и кнопкой очистки */
.calculator-result-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
}

/* Предупреждение в калькуляторе */
.calculator-warning {
    margin-top: 10px;
    padding: 10px 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 0.9rem;
}

/* ===== Боковая панель уведомлений ===== */
.notifications-panel {
    position: fixed;
    top: 10vh;
    right: -380px;
    width: 360px;
    max-width: 90vw;
    height: 80vh;
    border-radius: 16px 0 0 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: -4px 0 20px rgba(0,0,0,0.25);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.notifications-panel.open {
    right: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: white;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-panel-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: white;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
}

.panel-footer {
    display: flex;
    gap: 10px;
    padding: 12px 15px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.panel-footer .btn {
    flex: 1;
    font-size: 0.85rem;
}

.notification-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 8px;
    margin-bottom: 4px;
}

.notification-item:hover {
    background: var(--bg);
}

.notification-item.unread {
    font-weight: 600;
    background: rgba(255, 107, 53, 0.25);
    border-left: 4px solid var(--primary);
    padding-left: 8px;
    border-radius: 0 8px 8px 0;
}

.notification-item .time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-left: 10px;
}

/* Папки закладок */
.bookmark-folders-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.folders-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.folder-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: all 0.2s;
}

.folder-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.folder-count {
    font-weight: 600;
    opacity: 0.8;
}

.folder-delete {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    margin-left: 4px;
}

.bookmark-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.bookmark-remove-btn:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.folder-settings {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    margin-left: 6px;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.folder-settings:hover {
    opacity: 1;
}

/* Общие стили полей ввода (для модальных окон и любых других мест) */
.form-control {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.25s, box-shadow 0.25s;
    background: var(--bg);
    outline: none;
    color: var(--text);
    box-sizing: border-box;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.15);
}

/* Оверлей прогресса загрузки */
.upload-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-progress-container {
    background: var(--surface);
    padding: 25px;
    border-radius: 16px;
    width: 300px;
    text-align: center;
}

.upload-progress-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
    color: var(--text);
}

.upload-progress-bar {
    width: 100%;
    height: 12px;
    background: var(--bg);
    border-radius: 6px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.upload-progress-percent {
    margin-top: 10px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Индикатор загрузки медиа в карточке */
.card-media.media-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.4);
    z-index: 2;
    animation: pulse 1.5s infinite;
}

.card-media.media-loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 4px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 3;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.filter-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Инвертируем чёрные иконки фильтров в тёмной теме, чтобы они стали белыми */
[data-theme="dark"] .filter-icon {
    filter: invert(1);
    opacity: 0.85;
}

/* ===== Профиль пользователя (изолированные классы) ===== */
.user-profile-page {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 16px;
}

.user-cover-card {
    position: relative;
    margin-bottom: 60px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.user-cover {
    width: 100%;
    height: 180px;
    border-radius: 16px;
    background-size: cover;
    background-position: center;
    background-color: var(--surface);
    border: 1px solid var(--border);
}

.user-avatar-float {
    position: absolute;
    bottom: -50px;
    left: 20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid #fff;
    object-fit: cover;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.user-info {
    padding-top: 10px;
}

.user-profile-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.user-profile-bio {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 8px 0;
}

.user-profile-stats {
    display: flex;
    gap: 20px;
    margin: 10px 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.user-profile-stat strong {
    color: var(--text);
    font-weight: 700;
}

.user-profile-actions {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.user-profile-tabs {
    display: flex;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    margin-top: 20px;
}

.user-profile-tab {
    background: none;
    border: none;
    padding: 8px 12px;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    font-family: inherit;
    transition: color 0.2s;
}

.user-profile-tab:hover {
    color: var(--text);
}

.user-profile-tab.active {
    color: var(--primary);
    font-weight: 600;
}

.user-profile-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.user-profile-tab-content {
    margin-top: 15px;
}

/* ===== Бейдж времени на карточке ===== */
.card-time-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.60);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    z-index: 6;
    pointer-events: none;
    white-space: nowrap;
    line-height: 1;
}

.card-media .card-time-badge .card-time-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    filter: invert(1);
}

/* ===== Quick Actions для карточек (мобильные) ===== */
.quick-actions-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9998;
}

.quick-action-buttons {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 10000;
    pointer-events: none;
}

.quick-action-btn {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    pointer-events: auto;   /* кнопки кликабельны */
    transition: transform 0.1s, background 0.1s;
}

.quick-action-btn.active {
    transform: translate(-50%, -50%) scale(1.2);
    background: var(--primary-dark);
}

.quick-action-label {
    position: fixed;
    z-index: 10001;
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 700;
    pointer-events: none;
    white-space: nowrap;
}

/* Делаем иконку уведомлений светлой в тёмной теме */
[data-theme="dark"] .bell-icon {
    filter: invert(1);
}

/* Иконка закладки (картинка) */
.bookmark-icon-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
    flex-shrink: 0;
}

/* В бейдже на карточке иконку можно увеличить */
.bookmark-badge .bookmark-icon-img {
    width: 18px;
    height: 18px;
}

.feed-carousel-card .card-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: flex-start;   /* лайки слева, или оставьте space-between */
    align-items: center;
    gap: 10px;
}

.card-tags {
    padding: 0 12px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.card-tag {
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 15px;         /* убрали верхний отступ, остался только нижний */
}

.recipe-tags .tag {
    background: #f0f0f0;       /* светло-серый фон */
    color: #555;               /* тёмно-серый текст */
    padding: 6px 14px;
    border-radius: 10px;       /* закруглённый прямоугольник */
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.recipe-tags .tag:hover {
    background: var(--primary);
    color: #fff;
}

/* ===== Строки тегов (создание/редактирование рецепта) ===== */
.tag-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.tag-autocomplete {
    position: relative;
    flex: 1;
    min-width: 0;
}

.tag-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.tag-autocomplete .suggest-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    margin: 0;
    padding: 0;
}

.tag-autocomplete .suggest-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-autocomplete .suggest-item:hover {
    background: var(--bg);
}

/* Кнопка удаления строки тега */
.tag-row .btn-remove-row {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.tag-row .btn-remove-row:hover {
    color: var(--primary);
}

/* ===== Поисковая строка на главной ===== */
.search-bar-main {
    display: block;
    width: 100%;
    margin-bottom: 15px;
    position: relative;
}

.search-bar-main input {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--surface);
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    color: var(--text);
    box-sizing: border-box;
}

.search-bar-main input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.search-bar-main input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.15);
}

.suggest-box .suggest-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text);
    transition: background 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggest-box .suggest-item:hover {
    background: var(--bg);
}

/* Активный тег (когда выбран тег) */
.active-tag-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.active-tag-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.active-tag-chip {
    background: var(--primary);
    color: white;
    padding: 4px 10px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tag-clear-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.tag-clear-btn:hover {
    opacity: 1;
}

/* Тёмная тема */
[data-theme="dark"] .search-bar-main input,
[data-theme="dark"] .ingredient-list-area,
[data-theme="dark"] .active-tag-bar {
    background: var(--surface);
    border-color: var(--border);
}

.tag-list-area {
    display: none;
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.tag-list-area.visible { display: flex; }

/* ===== Панель фильтрации КБЖУ ===== */
.nutrition-filter-panel {
    margin-bottom: 15px;
    padding: 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.nutrition-filter-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nutrition-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.nutrition-filter-row label {
    min-width: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.nutrition-field-group {
    display: flex;
    gap: 8px;
}

.nutrition-field-group input[type="number"] {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
}

.dual-slider {
    flex: 1;
    position: relative;
    height: 40px;
}

.dual-slider input[type="range"] {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    pointer-events: none;
    height: 4px;
    background: transparent;
    -webkit-appearance: none;
}

.dual-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: all;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.dual-slider input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.slider-values {
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

#resetNutritionBtn {
    align-self: flex-start;
    margin-top: 4px;
    font-size: 0.85rem;
}

/* Двойной слайдер */
.dual-slider {
    flex: 1;
    position: relative;
    height: 40px;
}

.slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    transform: translateY(-50%);
}

.slider-fill {
    position: absolute;
    top: 50%;
    height: 4px;
    background: var(--primary);
    border-radius: 2px;
    transform: translateY(-50%);
    transition: left 0.1s, width 0.1s;
}

.dual-slider input[type="range"] {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    pointer-events: none;
    -webkit-appearance: none;
    height: 4px;
    background: transparent;
}

.dual-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    pointer-events: all;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.dual-slider input[type="range"]::-moz-range-thumb {
    pointer-events: all;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Бейдж на кнопке фильтра */
.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 5px;
    margin-left: 4px;
    font-weight: 700;
}

/* Чипы активных КБЖУ */
.nutrition-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.nutrition-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nutrition-chip .chip-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.nutrition-chip .chip-remove:hover {
    color: var(--primary);
}

/* ===== Улучшенный слайдер КБЖУ (синий/голубой) ===== */
.calories-range-display {
    font-weight: 700;
    color: var(--text);
    margin-left: 6px;
}

.calories-slider .slider-track {
    background: #b0bec5;      /* серо-голубой */
    height: 6px;
    border-radius: 3px;
}

.calories-slider .slider-fill {
    height: 6px;
    background: #42a5f5;      /* голубой */
    border-radius: 3px;
}

.calories-slider input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    background: #2196f3;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.calories-slider input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: #2196f3;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Скрыть спиннеры у числовых полей БЖУ */
.nutrition-field-group input[type="number"]::-webkit-outer-spin-button,
.nutrition-field-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.nutrition-field-group input[type="number"] {
    -moz-appearance: textfield;      /* Firefox */
    appearance: textfield;           /* современные */
}

.nutrition-filter-note {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

/* Стили индикатора прогресса */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 25px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.step-item.active .step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.step-item.completed .step-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.step-item.completed .step-circle::after {
    content: "✓";
}

.step-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.step-arrow {
    margin: 0 10px;
    font-size: 1.2rem;
    color: var(--border);
}

.auth-form.recipe-form-multistep {
    max-width: 850px;          /* расширенная форма для десктопа */
    width: 100%;
    padding: 2rem;
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.step-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.step-actions-right {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Контейнер для кнопок этапов */
.step-actions {
    margin-top: 20px;
}

.step-actions-left {
    display: flex;
    justify-content: flex-start;
}

/* Увеличенные кнопки */
.btn-lg {
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 10px;
    min-width: 180px;
    text-align: center;
}

.input-error {
    border-color: #d32f2f !important;
    border-width: 2px !important;
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
}

.field-error {
    color: #d32f2f;
    font-size: 0.85rem;
    margin-top: 4px;
}

.nutrition-warning {
    margin-top: 10px;
    padding: 10px 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 0.9rem;
}

.step-number {
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

/* Адаптивность */
@media (max-width: 480px) {
    .my-reports-header h1 {
        font-size: 1.4rem;
    }
    .report-card {
        padding: 12px;
    }
    .report-type,
    .report-status {
        font-size: 0.8rem;
        padding: 3px 10px;
    }

    .report-modal-content {
        width: 95%;
        max-height: 85vh;
        overflow-y: auto;
        padding: 16px;
        border-radius: 16px;
    }

    .report-modal-content h3 {
        font-size: 1.3rem;
    }

    .report-subtitle {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }

    .report-field {
        margin-bottom: 14px;
    }

    .report-label {
        font-size: 0.9rem;
    }

    .report-field .form-select,
    .report-field textarea.form-control {
        padding: 0.7rem 0.8rem;
        font-size: 0.9rem;
        border-radius: 10px;
    }

    .report-field textarea.form-control {
        min-height: 60px;
    }

    .report-hint {
        font-size: 0.75rem;
    }

    .report-drop-zone {
        padding: 12px;
        font-size: 0.8rem;
    }

    .report-drop-zone .drop-zone-plus {
        font-size: 1.5rem;
    }

    .report-actions {
        flex-direction: column-reverse;
        gap: 8px;
        margin-top: 15px;
    }

    .report-actions .btn {
        width: 100%;
        text-align: center;
    }
    .step-label {
        display: none;
    }
    .step-arrow {
        margin: 0 5px;
    }

    .step-actions-row {
        flex-direction: column;
        align-items: stretch;
    }
    .step-actions-left,
    .step-actions-right {
        justify-content: center;
    }
    .btn-lg {
        min-width: 100%;
        padding: 10px 16px;
        font-size: 1rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .report-modal-content {
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
        padding: 20px;
    }

    .report-modal-content h3 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .auth-form.recipe-form-multistep {
        max-width: 100%;
        padding: 1.5rem;
        margin: 10px;
    }
}

/* Обычная сетка (переключение из профиля) */
body.grid-uniform .masonry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);   /* 3 колонки на десктопе */
    column-gap: 16px;
    row-gap: 16px;
    padding: 20px 0;
    align-items: stretch;
}

/* Карточки в uniform-сетке */
body.grid-uniform .masonry-grid .recipe-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;                  /* чтобы не вылезало за колонку */
}

body.grid-uniform .masonry-grid .card-media {
    aspect-ratio: 1 / 1;           /* квадратная медиа-область */
    width: 100%;
    overflow: hidden;
}

body.grid-uniform .masonry-grid .card-media > img,
body.grid-uniform .masonry-grid .card-media > video {
    width: 100%;
    height: 100%;
    object-fit: cover;             /* изображение заполняет квадрат */
}

body.grid-uniform .masonry-grid .card-body {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 10px;
}

.share-btn {
    pointer-events: auto;
    position: relative;
    z-index: 5;
}

/* ===== Умная тёмная тема для изображений ===== */
[data-theme="dark"] .card-media > img,
[data-theme="dark"] .card-media > video,
[data-theme="dark"] .recipe-media-item,
[data-theme="dark"] .similar-recipe-card .card-media img,
[data-theme="dark"] .feed-carousel-card .card-media img {
    filter: brightness(0.85) contrast(1.05);
    transition: filter 0.3s ease;
}

/* В тёмной теме делаем иконки закладки в заголовке и мобильном баре светлыми */
[data-theme="dark"] .recipe-title-bookmark-btn img,
[data-theme="dark"] .mobile-recipe-bookmark-icon,
[data-theme="dark"] .mobile-recipe-bookmark-icon {
    filter: invert(1) brightness(1.3);
    transition: filter 0.3s ease;
}

.collection-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--surface);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.collection-card:hover { box-shadow: var(--shadow-md); }
.collection-cover { width: 100px; height: 70px; object-fit: cover; border-radius: 8px; }
.collection-info h3 { margin: 0; font-size: 1.1rem; }
.collection-author, .collection-count { margin: 4px 0 0; color: var(--text-secondary); font-size: 0.9rem; }

.collections-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.collections-tabs {
    display: flex;
    gap: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.collection-tab {
    background: none;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    position: relative;
}
.collection-tab.active {
    color: var(--primary);
    font-weight: 600;
}
.collection-tab.active::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}
.collection-status {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}
.status-private { background: #e0e0e0; color: #333; }
.status-pending { background: #ffe082; color: #856404; }
.status-published { background: #c8e6c9; color: #1e5a1e; }
.status-rejected { background: #ffcdd2; color: #b71c1c; }

/* Подборки */
.collection-detail {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 15px;
}
.collection-header {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}
.collection-cover-large {
    width: 250px;
    height: 170px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}
.collection-header-info {
    flex: 1;
    min-width: 250px;
}
.collection-header-info h1 {
    margin: 0 0 10px;
    font-size: 1.8rem;
    color: var(--text);
}
.collection-description {
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.collection-meta {
    margin: 5px 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.collection-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}
.collection-rejection {
    background: #ffcdd2;
    color: #b71c1c;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
}

/* Карточка подборки в ленте */
.collection-card-in-grid {
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}
.collection-card-in-grid:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.collection-preview-image {
    width: 100%;
    display: block;
    object-fit: cover;
    transition: opacity 0.3s;
}
.collection-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.collection-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
}
.collection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}
.collection-dot.active {
    background: var(--primary);
}

.collection-card-in-grid .card-media {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
}

.collection-card-in-grid .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collection-card-in-grid .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}


body.grid-uniform .masonry-grid .collection-card-in-grid {
    display: flex;
    flex-direction: column;
    height: 100%;
}

body.grid-uniform .masonry-grid .collection-card-in-grid .card-media {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    height: auto;
}
body.grid-uniform .masonry-grid .collection-card-in-grid .card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Навигация в карточке подборки */
.collection-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.collection-dots-container {
    display: flex;
    gap: 6px;
    align-items: center;
}

.collection-arrow {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    transition: background 0.2s, color 0.2s;
    padding: 0;
}

.collection-arrow:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.collection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}

.collection-dot.active {
    background: var(--primary);
}

.recently-viewed-section {
    margin-bottom: 30px;
}

/* Кнопка-баг (слева) */
.report-bug-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s, box-shadow 0.2s;
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.report-bug-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.report-bug-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    filter: invert(1); /* белая иконка */
}

/* Модальное окно обращения */
.report-modal-content {
    width: 520px;
    max-width: 95%;
    padding: 24px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}

.report-modal-content h3 {
    margin: 0 0 8px;
    font-size: 1.6rem;
    color: var(--text);
    font-weight: 700;
}

.report-subtitle {
    margin: 0 0 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

.report-field {
    margin-bottom: 18px;
}

.report-label {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 6px;
}

.report-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

.report-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Улучшенная зона drag-and-drop */
.report-drop-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    background: var(--bg);
    transition: background 0.2s, border-color 0.2s;
    cursor: pointer;
}

.report-drop-zone:hover,
.report-drop-zone.dragging {
    border-color: var(--primary);
    background: var(--surface);
}

.report-drop-zone .drop-zone-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.report-drop-zone .drop-zone-plus {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.report-drop-zone .attachment-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.report-attachments {
    margin: 10px 0;
}

/* Стили выпадающего списка в модальном окне обращения */
.report-field .form-select {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23636E72' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.report-field .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.15);
}

/* ===== Страница "Мои обращения" ===== */
.my-reports-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 15px;
}

.my-reports-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.my-reports-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}

/* Список карточек */
.reports-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
    display: block;
}

.report-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.report-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.report-type {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Статусы */
.report-status {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.report-status.status-new { background: #d6eaf8; color: #0c5460; }
.report-status.status-in_progress { background: #ffe082; color: #856404; }
.report-status.status-answered { background: #c8e6c9; color: #1e5a1e; }
.report-status.status-closed { background: #e0e0e0; color: #333; }

.report-message {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    margin: 8px 0;
    word-break: break-word;
}

.report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===== Пользовательское модальное окно обращения ===== */
.user-report-modal-content {
    width: 500px;
    max-width: 95%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

.user-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.user-report-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text);
}

.user-report-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0 5px;
}

.user-report-close:hover {
    color: var(--text);
}

.user-report-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-report-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.user-report-row span:first-child {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
}

.user-report-message {
    background: var(--bg);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.95rem;
    word-break: break-word;
}

.user-report-attachments,
.user-report-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-report-attachment-item,
.user-report-message-item {
    background: var(--bg);
    border-radius: 8px;
    padding: 8px;
}

.user-report-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.user-report-message-header small {
    color: var(--text-secondary);
}

.user-report-empty {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.user-report-reply textarea {
    width: 100%;
    min-height: 80px;
}

.user-report-actions {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

