/* Mobile Category Horizontal Scroll - 2 Rows */
@media (max-width: 1023px) {
    /* ป้องกันการ scroll แนวนอนของทั้งหน้า */
    .popular-categories {
        overflow: hidden;
    }

    .popular-category-list {
        display: grid;
        grid-template-rows: repeat(2, auto);
        grid-auto-flow: column;
        gap: 0.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        /* Hide scrollbar but keep functionality */
        scrollbar-width: thin;
        scrollbar-color: #156358 #f3f4f6;
        /* ป้องกันไม่ให้กระทบส่วนอื่น */
        max-width: 100%;
        width: 100%;
    }

    .popular-category-list::-webkit-scrollbar {
        height: 6px;
    }

    .popular-category-list::-webkit-scrollbar-track {
        background: #f3f4f6;
        border-radius: 10px;
    }

    .popular-category-list::-webkit-scrollbar-thumb {
        background: #156358;
        border-radius: 10px;
    }

    .popular-category-list::-webkit-scrollbar-thumb:hover {
        background: #0f4c43;
    }

    .popular-category-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
        padding: 0.65rem 0.85rem;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        transition: all 0.3s;
        cursor: pointer;
        min-width: 140px;
        max-width: 160px;
        scroll-snap-align: start;
        height: auto;
        flex-shrink: 0;
    }

    .popular-category-item:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateY(-2px);
    }

    .category-bar {
        width: 100%;
        height: 3px;
        border-radius: 3px;
        flex-shrink: 0;
    }

    .popular-category-info {
        flex: 1;
        width: 100%;
    }

    .popular-category-info h4 {
        font-size: 0.85rem;
        font-weight: 600;
        margin-bottom: 0.15rem;
        color: #1f2937;
        line-height: 1.3;
    }

    .popular-category-info p {
        font-size: 0.7rem;
        color: #6b7280;
        line-height: 1.2;
    }

    .category-arrow {
        display: none;
    }
}

/* Desktop - Keep original layout */
@media (min-width: 1024px) {
    .popular-category-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .popular-category-item {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 1rem;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        transition: all 0.3s;
        cursor: pointer;
    }

    .popular-category-item:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        transform: translateX(4px);
    }

    .category-bar {
        width: 4px;
        height: 48px;
        border-radius: 4px;
        flex-shrink: 0;
    }

    .popular-category-info {
        flex: 1;
    }

    .category-arrow {
        display: block;
        font-size: 1.25rem;
        color: #9ca3af;
        transition: all 0.3s;
    }

    .popular-category-item:hover .category-arrow {
        color: #156358;
        transform: translateX(4px);
    }
}
