/* =========================================================
   ðŸŸ¢ HOME CATEGORY CAROUSEL â€” FINAL STABLE VERSION
   Drag + Touch + Hidden Scrollbar + Arrows (Corrected)
========================================================= */

/* WRAPPER â€” Should NOT scroll */
.sf-categories-carousel-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 10px 0;
    margin: 0 0 20px 0;
    position: relative;
    overflow: visible; /* ðŸ”¥ FIX: allow scroll gestures to reach the track */
    flex: none;
}


/* TRACK â€” This is the REAL scrolling element */
.sf-categories-carousel {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;

    /* ðŸ”‘ KEY FIXES */
    width: 100%;          /* viewport width of the strip */
    max-width: 100%;      /* don't grow past column */

    gap: 12px;
    padding: 4px 8px;

    overflow-x: auto;     /* this scrolls */
    overflow-y: hidden;
    scroll-behavior: smooth;

    -webkit-overflow-scrolling: touch;
}

/* HIDE SCROLLBAR (Cross-browser safe) */
.sf-categories-carousel {
    scrollbar-width: none;            /* Firefox */
}
.sf-categories-carousel::-webkit-scrollbar {
    display: none !important;         /* Chrome, Safari, Edge */
}

/* =========================================================
   CATEGORY ITEM
========================================================= */
.sf-category-item {
    flex: 0 0 95px;
    display: inline-flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e7e7e7;
    padding: 10px;
    text-align: center;
    text-decoration: none;
    color: #222;
    border-radius: 0;
    cursor: pointer;

    transition: transform .2s ease, box-shadow .2s ease;
}

.sf-category-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

/* Thumbnail */
.sf-category-item-thumb {
    width: 100%;
    height: 90px;
    overflow: hidden;
    background: #f5f5f5;
}

.sf-category-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Label */
.sf-category-item-label {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================================
   NAVIGATION ARROWS
========================================================= */
.sf-cat-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);

    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    border: 1px solid #ddd;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    z-index: 9999; /* Always clickable */
    pointer-events: all; /* Ensure clicks register */

    transition: 0.2s ease;
}

.sf-cat-nav.left { left: 4px; }
.sf-cat-nav.right { right: 4px; }

.sf-cat-nav:hover {
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sf-cat-nav i {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

/* =========================================================
   MOBILE ADJUSTMENTS
========================================================= */
@media (max-width: 768px) {

    .sf-category-item {
        width: 85px;
        padding: 8px;
    }

    .sf-category-item-thumb {
        height: 60px;
    }

}

.sf-left-col,
.sf-main-col,
.sf-right-col {
    min-width: 0 !important;  /* ðŸ”¥ CRITICAL FIX */
}

/* Hide category carousel arrows on mobile */
@media (max-width: 768px) {
    .sf-cat-nav {
        display: none !important;
    }
}
/* Desktop: hide arrows by default */
@media (min-width: 769px) {
    .sf-cat-nav {
        opacity: 0;
        pointer-events: none;      /* prevent ghost clicks */
        transition: opacity 0.2s ease;
    }

    /* Show arrows when hovering the wrapper */
    .sf-categories-carousel-wrapper:hover .sf-cat-nav {
        opacity: 1;
        pointer-events: auto;
    }
}

/* =========================================================
   STOREFRONT — HOME CATEGORIES (COLLAGE CAROUSEL)
   FINAL / FLOW-SAFE
========================================================= */

/* ================================
   SECTION ROOT
================================ */
.sf-home-categories {
  width: 100%;
  margin-bottom: 0px; /* preserves flow before product grid */
}

/* ================================
   HORIZONTAL TRACK
================================ */
.sf-categories-track {
  display: flex;
  flex-direction: row;
  gap: 20px;

  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;

  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

/* hide scrollbar */
.sf-categories-track::-webkit-scrollbar {
  display: none;
}

/* ================================
   CATEGORY CARD
================================ */
.sf-category-row {
  flex: 0 0 380px;
  display: grid;
  grid-template-columns: 1fr 2fr; /* 1/3 info, 2/3 collage */
  gap: 10px;

  background: #fff;
  border-radius: 8px;
  padding: 10px;

  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s ease;

  min-width: 0; /* ✅ allow inner text to wrap instead of squeezing */
}

.sf-category-row:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ================================
   LEFT COLUMN — INFO
================================ */
.sf-category-info {
  display: flex;
  flex-direction: column;
  justify-content: center;

  min-width: 0; /* ✅ critical for text wrapping */
}

.sf-category-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #222;
  text-align: center;

  /* ✅ NEW — prevent width stealing */
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.3;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; /* max 2 rows */
  overflow: hidden;
}

.sf-category-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.4;
  margin-bottom: 10px;
}

.sf-category-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary, #28a745);
}

/* ================================
   RIGHT COLUMN — 2x2 COLLAGE
================================ */
.sf-category-collage {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 4px;

  width: 100%;
  min-height: 220px; /* ensures images always render */

  min-width: 0; /* ✅ prevents flex/grid squeeze */
}

.sf-category-collage-item {
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: #f2f2f2;
}

.sf-category-collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ================================
   RESPONSIVE
================================ */

/* Tablet */
@media (max-width: 1024px) {
  .sf-category-row {
    flex: 0 0 380px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .sf-category-row {
    flex: 0 0 250px;
    grid-template-columns: 1fr; /* stack info above collage */
  }

  .sf-category-collage {
    min-height: 180px;
  }

  .sf-category-title {
    font-size: 20px;
  }

  .sf-category-desc,
  .sf-category-link {
    font-size: 13px;
  }
}

@media (max-width: 768px) {
  .sf-hide-mobile { display: none !important; }
}

/* =========================================================
   HOME SECTIONS — GENERIC (Bestseller, Recommended, etc.)
========================================================= */

.sf-home-section {
    margin: 0px 0;
}

.sf-home-section .sf-section-header {
    margin-bottom: 8px;
}

.sf-home-section .sf-section-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.sf-home-section .sf-section-divider {
    margin-top: 0px;
    height: 2px;
    width: 48px;
    background: var(--sf-primary, #1a7f37);
}

/* Carousel cards (uniform width) */
.sf-home-carousel-card {
    flex: 0 0 auto;
    width: 180px;
}

/* Hide card internals consistently */
.sf-home-carousel .sf-row-main-home,
.sf-home-carousel .sf-pqty {
    display: none !important;
}


