/* ============================================
   Modern Categories Horizontal Scroll - 2 Rows
   ============================================ */

.categories-scroll-hint {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.categories-scroll-wrapper {
    position: relative;
    margin-bottom: 1.5rem;
}

.categories-scroll-container {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, 1fr);
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.875rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    padding: 1rem 0;
    cursor: grab;
    
    /* Prevent text selection while dragging */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.categories-scroll-container.active-drag {
    cursor: grabbing;
    scroll-behavior: auto; /* Disable smooth scroll during drag for better feel */
}

.categories-scroll-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.category-card {
    width: 140px; /* ~40% smaller than 220px for more compact design */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.category-link {
    display: block;
    text-decoration: none;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}

.category-link:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.category-image {
    width: 100%;
    height: 115px; /* ~40% smaller than 180px for more compact design */
    overflow: hidden;
    background: #f8f9fa;
    position: relative;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-link:hover .category-image img {
    transform: scale(1.05);
}

.category-content {
    padding: 0.625rem;
    text-align: center;
}

.category-title {
    font-size: 14px; /* Smaller for more compact design */
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.25rem 0;
    
    /* Fix alignment issue with multi-line text */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limit to 2 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.4em; /* Ensure consistent height for 2 lines */
    line-height: 1.2;
}

.category-count {
    font-size: 12px;
    color: #6c757d;
}

/* Gradient Fade Indicators - REMOVED as requested */

/* Scroll Buttons (Desktop Only) */
.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.scroll-btn:hover:not(:disabled) {
    background: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    transform: translateY(-50%) scale(1.05);
}

.scroll-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.scroll-btn-left {
    left: -25px;
}

.scroll-btn-right {
    right: -25px;
}

.scroll-btn i {
    font-size: 24px;
    color: #212529;
}

/* Progress Bar (commented out - user may not use it) */
/*
.scroll-progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.scroll-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 2px;
}
*/

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1199px) {
    .category-card {
        width: 130px;
    }
    
    .categories-scroll-container {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    .scroll-btn {
        width: 45px;
        height: 45px;
    }
    
    .scroll-btn-left {
        left: -20px;
    }
    
    .scroll-btn-right {
        right: -20px;
    }
}

@media (max-width: 991px) {
    .category-card {
        width: 118px;
    }
    
    .categories-scroll-container {
        grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    }
    
    .category-image {
        height: 100px;
    }
    
    /* Hide scroll buttons on tablet */
    .scroll-btn {
        display: none;
    }
}

@media (max-width: 767px) {
    .category-card {
        width: 105px;
    }
    
    .categories-scroll-container {
        grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
        gap: 0.625rem;
    }
    
    .category-image {
        height: 90px;
    }
    
    .category-title {
        font-size: 13px;
        min-height: 2.8em; /* Adjust for smaller font */
    }
    
    /* Make hint more prominent on mobile */
    .categories-scroll-hint {
        font-size: 13px;
        animation: pulse 2s ease-in-out infinite;
    }
}

@media (max-width: 575px) {
    .category-card {
        width: 95px;
    }
    
    .categories-scroll-container {
        grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
        gap: 0.5rem;
    }
    
    .category-image {
        height: 80px;
    }
    
    .category-content {
        padding: 0.5rem;
    }
    
    .category-title {
        font-size: 12px;
        min-height: 3em; /* Adjust for smaller font */
    }
    
    .category-count {
        font-size: 10px;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .category-link {
        background: #2d3748;
    }
    
    .category-title {
        color: #fff !important;
    }
    
    .category-count {
        color: #a0aec0;
    }
    
    .scroll-btn {
        background: rgba(45,55,72,0.95);
        border-color: #4a5568;
    }
    
    .scroll-btn i {
        color: #fff;
    }
}
