/* style.css - Главные стили с CSS переменными */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* CSS переменные со значениями по умолчанию */
    --page-bg-color: #f5f5f5;
    --header-top-bg-color: #f5f5f5;
    --header-border-color: #e0e0e0;
    --header-bg-color: #ffffff;
    --header-text-color: #333333;
    --categories-bg-color: #ffffff;
    --category-border-color: #e0e0e0;
    --category-active-bg: #ff6b35;
    --category-active-text: #ffffff;
    --category-hover-border: #ff6b35;
    --product-bg-color: #ffffff;
    --product-image-border-color: #f0f0f0;
    --product-text-color: #666666;
    --price-color: #ff6b35;
    --cart-bg-color: #ff6b35;
    --cart-text-color: #ffffff;
    --back-link-bg-color: #6c757d;
    --back-link-text-color: #ffffff;
    --checkout-btn-bg-color: #4CAF50;
    --checkout-btn-text-color: #ffffff;
    --clear-cart-btn-bg-color: #dc3545;
    --clear-cart-btn-text-color: #ffffff;
    --cart-items-bg-color: #ffffff;
    --cart-summary-bg-color: #ffffff;
    --cart-summary-border-color: #e9ecef;
    --modal-bg-color: #ffffff;
    --modal-title-text-color: #2c3e50;
    --confirm-btn-bg-color: #4CAF50;
    --confirm-btn-text-color: #ffffff;
    --cancel-btn-bg-color: #6c757d;
    --cancel-btn-text-color: #ffffff;
    --order-fields-bg-color: #f8f9fa;
    --modal-total-text-color: #2c3e50;
    --success-notification-bg: #4CAF50;
    --empty-cart-bg-color: #ffffff;
    --remove-btn-bg-color: #ff4444;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--page-bg-color);
    line-height: 1.6;
    overflow-y: scroll;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 20px;
}

/* Шапка */
header {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--header-border-color);
    position: relative;
    z-index: 101;
    background: var(--header-top-bg-color);
    padding-top: 10px;
}

/* Контейнер заголовка */
.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    background: var(--header-bg-color);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Стили для логотипа */
.site-logo {
    height: 40px;
    width: auto;
    margin-right: 15px;
    border-radius: 5px;
    object-fit: contain;
}

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

header h1 {
    color: var(--header-text-color);
    margin: 0;
    font-size: 2em;
}

/* НОВЫЙ: Фиксированный блок для корзины */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-top-bg-color);
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--header-border-color);
    transition: all 0.3s ease;
}

/* Нижняя строка - столик и корзина */
.header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 15px;
    min-height: 50px;
    /* Минимальная высота для консистентности */
}

/* Левая часть - информация о столике */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Правая часть - корзина */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Ссылка на корзину в шапке */
.cart-summary {
    font-size: 1.1em;
    flex-shrink: 0;
}

.cart-link {
    background: var(--cart-bg-color);
    color: var(--cart-text-color);
    padding: 12px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cart-link:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.back-link {
    background: var(--back-link-bg-color);
    color: var(--back-link-text-color);
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.back-link:hover {
    filter: brightness(0.9);
    transform: translateY(-2px);
}

/* Фиксированный блок категорий - ИСПРАВЛЕНО: динамический top */
.categories-wrapper {
    position: sticky;
    top: 0;
    /* Будет установлено через JS */
    z-index: 999;
    background: var(--categories-bg-color);
    padding: 15px 0;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    transition: top 0.3s ease;
}

/* Категории - горизонтальная прокрутка */
.categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--category-active-bg) #f0f0f0;
    -webkit-overflow-scrolling: touch;
}

/* Добавляем отступы по краям с помощью псевдо-элементов */
.categories::before {
    content: '';
    flex-shrink: 0;
    width: 20px;
    height: 1px;
}

.categories::after {
    content: '';
    flex-shrink: 0;
    width: 20px;
    height: 1px;
}

/* Скрываем scrollbar для Webkit браузеров */
.categories::-webkit-scrollbar {
    height: 4px;
}

.categories::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 2px;
    margin: 0 20px;
}

.categories::-webkit-scrollbar-thumb {
    background: var(--category-active-bg);
    border-radius: 2px;
    margin: 0 20px;
}

.categories::-webkit-scrollbar-thumb:hover {
    filter: brightness(0.9);
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--categories-bg-color);
    border: 2px solid var(--category-border-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
    transform: none;
    margin: 0;
    color: inherit;
}

.category-btn:hover {
    border-color: var(--category-hover-border);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
    transform: none;
}

.category-btn.active {
    background: var(--category-active-bg);
    color: var(--category-active-text);
    border-color: var(--category-active-bg);
    box-shadow: 0 6px 12px rgba(255, 107, 53, 0.4);
    z-index: 2;
    transform: none;
    box-shadow: 0 8px 16px rgba(255, 107, 53, 0.4),
        0 0 0 2px rgba(255, 107, 53, 0.1);
}

.category-btn.active .category-icon,
.category-btn.active .category-name {
    color: var(--category-active-text);
}

.category-btn:active {
    transform: scale(0.95);
    transition: all 0.1s ease;
}

.category-icon {
    font-size: 18px;
    transition: color 0.3s ease;
}

.category-name {
    font-weight: 500;
    transition: color 0.3s ease;
}

/* Анимация для плавного переключения активной кнопки */
@keyframes pulseActive {
    0% {
        box-shadow: 0 4px 8px rgba(255, 107, 53, 0.3);
    }

    50% {
        box-shadow: 0 8px 16px rgba(255, 107, 53, 0.6);
    }

    100% {
        box-shadow: 0 6px 12px rgba(255, 107, 53, 0.4);
    }
}

.category-btn.active {
    animation: pulseActive 0.3s ease;
}

/* Товары */
.products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.product {
    background: var(--product-bg-color);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product:hover {
    transform: translateY(-5px);
}

/* ИСПРАВЛЕННЫЙ БЛОК ДЛЯ ИЗОБРАЖЕНИЙ - БЕЛЫЙ ФОН */
.product-image-container {
    width: 100%;
    height: 200px;
    margin-bottom: 15px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--product-image-border-color);
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product:hover .product-image {
    transform: scale(1.05);
}

.product-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product h3 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #333;
    line-height: 1.3;
}

.product p {
    margin: 0 0 10px 0;
    color: var(--product-text-color);
    line-height: 1.4;
    flex: 1;
}

.product-price {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--price-color);
    margin: 10px 0 15px 0;
}

.add-to-cart {
    background: var(--cart-bg-color);
    color: var(--cart-text-color);
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-size: 1em;
    font-weight: bold;
    margin-top: auto;
}

.add-to-cart:hover {
    filter: brightness(0.9);
}

/* Сообщения */
.no-products {
    text-align: center;
    color: var(--product-text-color);
    font-style: italic;
    padding: 60px 20px;
    background: var(--empty-cart-bg-color);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Анимации для уведомлений */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0.8;
        transform: translateY(10px);
    }

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

.products {
    animation: fadeIn 0.3s ease;
}

/* Индикатор что есть еще категории */
.categories:after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(90deg, transparent, var(--page-bg-color));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.categories.scrollable:after {
    opacity: 1;
}

/* Плавный скролл для всей страницы */
html {
    scroll-behavior: smooth;
}

/* Убираем стандартное поведение скролла для некоторых браузеров */
.categories {
    -ms-overflow-style: -ms-autohiding-scrollbar;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .site-logo {
        height: 32px;
        margin-right: 10px;
    }

    .header-title {
        padding: 15px;
    }

    .sticky-header {
        padding: 8px 0;
    }

    .categories-wrapper {
        padding: 12px 0;
        border-radius: 8px;
    }

    .cart-link {
        padding: 10px 16px;
        font-size: 0.9em;
    }

    .categories::before,
    .categories::after {
        width: 15px;
    }

    .category-btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .category-icon {
        font-size: 16px;
    }

    .categories::-webkit-scrollbar-track {
        margin: 0 15px;
    }

    .categories::-webkit-scrollbar-thumb {
        margin: 0 15px;
    }

    /* ИСПРАВЛЕНИЕ: Уменьшаем минимальную ширину карточек для 2 колонок */
    .products {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
    }

    .product {
        padding: 15px;
    }

    .product h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }

    .product p {
        font-size: 0.9em;
        margin-bottom: 8px;
    }

    .product-price {
        font-size: 1.1em;
        margin: 8px 0 12px 0;
    }

    .add-to-cart {
        padding: 10px 15px;
        font-size: 0.9em;
    }

    .product-image-container {
        height: 140px;
        margin-bottom: 12px;
    }
}

/* Мобильные устройства - ИСПРАВЛЕННЫЙ МЕДИА-ЗАПРОС */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.5em;
    }

    .site-logo {
        height: 28px;
        margin-right: 8px;
    }

    .header-title {
        flex-direction: column;
        gap: 8px;
        padding: 12px;
    }

    .site-logo {
        margin-right: 0;
        margin-bottom: 5px;
    }

    .sticky-header {
        padding: 6px 0;
    }

    .categories-wrapper {
        padding: 8px 0;
        margin-bottom: 20px;
    }

    /* ИСПРАВЛЕНИЕ: Делаем header-bottom адаптивным */
    .header-bottom {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        min-height: 60px;
        /* Увеличиваем минимальную высоту для мобильных */
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .restaurant-info {
        text-align: center;
        font-size: 1em !important;
        width: 100%;
    }

    .cart-link {
        padding: 10px 16px;
        font-size: 0.9em;
        width: auto;
        min-width: 200px;
        justify-content: center;
    }

    .categories {
        gap: 8px;
    }

    .categories::before,
    .categories::after {
        width: 10px;
    }

    .category-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .category-icon {
        font-size: 14px;
    }

    .categories::-webkit-scrollbar-track {
        margin: 0 10px;
    }

    .categories::-webkit-scrollbar-thumb {
        margin: 0 10px;
    }

    /* ИСПРАВЛЕНИЕ: Для экранов 5-6 дюймов - 2 колонки */
    .products {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }

    .product {
        padding: 12px;
    }

    .product h3 {
        font-size: 1em;
        margin-bottom: 6px;
    }

    .product p {
        font-size: 0.85em;
        margin-bottom: 6px;
        line-height: 1.3;
    }

    .product-price {
        font-size: 1em;
        margin: 6px 0 10px 0;
    }

    .add-to-cart {
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .product-image-container {
        height: 120px;
        margin-bottom: 10px;
    }
}

/* Для очень маленьких экранов - ИСПРАВЛЕННЫЙ МЕДИА-ЗАПРОС */
@media (max-width: 360px) {
    .container {
        padding: 10px;
    }

    .header-bottom {
        flex-direction: column;
        gap: 8px;
        min-height: 80px;
        /* Еще больше для очень маленьких экранов */
    }

    .header-left,
    .header-right {
        width: 100%;
    }

    .sticky-header {
        padding: 5px 0;
    }

    .cart-link {
        min-width: 180px;
        font-size: 0.85em;
        padding: 8px 14px;
    }

    .restaurant-info {
        font-size: 0.9em !important;
    }

    .header-title h1 {
        font-size: 1.3em;
    }

    .category-btn {
        padding: 8px 12px;
    }

    .category-name {
        font-size: 11px;
    }

    .site-logo {
        height: 25px;
        margin-right: 6px;
    }

    .header-title {
        flex-wrap: wrap;
        justify-content: center;
    }

    .categories::before,
    .categories::after {
        width: 8px;
    }

    /* ИСПРАВЛЕНИЕ: Для очень маленьких экранов - 2 колонки с меньшими карточками */
    .products {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 10px;
    }

    .product {
        padding: 10px;
    }

    .product h3 {
        font-size: 0.95em;
    }

    .product p {
        font-size: 0.8em;
    }

    .product-price {
        font-size: 0.95em;
    }

    .add-to-cart {
        padding: 7px 10px;
        font-size: 0.8em;
    }

    .product-image-container {
        height: 100px;
        margin-bottom: 8px;
    }
}

/* Дополнительный медиа-запрос для промежуточных размеров */
@media (max-width: 400px) and (min-width: 361px) {
    .header-bottom {
        flex-wrap: wrap;
        gap: 10px;
        min-height: 70px;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: center;
    }

    .cart-link {
        width: auto;
        min-width: 190px;
        justify-content: center;
    }

    /* Для промежуточных размеров - 2 колонки */
    .products {
        grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
        gap: 11px;
    }
}

/* Стили для уведомлений */
.notification {
    position: fixed;
    top: 100px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.error {
    background: #ff4444;
}

.notification.fade-out {
    animation: slideOut 0.3s ease;
}

/* Стили для контейнеров без изображения в основном каталоге */
.no-image-placeholder {
    color: var(--text-secondary, #6c757d);
    font-size: 14px;
    font-weight: 500;
}

/* Стили для информации о ресторане */
.restaurant-info {
    font-size: 1.1em;
    color: #666;
    font-weight: 500;
}

/* ========== СТИЛИ ДЛЯ ВИДЕО (ДОБАВИТЬ В КОНЕЦ ФАЙЛА) ========== */

/* Контейнер для видео */
.product-image-container.video-container {
    background: #000 !important;
    /* Черный фон для видео, переопределяет белый фон */
    position: relative;
    /* Для позиционирования кнопки воспроизведения */
}

/* Стили для видео элементов */
video.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

video.product-image:hover {
    transform: scale(1.05);
}

/* Стили для видео в модальном окне товара */
.product-modal-image-container .video-container {
    background: #000 !important;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
}

.product-modal-image-container video.product-modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Кнопка воспроизведения видео */
.play-video-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.play-video-btn:hover {
    background: rgba(255, 107, 53, 0.9);
}

/* Скрываем элементы управления видео */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-panel {
    display: none !important;
}

video::-webkit-media-controls-play-button {
    display: none !important;
}

video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

video {
    -webkit-tap-highlight-color: transparent;
}

/* Адаптивность для видео */
@media (max-width: 768px) {
    .product-modal-image-container .video-container {
        height: 250px;
    }

    .play-video-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .product-modal-image-container .video-container {
        height: 200px;
    }

    .play-video-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .product-modal-image-container .video-container {
        height: 180px;
    }

    .play-video-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
}

/* ========== КОНЕЦ СТИЛЕЙ ДЛЯ ВИДЕО ========== */