#main {
    display: flex;
    margin-top: 5px;
    width: 95%;
    flex-direction: column;
    align-items: center;
    margin-bottom: 80px;
    position: relative;
    z-index: 1;
}

#categories {
    display: flex;
    width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-top: 20px;
    box-sizing: border-box;
}

#categories-wrapper {
    width: 100%;
}

.level1-grid {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

.level1-grid .level1-category {
    width: 32%;
    max-width: 170px;
    min-width: 114px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #2c2c2c;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.2px;
}

/* Уменьшение шрифта для средних текстов (15-20 символов) */
.level1-grid .level1-category.medium-text {
    font-size: 13px;
}

/* Уменьшение шрифта для длинных текстов (более 20 символов) */
.level1-grid .level1-category.long-text {
    font-size: 12px;
    letter-spacing: -0.3px;
}

.level1-grid .level1-category--full {
    width: 100%;
    max-width: none;
}

/* Адаптация для узких экранов */
@media (max-width: 380px) {
    .level1-grid .level1-category {
        width: 48%;
        max-width: none;
        min-width: 0;
        font-size: 14px;
        padding: 0 16px;
    }
    
    .level1-grid .level1-category.medium-text {
        font-size: 12px;
    }
    
    .level1-grid .level1-category.long-text {
        font-size: 11px;
    }
    
    .level1-grid .level1-category--full {
        font-size: 14px;
        padding: 0 16px;
    }
}

@media (max-width: 320px) {
    .level1-grid .level1-category {
        font-size: 13px;
        padding: 0 12px;
    }
    
    .level1-grid .level1-category.medium-text {
        font-size: 11px;
    }
    
    .level1-grid .level1-category.long-text {
        font-size: 10px;
    }
    
    .level1-grid .level1-category--full {
        font-size: 13px;
        padding: 0 12px;
    }
}

.categories-row {
    display: flex;
    width: 100%;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    padding: 5px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.categories-row::-webkit-scrollbar {
    display: none;
}

.main-categories {
    margin-bottom: 10px;
}

.main-categories .categories {
    width: 48%;
    max-width: 170px;
}

.categories {
    height: 50px;
    min-width: 120px;
    border: none;
    border-radius: 25px;
    background: rgba(250, 245, 235, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0 24px;
    box-shadow: 0 4px 15px rgba(101, 67, 33, 0.15);
    white-space: nowrap;
    border: 2px solid rgba(193, 154, 107, 0.3);
    position: relative;
    overflow: hidden;
}

.categories::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(184, 134, 11, 0.15), transparent);
    transition: left 0.5s ease;
}

.categories:active::before {
    left: 100%;
}

#electronics, #furniture, #boys, #girls {
    width: 48%;
    max-width: 170px;
    overflow: hidden;
    position: relative;
}

/* Третий ряд - короткие кнопки мальчики/девочки */
.tertiary-categories {
    margin-top: 10px;
}

/* Четвертый ряд - большая кнопка аксессуары для дома */
.quaternary-categories {
    margin-top: 10px;
    width: 100%;
}

#home-accessories {
    width: 100%;
    max-width: none;
    overflow: hidden;
    position: relative;
}

#electronics {
    width: 48%;
    max-width: 170px;
    overflow: hidden;
    position: relative;
    text-align: left;
}

#electronics span {
    display: inline-block;
    white-space: nowrap;
    padding-right: 20px;
    text-align: left;
    position: absolute;
    left: 7px;
}

/* Плавная прокрутка текста только для электроники */
#electronics span.overflow {
    animation: scrollText 12s linear infinite alternate;
    animation-delay: 1s;
}

@keyframes scrollText {
    0% {
        transform: translateX(0);
    }
    10% {
        transform: translateX(0);
    }
    45% {
        transform: translateX(calc(-100% + 170px));
    }
    55% {
        transform: translateX(calc(-100% + 170px));
    }
    90% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(0);
    }
}

.categories:active {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 105, 61, 0.3);
}

.categories:active {
    transform: translateY(0px);
    box-shadow: 0 3px 12px rgba(101, 67, 33, 0.2);
}

.categories span {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #2c2c2c;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    letter-spacing: -0.2px;
    position: relative;
    z-index: 1;
}

#cards {
    display: none;
    margin-top: 15px;
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 5px;
    min-height: 0;
}

.card {
    display: flex;
    flex-direction: column;
    height: auto;
    border: none;
    width: 100%;
    border-radius: 20px;
    background: rgba(250, 245, 235, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(101, 67, 33, 0.15);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(193, 154, 107, 0.3);
    position: relative;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(139, 105, 61, 0.08) 0%, rgba(184, 134, 11, 0.08) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 0;
}

.card:active::after {
    opacity: 1;
}

.card:active {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 40px rgba(139, 105, 61, 0.25);
}

.card:active {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 10px 30px rgba(139, 105, 61, 0.2);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 20px 20px 0 0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Fallback для отсутствующих изображений категорий */
.card-image-fallback {
    width: 100%;
    height: 200px;
    border-radius: 20px 20px 0 0;
    background: linear-gradient(135deg, #C19A6B 0%, #8B7355 50%, #654321 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.card-image-fallback::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.card-image-fallback-icon {
    font-size: 48px;
    color: rgba(255, 255, 255, 0.9);
    z-index: 1;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

.card:active .card-image {
    transform: scale(1.05);
}

.card-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.card-title {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #1a1a1a;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 8px;
}

.card-price {
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #8b6f47 0%, #654321 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

/* Обновленные стили для кнопок корзины */
.add-to-cart, .add-to-cart-large {
    position: relative;
    transition: all 0.3s ease;
    width: 100%;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b6f47 0%, #654321 100%);
    color: #faf5eb;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(101, 67, 33, 0.3);
    overflow: hidden;
}

.add-to-cart::before, .add-to-cart-large::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(184, 134, 11, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.add-to-cart:active::before, .add-to-cart-large:active::before {
    width: 300px;
    height: 300px;
}

.add-to-cart:active, .add-to-cart-large:active {
    box-shadow: 0 6px 20px rgba(101, 67, 33, 0.4);
    transform: translateY(-2px);
}

.add-to-cart:active, .add-to-cart-large:active {
    transform: translateY(0px);
}

.original-price {
    text-decoration: line-through;
    color: #666;
    margin-right: 8px;
    font-size: 14px;
    font-weight: 600;
    opacity: 1;
}

.add-to-cart.in-cart, .add-to-cart-large.in-cart {
    padding: 0;
}

.cart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0 10px;
}

.cart-controls button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 16px;
    padding: 0;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-controls button:active {
    background: rgba(255, 255, 255, 0.3);
}

.cart-controls button:active {
    background: rgba(255, 255, 255, 0.1);
}

.cart-controls span {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: white;
}

.category-item .card-content {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.category-item .card-title {
    font-family: 'Inter', sans-serif;
    font-size: 17px;
    color: #1a1a1a;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0;
    transition: all 0.3s ease;
}

.category-item {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.category-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0;
    background: linear-gradient(135deg, rgba(139, 105, 61, 0.15) 0%, rgba(184, 134, 11, 0.15) 100%);
    transition: height 0.3s ease;
    z-index: 0;
}

.category-item:active::before {
    height: 100%;
}

.category-item:active .card-title {
    transform: scale(1.05);
    color: #8b6f47;
}

.categories.active {
    background: linear-gradient(135deg, #8b6f47 0%, #654321 100%);
    box-shadow: 0 6px 20px rgba(101, 67, 33, 0.4);
    color: #faf5eb;
}

.categories.active span {
    color: #faf5eb;
}

#cards.active {
    display: grid;
}

#cards {
    display: none;
    margin-top: 15px;
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 5px;
    min-height: 0;
}

/* Обновляем стили для пустого списка товаров */
.empty-products {
    grid-column: 1 / -1;
    width: 100%;
    padding: 50px 30px;
    text-align: center;
    background: rgba(250, 245, 235, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(101, 67, 33, 0.15);
    box-sizing: border-box;
    margin: 0;
    border: 2px solid rgba(193, 154, 107, 0.3);
    position: relative;
    z-index: 1;
}

.empty-products i {
    font-size: 48px;
    background: linear-gradient(135deg, #8b6f47 0%, #654321 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.empty-products-text {
    margin: 10px 0 8px;
    font-family: 'Inter', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.empty-products-subtext {
    margin: 5px 0 0;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #666;
}

.recommendations-title {
    font-family: 'Inter', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #654321;
    text-align: center;
    margin-top: 20px;
    background: rgba(250, 245, 235, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(193, 154, 107, 0.4);
    border-radius: 20px;
    padding: 15px 20px;
    box-shadow: 0 8px 25px rgba(101, 67, 33, 0.15);
    position: relative;
    z-index: 1;
}

.separator {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, rgba(193, 154, 107, 0.5) 50%, transparent 100%);
    margin: 20px 0;
}

#rand-cards {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 5px;
    margin-bottom: 20px;
}

/* Адаптивные стили для сетки карточек */
@media (min-width: 768px) {
    #cards, #rand-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    .card-image {
        height: 240px;
    }
    
    .card-image-fallback {
        height: 240px;
    }
    
    .card-image-fallback-icon {
        font-size: 56px;
    }
}

@media (min-width: 1024px) {
    #cards, #rand-cards {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }
    
    .card-image {
        height: 260px;
    }
    
    .card-image-fallback {
        height: 260px;
    }
    
    .card-image-fallback-icon {
        font-size: 64px;
    }
}

/* Улучшенные эффекты на touch-устройствах */
@media (active: none) and (pointer: coarse) {
    .card:active {
        transform: none;
    }
    
    .card:active {
        transform: scale(0.98);
    }
    
    .categories:active {
        transform: none;
    }
    
    .categories:active {
        transform: scale(0.98);
    }
}


