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

html,
body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

: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;
    --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-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: var(--page-title-font-size, 2em);
    font-family: var(--page-title-font-family, Arial, sans-serif);
}

.header-bottom {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
    min-height: auto;
    padding: 0 10px;
}

.header-left {
    width: 100%;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
}

.header-right {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

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

.cart-item .item-name {
    cursor: pointer;
    color: var(--accent-color, #007bff);
    transition: color 0.2s;
}

.cart-item .item-name:hover {
    text-decoration: underline;
}

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

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

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

.category-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: var(--categories-bg-color);
    border: 2px solid var(--category-border-color);
    border-radius: var(--category-btn-border-radius, 25px);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    flex-shrink: 0;
    white-space: nowrap;
    color: var(--category-item-text-color, #333333);
}

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

.category-btn.active {
    background: var(--category-active-bg);
    color: var(--category-active-text);
    /* ← уже было */
    border-color: var(--category-active-bg);
}

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

.category-name {
    font-weight: 500;
}

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

/* НОВЫЙ ДИЗАЙН КАРТОЧЕК */
.product {
    position: relative;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    display: flex;
    flex-direction: column;
    aspect-ratio: 3 / 4;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.product .product-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    z-index: 0;
}

.product .product-image,
.product .product-image-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;          /* масштабирует с обрезанием длинной стороны */
    object-position: center;    /* выравнивание по центру (по желанию) */
    transition: transform 0.3s ease;
}

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

.product .product-image-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
    pointer-events: none;
    z-index: 1;
}

.product .product-content {
    position: relative;
    z-index: 2;
    margin-top: auto;
    padding: 0 16px 12px 16px;   /* уменьшен нижний отступ с 20px до 12px */
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: white;
    min-height: 90px;            /* фиксирует минимальную высоту для прижатия */
}

.product .product-content h3,
.product .product-content p,
.product .add-to-cart {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Ограничение названия товара двумя строками */
.product .product-content h3 {
    margin: 0 0 4px 0;
    font-size: 1.1em;
    font-weight: bold;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;                  /* добавляем для совместимости со стандартом */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

.product .add-to-cart {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-weight: bold;
    padding: 10px 16px;
    border-radius: 40px;
    /* ← возвращаем скругление */
    width: 100%;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 1em;
}

.product .add-to-cart:hover {
    background: var(--accent-color, #ff6b35);
    border-color: transparent;
}

/* Адаптивность карточек */
@media (max-width: 768px) {
    .product .product-content {
        padding: 0 12px 12px 12px;
        min-height: 80px;
        justify-content: flex-end;
    }
    .product .product-content h3 {
        font-size: 1em;
        margin-bottom: 3px;
    }
    .product .add-to-cart {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    .product-price-view {
        margin-top: 2px;
        margin-bottom: 0;
        font-size: 1em;
    }
    .category-btn {
        padding: 5px 14px;
    }
}

@media (max-width: 480px) {
    .product .product-content {
        padding: 0 10px 10px 10px;
        min-height: 70px;
        justify-content: flex-end;
    }
    .product .product-content h3 {
        font-size: 0.9em;
        margin-bottom: 2px;
    }
    .product .add-to-cart {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    .product-price-view {
        margin-top: 2px;
        margin-bottom: 0;
        font-size: 0.9em;
    }
    .category-btn {
        padding: 4px 12px;
    }
}

/* Сообщения */
.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;
        transform: translateY(10px);
    }

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

.products {
    animation: fadeIn 0.3s ease;
}

/* Уведомления */
.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;
}

/* Видео */
.product-image-container.video-container {
    background: #000;
}

video.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

/* Видео-фон */
.body-background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    pointer-events: none;
}

.header-title {
    position: relative;
    overflow: hidden;
}

.header-background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

.header-title>*:not(.header-background-video) {
    position: relative;
    z-index: 1;
}

.restaurant-info {
    font-size: var(--restaurant-info-font-size, 1.1em);
    font-family: var(--restaurant-info-font-family, inherit);
    color: var(--header-text-color, #666666);
    /* цвет текста из темы */
    font-weight: 500;
    word-break: break-word;
    /* перенос длинных слов */
    white-space: normal;
    /* разрешаем перенос строк */
    max-width: 100%;
    /* не выходить за границы родителя */
    line-height: 1.3;
}

/* Sticky элементы */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: transparent;
    /* фон убираем – он будет в псевдоэлементе */
    padding: 10px 0;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border-radius: 10px;
}

.sticky-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--header-top-bg-color);
    /* цвет фона из переменной */
    opacity: var(--sticky-header-background-opacity, 1);
    border-radius: inherit;
    z-index: -1;
    backdrop-filter: blur(var(--sticky-header-backdrop-blur, 0));
    -webkit-backdrop-filter: blur(var(--sticky-header-backdrop-blur, 0));
    box-shadow: inherit;
    pointer-events: none;
}

.sticky-header>* {
    position: relative;
    z-index: 1;
}

.categories-wrapper {
    position: sticky;
    top: 0;
    z-index: 999;
    background: transparent;
    /* фон убираем */
    padding: 15px 0;
    margin-bottom: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: top 0.3s ease;
}

.categories-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--categories-bg-color);
    opacity: var(--categories-wrapper-background-opacity, 1);
    border-radius: inherit;
    z-index: -1;
    backdrop-filter: blur(var(--categories-wrapper-backdrop-blur, 0));
    -webkit-backdrop-filter: blur(var(--categories-wrapper-backdrop-blur, 0));
    box-shadow: inherit;
    pointer-events: none;
}

.categories-wrapper>* {
    position: relative;
    z-index: 1;
}

/* Описание товара на карточке – компактное, максимум 2 строки */
.product .product-content p {
    margin: 0 0 6px 0;
    font-size: 0.8em;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* === Восстановление 2 колонок на мобильных устройствах === */
@media (max-width: 768px) {
    .products {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .products {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 360px) {
    .products {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 10px;
    }
}

/* Цена в режиме просмотра (catalog_only) */
/* Цена в режиме просмотра (catalog_only) – без фона */
.product-price-view {
    margin-top: 4px;
    margin-bottom: 0;
    font-size: 1.2em;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
}