/* ============================================================
NAV CAROUSEL SNAP - Akila Florist Starter Theme
Location: /assets/css/03-components/nav-carousel.css

FIXED:
1. Horizontal scroll berfungsi di mobile
2. Scrollbar hidden tapi functionality tetap ada
3. PWA desktop tidak show scrollbar yang tidak diinginkan
4. Snap points working properly
============================================================ */

/* --- 1. SECTION CONTAINER --- */
.st-nav-carousel-section {
    padding-block: clamp(2rem, 5vw, 4rem);
    background: var(--bg-color);
    width: 100%;
    overflow: hidden; /* Prevent section overflow */
    position: relative;
}

/* --- 2. WRAPPER - DESKTOP DEFAULT (Grid Layout) --- */
.st-nav-carousel-wrapper {
    /* Merubah Flex ke Grid agar Fluid dalam 1 baris */
    display: grid !important;
    /* Menghitung kolom otomatis berdasarkan jumlah item agar tetap 1 baris */
    grid-auto-flow: column;
    grid-auto-columns: minmax(min-content, 1fr);
    
    justify-content: center;
    align-content: center;
    gap: clamp(15px, 3vw, 40px);
    padding: 20px 15px;
    max-width: 1200px;
    margin: 0 auto;
    
    /* Memastikan tidak membungkus ke baris baru */
    overflow-x: visible;
}

.st-nav-carousel-wrapper::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* --- 3. ITEM STYLE --- */
.st-nav-item {
    flex: none !important; 
    width: auto !important;
    min-width: 100px;
    max-width: 160px;
    text-align: center;
    text-decoration: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.st-nav-icon {
    width: clamp(85px, 10vw, 140px);
    height: clamp(85px, 10vw, 140px);
    margin: 0 auto 15px;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.st-nav-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.st-nav-item span {
    font-family: var(--font-heading);
    font-size: clamp(0.80rem, 1vw, 1rem);
    font-weight: 700;
    color: var(--text-color);
    display: block;
    line-height: 1.2;
}

/* Hover Effect (Desktop Only) */
@media (hover: hover) {
    .st-nav-item:hover .st-nav-icon {
        transform: translateY(-8px);
        background: var(--white);
    }
    
    .st-nav-item:hover .st-nav-icon img {
        transform: scale(1.1);
    }
}

/* --- 4. MOBILE OPTIMIZATION (Scroll Mode) --- */
@media (max-width: 767px) {
    .st-nav-carousel-wrapper {
        /* CRITICAL FIX: Enable horizontal scroll */
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-start !important;
        
        /* Scroll Configuration */
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
        scroll-snap-type: x mandatory; /* Snap to items */
        scroll-padding: 0 15px;
        
        /* Layout */
        gap: 15px !important;
        padding: 20px 15px 25px 15px !important;
        margin: 0 -15px !important; /* Full width scroll */
        max-width: 100% !important;
        
        /* Hide scrollbar but keep functionality */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    /* Hide scrollbar Chrome/Safari */
    .st-nav-carousel-wrapper::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }
    
    /* Ensure scrollbar track is hidden */
    .st-nav-carousel-wrapper::-webkit-scrollbar-track {
        display: none !important;
        background: transparent !important;
    }
    
    /* Ensure scrollbar thumb is hidden */
    .st-nav-carousel-wrapper::-webkit-scrollbar-thumb {
        display: none !important;
        background: transparent !important;
    }
    
    /* Item Configuration for Mobile Scroll */
    .st-nav-item {
        flex: 0 0 120px !important; /* Fixed width for snap */
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
        
        /* Snap Configuration */
        scroll-snap-align: start !important;
        scroll-snap-stop: normal !important;
    }
    
    /* Icon Size for Mobile */
    .st-nav-icon {
        width: 85px !important;
        height: 85px !important;
        min-width: 85px !important;
        min-height: 85px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    }
    
    /* Label Text */
    .st-nav-item span {
        font-size: 0.85rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }
}

/* --- 5. PWA DESKTOP FIX --- */
/* When PWA is installed on desktop, prevent unwanted scrollbars */
@media (min-width: 768px) {
    .st-nav-carousel-section {
        overflow-x: hidden; /* Prevent section horizontal scroll */
    }
    
    .st-nav-carousel-wrapper {
        overflow-x: visible;
        scrollbar-width: none;
    }
    
    .st-nav-carousel-wrapper::-webkit-scrollbar {
        display: none;
        width: 0;
        height: 0;
    }
}

/* --- 6. TOUCH FEEDBACK (Mobile) --- */
@media (max-width: 767px) {
    .st-nav-item:active {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

/* --- 7. SAFE AREA FOR NOTCH DEVICES --- */
@supports (padding: max(0px)) {
    .st-nav-carousel-section {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    @media (max-width: 767px) {
        .st-nav-carousel-wrapper {
            padding-left: max(15px, env(safe-area-inset-left));
            padding-right: max(15px, env(safe-area-inset-right));
            margin-left: calc(-1 * max(15px, env(safe-area-inset-left)));
            margin-right: calc(-1 * max(15px, env(safe-area-inset-right)));
        }
    }
}