:root {
    --bg-color: #ffffff;
    --text-main: #000000;
    --text-muted: #888888;
    --red-brand: #ff4d4f;
    --bg-gray: #f5f5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    padding-bottom: 80px; /* Місце під нижнє меню, якщо буде */
}

html {
    scroll-behavior: smooth; /* Робить прокрутку до категорії плавною */
}

.category-nav {
    position: sticky;
    top: env(safe-area-inset-top, 0);
    background-color: var(--bg-color);
    z-index: 100;
    display: flex;
    gap: 10px;
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));

    /* Додаємо плавний скрол для телефонів */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-pill {
    padding: 10px 20px;
    border-radius: 20px;
    border: none;
    background-color: var(--bg-gray);
    font-size: 16px;
    font-weight: 500;

    /* ЗАБОРОНЯЄМО кнопкам звужуватися, щоб з'явився скрол */
    flex-shrink: 0;
    white-space: nowrap;
}

.category-section {
    /* Зменшуємо відступ, щоб заголовок був ближче до меню */
    scroll-margin-top: 90px;
    padding-bottom: 20px;
}

.category-pill.active {
    background-color: var(--red-brand);
    color: white;
}

/* --- Основне меню --- */
.menu-container {
    padding: 16px;
}

.category-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
}

.dish-card {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.dish-info {
    flex: 1;
}

.dish-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.dish-price {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.dish-desc {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Обрізає текст після 2 рядка */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dish-weight {
    color: #555555;
    font-size: 13px;
    font-family: monospace; /* Змінений, "технічний" шрифт */
    font-weight: 700;
    background-color: #f0f0f0; /* Легкий сірий фон (як бейдж) */
    display: inline-block; /* Щоб фон облягав текст */
    padding: 3px 8px; /* Відступи всередині бейджа */
    border-radius: 6px; /* Закруглені кути */
    margin-bottom: 8px;
}

/* Теги */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.tag-red { background-color: #ffeaea; color: #d93025; }
.tag-green { background-color: #e6f4ea; color: #137333; }

/* Картинка страви в списку */
.dish-image-box {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.dish-image {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
}

.bookmark-btn {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-size: 16px;
}


/* --- Універсальний ПОПАП для всіх екранів --- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    width: 92%;
    max-width: 460px;
    height: 72vh;
    background-color: var(--bg-color, #fff);
    border-radius: 24px;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 0;
}

.modal-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    border-radius: 24px 24px 0 0;
    background-size: cover;
    background-position: center;
}

.modal-body {
    padding: 24px 16px;
}

.modal-desc {
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.modal-footer {
    position: fixed;
    bottom: 0; left: 0; width: 100%;
    padding: 16px;
    background: white;
    border-top: 1px solid #eee;
}

.close-btn {
    position: absolute;
    top: 16px; right: 16px;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    background: white;
    font-size: 20px;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.action-btn {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: none;
    background-color: var(--red-brand);
    color: white;
    font-size: 18px;
    font-weight: 600;
}

/* --- Версія для ПК (Екрани ширші за 1024px) --- */
@media (min-width: 1024px) {
    /* 1. Робимо дві колонки */
    .desktop-wrapper {
        display: flex;
        align-items: flex-start;
        max-width: 1200px; /* Максимальна ширина сайту на ПК */
        margin: 0 auto; /* Центруємо сайт */
        gap: 60px; /* Відстань між боковим меню і стравами */
        padding: 40px 20px;
    }

    /* 2. Бокове меню зліва */
    .category-nav {
        flex-direction: column; /* Кнопки йдуть зверху вниз */
        width: 250px;
        position: sticky;
        top: 40px; /* Відступ від верху екрана при скролі */
        padding: 0;
        border-bottom: none;
        white-space: normal; /* Текст може переноситись на новий рядок */
    }

    /* 3. Дизайн кнопок категорій під ПК */
    .category-pill {
        text-align: left;
        padding: 12px 20px;
        border-radius: 12px;
        background-color: transparent; /* Ховаємо сірий фон неактивних кнопок */
        font-size: 18px;
    }

    .category-pill.active {
        background-color: var(--red-brand);
        color: white;
    }

    /* 4. Права колонка зі стравами */
    .menu-container {
        flex: 1; /* Займає весь вільний простір */
        padding: 0;
    }

    .category-section {
        scroll-margin-top: 40px; /* Щоб при кліку на меню скролило рівно до заголовка */
    }

    /* 5. Модалка по центру екрана */
    .modal.active {
        align-items: center; /* На ПК вікно по центру, а не притиснуте до низу */
    }

    .modal-content {
        height: auto;
        max-height: 85vh;
        margin-bottom: 0;    /* Прибираємо мобільний відступ */
    }

    .modal-image {
        border-radius: 24px 24px 0 0;
    }
}