/* styles.css */

:root {
    /* Светлая мультиколорная палитра */
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --text-light: #475569;

    /* Мультиколор акценты */
    --color-sunrise: #f59e0b;
    /* Завтрак - оранжевый */
    --color-midday: #10b981;
    /* Обед - зеленый */
    --color-evening: #8b5cf6;
    /* Ужин - фиолетовый */
    --color-snack: #ef4444;
    /* Перекус - красный */

    /* Дополнительные цвета */
    --color-blue: #3b82f6;
    --color-pink: #ec4899;
    --color-cyan: #06b6d4;
    --color-lime: #84cc16;
    --color-amber: #f59e0b;
    
    /* Переменные для совместимости с auth.css */
    --primary: #3b82f6;
    --secondary: #8b5cf6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --gray: #64748b;
    --light-gray: #e2e8f0;

    /* Градиенты */
    --gradient-sunrise: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-midday: linear-gradient(135deg, #10b981, #34d399);
    --gradient-evening: linear-gradient(135deg, #8b5cf6, #a78bfa);
    --gradient-snack: linear-gradient(135deg, #ef4444, #f87171);

    /* Тени */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.15);

    /* Скругления */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* Хлебные крошки (Breadcrumbs) для SEO и навигации */
.breadcrumbs {
    display: none;
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-gray);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    margin: 0 0.5rem;
    color: var(--text-gray);
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--text-dark);
    font-weight: 500;
}

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

body {
    font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
        url('/static/images/fon.jpg') center/cover no-repeat fixed;
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

/* Обновленная навигация */
.navbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--card-border);
    box-shadow: var(--shadow-sm);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: auto;
    order: 2;
}

.lang-switcher__btn {
    color: var(--text-muted, #94a3b8);
    text-decoration: none;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.lang-switcher__btn:hover {
    color: var(--text-primary, #f8fafc);
    background: rgba(255, 255, 255, 0.06);
}

.lang-switcher__btn.is-active {
    color: var(--accent, #8b5cf6);
}

.lang-switcher__sep {
    color: var(--text-muted, #64748b);
    user-select: none;
}

/* Стили для логотипа */
.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    gap: 12px;
}

.logo-img {
    height: 45px;
    width: auto;
    transition: transform 0.3s ease;
}

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

.logo-text {
    font-weight: 700;
    font-size: 1.3rem;
    background: linear-gradient(45deg, #6a11cb, #2575fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text-img {
    height: 26px;
    width: auto;
    display: block;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    width: 48px;
    height: 48px;
}

.nav-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.nav-menu a:hover::before {
    left: 100%;
}

.nav-menu a:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
}

.nav-menu a:hover i {
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink), var(--color-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu a.active {
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    border-color: transparent;
    transform: translateY(-2px);
}

.nav-menu a.active i {
    background: linear-gradient(135deg, #ffffff, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: brightness(1.2);
}

.nav-menu a.active::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.nav-menu a i {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu a:hover i {
    transform: scale(1.15);
}

.nav-menu a.active i {
    transform: scale(1.2);
}

/* Стили для кнопок авторизации и выхода */
.nav-auth {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-auth {
    padding: 0.75rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-auth i {
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-auth:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-auth:hover i {
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink), var(--color-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.username-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: opacity 0.3s;
}

.username-link:hover {
    opacity: 0.8;
}

.username {
    font-weight: 500;
    color: var(--secondary);
    padding: 0.5rem 1rem;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 8px;
    display: inline-block;
}

.btn-logout {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-logout i {
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-logout:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-logout:hover i {
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink), var(--color-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Герой-секция */
.hero {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg,
            var(--color-blue),
            var(--color-pink),
            var(--color-amber),
            var(--color-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Сетка дней с карточками рецептов */
.meal-day {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 200%;
    animation: gradientShift 10s ease infinite;
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.meal-day::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    pointer-events: none;
    z-index: 0;
}

.meal-day > * {
    position: relative;
    z-index: 1;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.meal-day:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.day-header {
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid #f1f5f9;
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 8px;
}

.meal-day .day-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.day-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.day-number {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.meal-day .day-number {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.day-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.meal-day .day-name {
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.day-summary {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-gray);
    font-size: 0.95rem;
}

.meal-day .summary-item {
    color: rgba(255, 255, 255, 0.9);
}

.summary-item i {
    color: var(--color-blue);
}

.meal-day .summary-item i {
    color: rgba(255, 255, 255, 0.8);
}

/* ОБНОВЛЕННАЯ СЕТКА РЕЦЕПТОВ - 5 КАРТОЧЕК В РЯД НА ДЕСКТОПЕ, 2 НА МОБИЛЬНОМ */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .recipes-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    .recipe-card .recipe-title {
        font-size: 1.2rem;
    }
    .recipe-card .nutrition-value {
        font-size: 1.2em;
    }
    .recipe-card .nutrition-label {
        font-size: 0.65rem;
    }
}

@media (min-width: 1536px) {
    .recipes-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 2rem;
    }
}

/* Обновленная КАРТОЧКА РЕЦЕПТА */
.recipe-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 1px solid var(--card-border);
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

/* Картинка рецепта с наложением */
.recipe-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.recipe-card:hover .recipe-image img {
    transform: scale(1.1);
}

.image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 1.5rem 1rem 1rem;
}

.meal-type-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.recipe-card.breakfast .meal-type-badge {
    background: var(--gradient-sunrise);
    color: white;
}

.recipe-card.lunch .meal-type-badge {
    background: var(--gradient-midday);
    color: white;
}

.recipe-card.dinner .meal-type-badge {
    background: var(--gradient-evening);
    color: white;
}

.recipe-card.snack .meal-type-badge {
    background: var(--gradient-snack);
    color: white;
}

.recipe-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-dark, #1e293b);
    margin: 0;
    line-height: 1.3;
}

.image-overlay .recipe-title {
    color: white;
}

/* Заголовок карточки без фото (ИИ-план и др.) */
.recipe-card-head {
    position: relative;
    padding: 2.75rem 0.9rem 0.85rem;
    min-height: 3.5rem;
}

.recipe-card-head .recipe-title {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.recipe-card-head .recipe-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 3;
}

.recipe-card-head--breakfast {
    background: var(--gradient-sunrise);
}

.recipe-card-head--lunch {
    background: var(--gradient-midday);
}

.recipe-card-head--dinner {
    background: var(--gradient-evening);
}

.recipe-card-head--snack {
    background: var(--gradient-snack);
}

/* Контент карточки */
.recipe-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.7);
}

.recipe-description {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    flex-grow: 1;
}

/* Информация о КБЖУ (в карточках рецепта) */
.recipe-card .nutrition-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    padding: 0;
    border-radius: var(--radius-md);
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.recipe-card .nutrition-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 52px;
    padding: 0.55rem 0.45rem;
    line-height: 1.1;
    min-width: 0;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 1px 8px rgba(15, 23, 42, 0.04);
    gap: 0.15rem;
}

.recipe-card .nutrition-value {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

/* Цвета для компонентов КБЖУ */
.nutrition-item-calories .nutrition-value {
    color: #ef4444; /* Красный для калорий */
}

.nutrition-item-protein .nutrition-value {
    color: #3b82f6; /* Синий для белков */
}

.nutrition-item-carbs .nutrition-value {
    color: #10b981; /* Зеленый для углеводов */
}

.nutrition-item-fat .nutrition-value {
    color: #f59e0b; /* Янтарный для жиров */
}

/* “Пилюли” под каждый компонент (карточки рецепта) */
.recipe-card .nutrition-item-calories {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.10), rgba(255, 255, 255, 0.78));
    border-color: rgba(239, 68, 68, 0.18);
}

.recipe-card .nutrition-item-protein {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(255, 255, 255, 0.78));
    border-color: rgba(59, 130, 246, 0.18);
}

.recipe-card .nutrition-item-carbs {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(255, 255, 255, 0.78));
    border-color: rgba(16, 185, 129, 0.18);
}

.recipe-card .nutrition-item-fat {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(255, 255, 255, 0.78));
    border-color: rgba(245, 158, 11, 0.20);
}

.recipe-card.breakfast .nutrition-value {
    color: var(--color-sunrise);
}

.recipe-card.lunch .nutrition-value {
    color: var(--color-midday);
}

.recipe-card.dinner .nutrition-value {
    color: var(--color-evening);
}

.recipe-card.snack .nutrition-value {
    color: var(--color-snack);
}

/* Переопределение цветов для карточек с типами приема пищи - приоритет у цветов компонентов */
.recipe-card.breakfast .nutrition-item-calories .nutrition-value {
    color: #ef4444;
}

.recipe-card.breakfast .nutrition-item-protein .nutrition-value {
    color: #3b82f6;
}

.recipe-card.breakfast .nutrition-item-carbs .nutrition-value {
    color: #10b981;
}

.recipe-card.breakfast .nutrition-item-fat .nutrition-value {
    color: #f59e0b;
}

.recipe-card.lunch .nutrition-item-calories .nutrition-value {
    color: #ef4444;
}

.recipe-card.lunch .nutrition-item-protein .nutrition-value {
    color: #3b82f6;
}

.recipe-card.lunch .nutrition-item-carbs .nutrition-value {
    color: #10b981;
}

.recipe-card.lunch .nutrition-item-fat .nutrition-value {
    color: #f59e0b;
}

.recipe-card.dinner .nutrition-item-calories .nutrition-value {
    color: #ef4444;
}

.recipe-card.dinner .nutrition-item-protein .nutrition-value {
    color: #3b82f6;
}

.recipe-card.dinner .nutrition-item-carbs .nutrition-value {
    color: #10b981;
}

.recipe-card.dinner .nutrition-item-fat .nutrition-value {
    color: #f59e0b;
}

.recipe-card.snack .nutrition-item-calories .nutrition-value {
    color: #ef4444;
}

.recipe-card.snack .nutrition-item-protein .nutrition-value {
    color: #3b82f6;
}

.recipe-card.snack .nutrition-item-carbs .nutrition-value {
    color: #10b981;
}

.recipe-card.snack .nutrition-item-fat .nutrition-value {
    color: #f59e0b;
}

.recipe-card .nutrition-label {
    font-size: 0.66rem;
    color: rgba(71, 85, 105, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.35px;
    line-height: 1.1;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Дополнительная информация */
.recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-gray);
    font-size: 0.85rem;
}

.meta-item i {
    font-size: 0.9rem;
}

.vitamins {
    color: var(--color-lime);
}

.difficulty {
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.difficulty:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.difficulty.easy {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.difficulty.medium {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.difficulty.hard {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Стили для времени приготовления в карточках рецептов */
.recipe-meta .meta-item .fa-clock {
    color: #3b82f6;
    font-size: 0.9rem;
}

.recipe-meta .meta-item:has(.fa-clock) span {
    color: #3b82f6;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Fallback для браузеров без поддержки :has() */
.recipe-meta .meta-item .fa-clock + span {
    color: #3b82f6;
    font-weight: 600;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Иконки действий в правом углу */
.recipe-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: flex;
    gap: 0.5rem;
    z-index: 2;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
}

.action-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.action-btn.save {
    color: #ef4444;
}

.action-btn.save.active {
    background: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

.action-btn.edit {
    color: var(--color-blue);
}

.action-btn.edit:hover {
    background: var(--color-blue);
    color: white;
}

/* Итог дня */
.day-total {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1rem;
}

.total-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.total-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.total-item {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.total-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.recipe-card.breakfast+.day-total .total-value {
    color: var(--color-sunrise);
}

.recipe-card.lunch+.day-total .total-value {
    color: var(--color-midday);
}

.recipe-card.dinner+.day-total .total-value {
    color: var(--color-evening);
}

.total-label {
    font-size: 0.85rem;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Кнопка изменения дня */
.day-change-btn {
    margin-top: 1.5rem;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.day-change-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Кнопка сохранения всего плана */
.save-all-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.3s ease;
}

.save-all-btn:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: var(--shadow-xl);
}

/* Модальное окно для подробностей */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: #f1f5f9;
    color: var(--text-gray);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #ef4444;
    color: white;
}

.modal-body {
    padding: 2rem;
}

/* Кастомный скроллбар */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--color-pink), var(--color-amber));
}

/* Анимация для карточек рецептов при наведении */
.recipe-card {
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.recipe-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
            rgba(59, 130, 246, 0.1),
            rgba(139, 92, 246, 0.1),
            rgba(236, 72, 153, 0.1));
    border-radius: var(--radius-lg);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.recipe-card:hover:before {
    opacity: 1;
}

/* Стили для иконок действий */
.action-btn {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn.save:hover {
    background: rgba(239, 68, 68, 0.35) !important;
    color: #ef4444 !important;
    transform: scale(1.15) rotate(5deg);
}

.action-btn.edit:hover {
    background: #3b82f6 !important;
    color: white !important;
    transform: scale(1.15) rotate(-5deg);
}

/* Эффект пульсации для избранного */
@keyframes pulseHeart {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.action-btn.save.active {
    animation: pulseHeart 0.6s ease;
    background: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

/* Стили для уровней сложности */
.difficulty {
    position: relative;
    overflow: hidden;
}

.difficulty:after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.difficulty:hover:after {
    left: 100%;
}

/* Эффект для кнопок выбора плана */
.btn-select-plan {
    position: relative;
    overflow: hidden;
}

.btn-select-plan:after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-select-plan:hover:after {
    left: 100%;
}

/* Анимация появления элементов */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plan-selection,
.popular-recipes {
    animation: fadeInUp 0.6s ease forwards;
}

.plan-selection {
    animation-delay: 0.1s;
}

.popular-recipes {
    animation-delay: 0.2s;
}

/* Стили для пустого состояния */
.empty-state {
    position: relative;
    overflow: hidden;
}

.empty-state:before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg,
            transparent,
            rgba(59, 130, 246, 0.1),
            transparent);
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Стили для скроллбара в модальном окне */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
}

/* Эффект тени для карточек при скролле */
.meal-day {
    position: relative;
}

.meal-day:after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 5%;
    width: 90%;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.1) 0%, transparent 70%);
    opacity: 0.3;
    z-index: -1;
}

/* Градиентные границы для выбранного плана */
.plan-card.selected {
    border-image: linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899) 1;
    animation: borderGlow 2s infinite;
}

@keyframes borderGlow {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    50% {
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    }
}

/* Container базовые стили */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem;
}

/* Обновленная адаптивность */
@media (max-width: 1024px) {
    .recipes-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .container {
        padding: 1.5rem 1rem;
    }

    .navbar {
        padding: 0.75rem 1rem;
    }

    .nav-menu {
        gap: 1rem;
    }

    .nav-menu a {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* Кнопки на планшетах */
    .btn-select-plan,
    .btn-primary,
    .btn-action {
        padding: 0.85rem 1.5rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 767px) {
    /* Навигация на мобильных - скрываем десктопное меню */
    .navbar {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        flex: 0 0 auto;
        min-width: 0;
    }

    .logo-link {
        gap: 8px;
    }

    .logo-img {
        height: 36px;
        width: auto;
    }

    .logo-text {
        font-size: 1.1rem;
        white-space: nowrap;
    }

    .logo-text-img {
        height: 22px;
    }

    /* Мобильная навигация стилизуется через mobile-menu.css */
    /* Показываем меню как ряд иконок */

    /* Hero секция */
    .hero {
        padding: 2rem 0;
    }

    .hero h1 {
        font-size: 2.2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Сетка рецептов */
    .recipes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .recipe-card {
        /* Don't downscale cards on mobile; it makes KBJU unreadable */
        font-size: 100%;
    }
    .recipe-card .recipe-title {
        font-size: 1.2rem; /* 0.8rem * 1.5 */
    }
    .recipe-card .recipe-description {
        font-size: 0.6rem;
    }
    .recipe-card .meal-type-badge {
        font-size: 0.533rem;
    }

    /* Кнопки и взаимодействие */
    .save-all-btn {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        padding: 0;
        font-size: 1.3rem;
        box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
        z-index: 999;
    }

    .save-all-btn span {
        display: none;
    }

    /* Увеличенные области касания для кнопок */
    .action-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .btn-select-plan,
    .btn-primary,
    .btn-action {
        min-height: 48px;
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .recipe-card .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        padding: 0;
    }

    .recipe-card .nutrition-value {
        font-size: 1.15rem;
    }

    .recipe-card .nutrition-label {
        font-size: 0.75rem;
    }
    
    .meal-day {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .day-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .day-summary {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .modal-content {
        max-width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem 1.5rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    .flash-messages {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .footer {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }
    
    /* Улучшения для модальных окон */
    .modal-overlay {
        padding: 0.5rem;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    .recipes-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .recipe-card .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 0;
        gap: 0.45rem;
    }
    
    .recipe-card .nutrition-value {
        font-size: 1.1rem;
    }
    
    .recipe-card .nutrition-label {
        font-size: 0.72rem;
    }

    .total-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .recipe-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .meal-day {
        padding: 1rem;
    }
    
    .day-name {
        font-size: 1.2rem;
    }
    
    .day-number {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .recipe-image {
        height: 150px;
    }
    
    .recipe-content {
        padding: 1rem;
        background: rgba(255, 255, 255, 0.7);
    }

    .recipe-content .nutrition-grid {
        margin: 0 auto;
        max-width: 260px;
    }

    .recipe-content .nutrition-value {
        font-size: 1.2rem;
    }

    .recipe-content .nutrition-label {
        font-size: 0.8rem;
    }

    .recipe-card .recipe-title {
        font-size: 1.2rem; /* 0.8rem * 1.5 */
    }
    
    .modal-content {
        max-width: 100%;
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 0.75rem 1rem;
    }
    
    .modal-title {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .save-all-btn {
        width: 45px;
        height: 45px;
        bottom: 0.75rem;
        right: 0.75rem;
        font-size: 1rem;
    }
    
    .container {
        padding: 0 0.5rem;
    }
}

/* Оптимизация для широких экранов */
@media (min-width: 1920px) {
    .recipes-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 1600px;
        margin-left: auto;
        margin-right: auto;
    }

    .recipe-image {
        height: 200px;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 3rem;
}

.footer p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-gray);
}

/* Стили для модального окна информации */
.info-content {
    max-width: 800px;
    margin: 0 auto;
}

.info-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--card-border);
}

.info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.info-section h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-section h3 i {
    color: var(--color-blue);
    font-size: 1.3rem;
}

.info-section p {
    color: var(--text-gray);
    line-height: 1.8;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.info-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.info-features li {
    padding: 0.75rem 0;
    color: var(--text-gray);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    line-height: 1.6;
}

.info-features li i {
    color: var(--color-midday);
    font-size: 1.1rem;
    margin-top: 0.2rem;
    flex-shrink: 0;
}

.info-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step-counter;
}

.info-steps li {
    counter-increment: step-counter;
    padding: 1rem 0 1rem 3.5rem;
    position: relative;
    color: var(--text-gray);
    line-height: 1.8;
    font-size: 1rem;
}

.info-steps li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 1rem;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

.info-note {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-blue);
    margin-top: 1rem;
    font-style: italic;
}

/* Адаптивность для модального окна информации */
@media (max-width: 768px) {
    .info-section h3 {
        font-size: 1.2rem;
    }
    
    .info-section p,
    .info-features li,
    .info-steps li {
        font-size: 0.9rem;
    }
    
    .info-steps li {
        padding-left: 2.5rem;
    }
    
    .info-steps li::before {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    
    .info-note {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* Блок «Скачать мобильное приложение» (partials/mobile_app_download.html) */
.mobile-app-cta {
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto 1.75rem;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    background: linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.97),
            rgba(248, 250, 252, 0.96)
        ),
        linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(236, 72, 153, 0.1));
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.mobile-app-cta__content {
    min-width: 0;
}

.mobile-app-cta__icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.mobile-app-cta__content h2 {
    margin: 0;
    font-size: 1.15rem;
    color: var(--text-dark);
}

.mobile-app-cta__content p {
    margin: 0.35rem 0 0;
    font-size: 0.92rem;
    color: var(--text-gray);
    line-height: 1.45;
}

.mobile-app-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.1rem;
    border-radius: var(--radius-full);
    text-decoration: none !important;
    color: #fff !important;
    font-weight: 700;
    font-size: 0.92rem;
    background: linear-gradient(135deg, var(--color-blue), var(--color-pink));
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-app-cta__button:hover,
.mobile-app-cta__button:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(236, 72, 153, 0.25);
    color: #fff !important;
    text-decoration: none !important;
}

@media (max-width: 768px) {
    .mobile-app-cta {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0.8rem;
    }

    .mobile-app-cta__icon {
        margin: 0 auto;
    }

    .mobile-app-cta__button {
        justify-content: center;
        width: 100%;
    }
}