/* ===== ЕДИНАЯ GRID СИСТЕМА - КОПИЯ ИЗ ПОДКАТЕГОРИЙ ===== */

/* Шиммер для grid структуры */
#cafe-category .cafe-item-container .shimmer,
#cafe-items-container .cafe-item-container .shimmer {
    background: linear-gradient(
        90deg,
        var(--shimmer-color-1) 0%,
        var(--shimmer-color-2) 50%,
        var(--shimmer-color-1) 100%
    ) !important;
    background-size: 200% 100% !important;
    animation: shimmer 1.5s ease-in-out infinite !important;
    border-radius: 8px !important;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ПРИНУДИТЕЛЬНОЕ переопределение старых flex стилей */
#cafe-category,
#cafe-items-container {
    /* Убираем flex из index.css */
    flex-direction: unset !important;
    flex-wrap: unset !important;
    white-space: unset !important;
    overflow-x: unset !important;

    /* Устанавливаем GRID - точно как в subcategories-grid */
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;  /* 2 колонки на мобильных */
    gap: 12px !important;
    margin-bottom: 24px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Верхний отступ только для #cafe-category (верхний уровень) */
#cafe-category {
    padding: calc(var(--tg-safe-area-top, 0px) + 24px + 12px) 12px 0 12px !important;
}

/* Для #cafe-items-container (вложенный) - без верхнего отступа */
#cafe-items-container {
    padding: 12px 12px 0 12px !important;
}

/* Карточка товара - копия стилей subcategory-card */
#cafe-category .cafe-item-container,
#cafe-items-container .cafe-item-container {
    background: linear-gradient(135deg, var(--popover-bg-color) 0%, rgba(var(--accent-rgb), 0.03) 100%) !important;
    border-radius: 20px !important;
    padding: 0 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid var(--divider-color) !important;
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
    min-height: 240px !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

#cafe-category .cafe-item-container:hover,
#cafe-items-container .cafe-item-container:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1) !important;
    border-color: var(--accent-color) !important;
}

#cafe-category .cafe-item-container:active,
#cafe-items-container .cafe-item-container:active {
    transform: translateY(-2px) !important;
}

/* Изображение товара */
#cafe-category .cafe-item-image,
#cafe-items-container .cafe-item-image {
    width: 100% !important;
    height: 120px !important;
    object-fit: cover !important;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%) !important;
    display: block !important;
    flex-shrink: 0 !important;
    border-radius: 0 !important;
}

/* Информация о товаре */
#cafe-category .cafe-item-info,
#cafe-items-container .cafe-item-info {
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
}

/* Заголовок */
#cafe-category .cafe-item-header,
#cafe-items-container .cafe-item-header {
    margin-bottom: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

#cafe-category .cafe-item-name,
#cafe-items-container .cafe-item-name {
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    color: var(--text-color) !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Подкатегория */
#cafe-category .cafe-item-subcategory,
#cafe-items-container .cafe-item-subcategory {
    display: inline-block !important;
    padding: 2px 6px !important;
    background: var(--accent-color) !important;
    color: var(--on-accent-color) !important;
    border-radius: 6px !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
}

/* Описание */
#cafe-category .cafe-item-description,
#cafe-items-container .cafe-item-description {
    font-size: 11px !important;
    line-height: 1.3 !important;
    color: var(--text-color) !important;
    opacity: 0.6 !important;
    margin: 8px 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-height: 28px !important;
}

/* Бейджи */
#cafe-category .cafe-item-badges,
#cafe-items-container .cafe-item-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-bottom: 8px !important;
    min-height: 30px !important;
}

/* Футер с ценой */
#cafe-category .cafe-item-footer,
#cafe-items-container .cafe-item-footer {
    margin-top: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-top: 8px !important;
    border-top: 1px solid rgba(0,0,0,0.05) !important;
}

#cafe-category .cafe-item-price,
#cafe-items-container .cafe-item-price {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--accent-color) !important;
}

/* ===== АДАПТИВНОСТЬ - ТОЧНО КАК В ПОДКАТЕГОРИЯХ ===== */

/* Планшеты */
@media (min-width: 768px) {
    #cafe-category,
    #cafe-items-container {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px !important;
    }

    #cafe-category {
        padding: calc(var(--tg-safe-area-top, 0px) + 24px + 12px) 16px 0 16px !important;
    }

    #cafe-items-container {
        padding: 16px 16px 0 16px !important;
    }

    #cafe-category .cafe-item-image,
    #cafe-items-container .cafe-item-image {
        height: 180px !important;
    }
}

/* Большие экраны */
@media (min-width: 1024px) {
    #cafe-category,
    #cafe-items-container {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
    }

    #cafe-category {
        padding: calc(var(--tg-safe-area-top, 0px) + 24px + 12px) 20px 0 20px !important;
    }

    #cafe-items-container {
        padding: 20px 20px 0 20px !important;
    }

    #cafe-category .cafe-item-image,
    #cafe-items-container .cafe-item-image {
        height: 200px !important;
    }

    #cafe-category .cafe-item-container,
    #cafe-items-container .cafe-item-container {
        min-height: 260px !important;
    }
}

/* 2K экраны */
@media (min-width: 1440px) {
    #cafe-category,
    #cafe-items-container {
        grid-template-columns: repeat(5, 1fr) !important;
        gap: 24px !important;
    }

    #cafe-category {
        padding: calc(var(--tg-safe-area-top, 0px) + 24px + 12px) 24px 0 24px !important;
    }

    #cafe-items-container {
        padding: 24px 24px 0 24px !important;
    }

    #cafe-category .cafe-item-image,
    #cafe-items-container .cafe-item-image {
        height: 240px !important;
    }
}

/* 4K экраны */
@media (min-width: 2560px) {
    #cafe-category,
    #cafe-items-container {
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 28px !important;
    }

    #cafe-category {
        padding: calc(var(--tg-safe-area-top, 0px) + 24px + 12px) 28px 0 28px !important;
    }

    #cafe-items-container {
        padding: 28px 28px 0 28px !important;
    }

    #cafe-category .cafe-item-image,
    #cafe-items-container .cafe-item-image {
        height: 280px !important;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    #cafe-category,
    #cafe-items-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    #cafe-category {
        padding: calc(var(--tg-safe-area-top, 0px) + 24px + 12px) 10px 0 10px !important;
    }

    #cafe-items-container {
        padding: 10px 10px 0 10px !important;
    }

    #cafe-category .cafe-item-container,
    #cafe-items-container .cafe-item-container {
        min-height: 220px !important;
    }

    #cafe-category .cafe-item-image,
    #cafe-items-container .cafe-item-image {
        height: 100px !important;
    }
}

@media (max-width: 360px) {
    #cafe-category,
    #cafe-items-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    #cafe-category {
        padding: calc(var(--tg-safe-area-top, 0px) + 24px + 12px) 8px 0 8px !important;
    }

    #cafe-items-container {
        padding: 8px 8px 0 8px !important;
    }

    #cafe-category .cafe-item-image,
    #cafe-items-container .cafe-item-image {
        height: 90px !important;
    }

    #cafe-category .cafe-item-name,
    #cafe-items-container .cafe-item-name {
        font-size: 13px !important;
    }
}