/**
 * Category Slider Styles - Modern Momentum Scrolling
 * No navigation arrows, smooth touch and desktop scrolling
 * Desktop: Shows icons with names below (4-5 visible at once)
 * Mobile: Shows only icons, 3 visible at once
 *
 * @package CozyRecipes
 */

/* ========================================
   SECTION CONTAINER
======================================== */

.category-slider-section {
    padding: 2rem 0 3rem;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.category-slider-section .section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.category-slider-section .section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #222;
}

.category-slider-section .section-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

/* ========================================
   SLIDER CONTAINER - HORIZONTAL FOR ALL
======================================== */

.category-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    margin: 0 auto;
    max-width: 100%;
}

/* Navigation arrows removed - using momentum scrolling instead */

/* Track with momentum scrolling and touch feedback */
.category-slider-track {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
    scroll-behavior: auto; /* Let JS handle momentum, not browser smooth scroll */
    -webkit-overflow-scrolling: touch; /* iOS momentum scrolling */
    padding: 1rem 1.5rem;
    user-select: none; /* Prevent text selection during drag */
    -webkit-user-select: none;
    cursor: grab;
}

.category-slider-track:active {
    cursor: grabbing;
}

/* Hide scrollbar for Chrome/Safari */
.category-slider-track::-webkit-scrollbar {
    display: none;
}

/* ========================================
   DESKTOP LAYOUT - HORIZONTAL SLIDER
======================================== */

@media (min-width: 769px) {
    .category-slider-track {
        gap: 2rem;
        padding: 1.5rem;
        justify-content: flex-start;
    }

    /* Item container with icon and name */
    .category-slider-item {
        flex-shrink: 0;
        width: 140px;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        text-decoration: none;
        color: inherit;
        transition: all 0.3s ease;
        scroll-snap-align: start;
        background: none;
        border: none;
        padding: 0;
    }

    .category-slider-item:hover .category-icon {
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    }

    .category-slider-item:focus {
        outline: 2px solid #ff6b6b;
        outline-offset: 2px;
        border-radius: 50%;
    }

    /* Icon with custom background color */
    .category-icon {
        flex-shrink: 0;
        width: 100px;
        height: 100px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        overflow: hidden;
        transition: all 0.3s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        margin-bottom: 0.75rem;
        /* Background color is set inline via style attribute */
    }

    .category-name {
        font-size: 1rem;
        font-weight: 600;
        color: #222;
        margin: 0;
        line-height: 1.3;
    }

    /* Badge removed */
    .category-badge {
        display: none;
    }
}

/* ========================================
   MOBILE LAYOUT - RAIL STYLE (3 ITEMS PER VIEW)
======================================== */

@media (max-width: 768px) {
    .category-slider-track {
        /* Rail style: exactly 3 items visible at once */
        gap: 1rem;
        padding: 1rem 1.5rem;
        justify-content: flex-start;
        scroll-snap-type: x mandatory;
    }

    /* Item container - fixed width for 3-item rail view */
    .category-slider-item {
        /* Calculate: (100% - 100px padding - 2rem gaps) / 3 items */
        /* Approximately 30% width with proper spacing */
        flex-shrink: 0;
        width: calc(33.333% - 0.67rem);
        max-width: 110px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        text-decoration: none;
        color: inherit;
        transition: all 0.3s ease;
        scroll-snap-align: center;
        scroll-snap-stop: always;
        background: none;
        border: none;
        padding: 0.5rem 0;
    }

    .category-slider-item:active .category-icon {
        transform: scale(0.9);
    }

    /* Icon - circular with custom background color */
    .category-icon {
        flex-shrink: 0;
        width: 80px;
        height: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        overflow: hidden;
        transition: all 0.3s ease;
        /* Background color is set inline via style attribute */
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .category-slider-item:active .category-icon {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    /* Hide name and badge on mobile */
    .category-name,
    .category-badge {
        display: none;
    }
}

/* ========================================
   ICON CONTENT
======================================== */

.category-emoji {
    font-size: 2.5rem;
    line-height: 1;
    display: block;
}

@media (min-width: 769px) {
    .category-emoji {
        font-size: 3rem;
    }
}

.category-icon img {
    width: 64%;
    height: 64%;
    object-fit: cover;
    display: block;
}

/* ========================================
   EXTRA SMALL MOBILE (RAIL STYLE OPTIMIZED)
======================================== */

@media (max-width: 480px) {
    .category-slider-section {
        padding: 1.5rem 0 2rem;
    }

    .category-slider-section .section-title {
        font-size: 1.5rem;
    }

    .category-slider-section .section-subtitle {
        font-size: 1rem;
    }

    .category-slider-track {
        gap: 0.8rem;
        padding: 1rem 1rem;
    }

    .category-slider-item {
        width: calc(33.333% - 0.53rem);
        max-width: 95px;
    }

    .category-icon {
        width: 70px;
        height: 70px;
    }

    .category-emoji {
        font-size: 2.25rem;
    }
}

/* ========================================
   ACCESSIBILITY
======================================== */

.category-slider-item:focus-visible {
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .category-slider-track,
    .category-slider-item,
    .category-icon {
        transition: none;
        animation: none;
    }

    .category-slider-track {
        scroll-behavior: auto;
    }
}

/* ========================================
   LOADING STATE
======================================== */

.category-slider-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================================
   CAROUSEL INDICATORS (DOTS)
======================================== */

.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0 0;
    margin: 0;
}

.carousel-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background-color: #ddd;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.carousel-indicator:hover {
    background-color: #bbb;
    opacity: 0.9;
}

.carousel-indicator.active {
    background-color: #ff6b6b;
    opacity: 1;
    width: 10px;
    height: 10px;
}

@media (max-width: 480px) {
    .carousel-indicators {
        gap: 0.4rem;
        padding: 0.75rem 0 0;
    }

    .carousel-indicator {
        width: 6px;
        height: 6px;
    }

    .carousel-indicator.active {
        width: 8px;
        height: 8px;
    }
}

/* ========================================
   PRINT STYLES
======================================== */

@media print {
    .category-slider-section {
        page-break-inside: avoid;
    }

    .category-slider-track {
        overflow-x: visible;
        flex-wrap: wrap;
    }

    .category-slider-item {
        box-shadow: none !important;
    }

    .category-name {
        display: block !important;
    }
}
