/* my_recipes.css — стили страницы «Мои рецепты» */

.my-recipes-page {
    --recipes-bg: linear-gradient(165deg, #fefcf9 0%, #fdf8f0 40%, #faf5eb 100%);
    --recipes-card: #ffffff;
    --recipes-border: rgba(245, 158, 11, 0.15);
    --recipes-accent: #d97706;
    --recipes-accent-light: #fbbf24;
    --recipes-muted: #78716c;
    --recipes-text: #1c1917;
    --recipes-shadow: 0 4px 24px rgba(120, 113, 108, 0.08);
    --recipes-shadow-hover: 0 12px 40px rgba(120, 113, 108, 0.12);
}

.my-recipes-page {
    min-height: 60vh;
    padding: 2rem 1rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Секции рецептов */
.recipes-section {
    margin-bottom: 3rem;
}

.recipes-section:last-child {
    margin-bottom: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--recipes-text);
    margin: 0 0 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--recipes-border);
}

.section-title i {
    color: var(--recipes-accent);
    font-size: 1.5rem;
}

/* Загрузка */
.recipes-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1.25rem;
}

.recipes-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--recipes-border);
    border-top-color: var(--recipes-accent);
    border-radius: 50%;
    animation: recipes-spin 0.9s linear infinite;
}

.recipes-loading p {
    color: var(--recipes-muted);
    font-size: 0.95rem;
    margin: 0;
}

@keyframes recipes-spin {
    to { transform: rotate(360deg); }
}

/* Пустое состояние */
.recipes-empty {
    max-width: 480px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    text-align: center;
    background: var(--recipes-card);
    border-radius: 24px;
    box-shadow: var(--recipes-shadow);
    border: 1px solid var(--recipes-border);
}

.recipes-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(145deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--recipes-accent);
    font-size: 2rem;
}

.recipes-empty h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--recipes-text);
    margin: 0 0 0.5rem;
}

.recipes-empty p {
    color: var(--recipes-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* Сетка рецептов */
.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 {
    background: var(--recipes-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--recipes-border);
    box-shadow: var(--recipes-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--recipes-shadow-hover);
    border-color: rgba(217, 119, 6, 0.25);
}

.recipe-image {
    position: relative;
    height: 180px;
    overflow: hidden;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.recipe-rating-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.65);
    color: #fbbf24;
    font-size: 0.9rem;
    font-weight: 700;
}

.recipe-rating-badge i {
    font-size: 0.85rem;
}

.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;
}

/* Стили для badge в зависимости от типа приема пищи */
.my-recipes-page .recipe-card.breakfast .meal-type-badge {
    background: var(--gradient-sunrise);
    color: white;
}

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

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

.my-recipes-page .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-content {
    padding: 1.25rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.7);
}

.recipe-description {
    color: var(--recipes-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Информация о КБЖУ */
.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);
    background: transparent;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.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;
}

.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; /* Янтарный для жиров */
}

/* “Пилюли” под каждый компонент */
.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);
}

.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);
}

.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);
}

.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);
}

/* Цвета nutrition-value в зависимости от типа приема пищи */
.my-recipes-page .recipe-card.breakfast .nutrition-value {
    color: var(--color-sunrise);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.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;
}

/* Дополнительная информация */
.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;
}

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

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

.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() */
.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;
}

.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-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.saved {
    background: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

/* Адаптив */
@media (max-width: 768px) {
    .recipe-card {
        font-size: 87.5%;
    }
    .recipe-card .recipe-title {
        font-size: 1rem;
    }
    .recipe-card .recipe-description {
        font-size: 0.6rem;
    }
    .recipe-card .meal-type-badge {
        font-size: 0.533rem;
    }
    .recipe-card .recipe-rating-badge {
        font-size: 0.6rem;
    }
    .recipe-card .recipe-rating-badge i {
        font-size: 0.567rem;
    }
    .recipe-card .meta-item {
        font-size: 0.567rem;
    }
    .recipe-card .meta-item i,
    .recipe-card .meta-item .fa-clock {
        font-size: 0.6rem;
    }
    .recipe-card .difficulty {
        font-size: 0.533rem;
    }

    .my-recipes-page {
        padding: 1.5rem 0.75rem 2rem;
    }

    .recipes-section {
        margin-bottom: 2rem;
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .section-title i {
        font-size: 1.25rem;
    }

    .recipes-empty {
        padding: 2rem 1.5rem;
        margin: 0 0.5rem;
    }

    .recipes-empty-icon {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }

    .recipes-empty h3 {
        font-size: 1.1rem;
    }

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

    .my-recipes-page .recipe-card .nutrition-grid,
    .recipes-grid .recipe-card .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .my-recipes-page .recipe-card .nutrition-label,
    .recipes-grid .recipe-card .nutrition-label {
        font-size: 0.75rem;
    }
    .my-recipes-page .recipe-card .nutrition-value,
    .recipes-grid .recipe-card .nutrition-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .recipes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .my-recipes-page .recipe-card .nutrition-grid,
    .recipes-grid .recipe-card .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .my-recipes-page .recipe-card .nutrition-label,
    .recipes-grid .recipe-card .nutrition-label {
        font-size: 0.78rem;
    }
    .my-recipes-page .recipe-card .nutrition-value,
    .recipes-grid .recipe-card .nutrition-value {
        font-size: 1.2rem;
    }
}

/* Стили для модального окна рецепта */
.my-recipes-page .recipe-modal-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.my-recipes-page .recipe-modal-image {
    width: 100%;
    max-height: 300px;
    overflow: hidden;
    border-radius: 12px;
}

.my-recipes-page .recipe-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.my-recipes-page .recipe-modal-info h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--recipes-text);
    margin: 0 0 1rem;
}

.my-recipes-page .recipe-modal-description {
    color: var(--recipes-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.my-recipes-page .recipe-modal-nutrition {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: rgba(217, 119, 6, 0.05);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.my-recipes-page .recipe-modal-nutrition .nutrition-item {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.my-recipes-page .recipe-modal-nutrition .nutrition-label {
    font-size: 0.85rem;
    color: var(--recipes-muted);
    margin-bottom: 0.25rem;
}

.my-recipes-page .recipe-modal-nutrition .nutrition-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--recipes-accent);
}

.my-recipes-page .recipe-modal-section {
    margin-bottom: 1.5rem;
}

.my-recipes-page .recipe-modal-section h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--recipes-text);
    margin: 0 0 1rem;
}

.my-recipes-page .ingredients-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.my-recipes-page .ingredients-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--recipes-text);
}

.my-recipes-page .ingredients-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--recipes-accent);
    font-weight: bold;
}

.my-recipes-page .instructions-content {
    color: var(--recipes-text);
    line-height: 1.8;
}

.my-recipes-page .instructions-content p {
    margin: 0 0 1rem;
}

.my-recipes-page .instructions-content p:last-child {
    margin-bottom: 0;
}
