/**
 * home-category-strip.css — Sticky category strip with image-above-name layout
 */

/* ── Shell ── */
.cat-strip {
  position: sticky;
  top: var(--header-height);
  z-index: calc(var(--z-sticky) - 1);
  background-color: #fff;
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cat-strip::-webkit-scrollbar { display: none; }

.cat-strip__inner {
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
  display: flex;
  align-items: stretch;
  min-height: var(--cat-strip-height);
}

.cat-strip__list {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-shrink: 0;
  width: 100%;
  justify-content: space-between;
}

/* ── Each category item: image on top, label below ── */
.cat-strip__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
  flex: 1;
  min-width: 68px;
  position: relative;
  letter-spacing: 0.01em;
}

/* ── Product illustration ── */
.cat-strip__img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease-spring);
}

/* SVG illustrations */
.cat-strip__illustration {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s var(--ease-spring);
}

.cat-strip__illustration svg {
  width: 34px;
  height: 34px;
}

.cat-strip__label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: inherit;
  text-align: center;
  line-height: 1.2;
}

/* ── Hover ── */
.cat-strip__item:hover {
  color: var(--color-primary-700);
  border-bottom-color: var(--color-primary-200);
}

.cat-strip__item:hover .cat-strip__illustration,
.cat-strip__item:hover .cat-strip__img {
  transform: translateY(-3px) scale(1.08);
}

/* ── Active ── */
.cat-strip__item--active,
.cat-strip__item.active {
  color: var(--color-primary-700);
  border-bottom-color: var(--color-primary-700);
}

.cat-strip__item--active .cat-strip__label,
.cat-strip__item.active .cat-strip__label {
  font-weight: var(--font-bold);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .cat-strip__inner { padding-inline: var(--container-padding-tablet); }
}

@media (max-width: 768px) {
  .cat-strip {
    position: relative !important;
    top: auto !important;
    background-color: #ffffff;
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    z-index: 1 !important;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
  }

  .cat-strip::-webkit-scrollbar {
    display: none;
  }

  .cat-strip__inner {
    padding-inline: 0 !important;
    min-height: auto;
    width: 100%;
  }

  .cat-strip__list {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px var(--container-padding-mobile);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
  }

  .cat-strip__list::-webkit-scrollbar {
    display: none;
  }

  /* Standardized category cards — exactly identical dimensions & styling for all items */
  .cat-strip__item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    flex: 0 0 74px !important;
    width: 74px !important;
    min-width: 74px !important;
    max-width: 74px !important;
    height: 72px !important;
    min-height: 72px !important;
    max-height: 72px !important;
    padding: 6px 4px !important;
    border-radius: var(--radius-lg, 10px) !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
    text-decoration: none !important;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
  }

  .cat-strip__item:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: none !important;
  }

  .cat-strip__item:hover .cat-strip__illustration,
  .cat-strip__item:hover .cat-strip__img {
    transform: none !important;
  }

  /* Consistent active category treatment */
  .cat-strip__item--active,
  .cat-strip__item.active {
    background: #eff6ff !important;
    border: 1.5px solid var(--color-primary-500) !important;
    box-shadow: 0 2px 6px rgba(30, 61, 143, 0.12) !important;
    color: var(--color-primary-700) !important;
  }

  .cat-strip__item--active .cat-strip__illustration,
  .cat-strip__item.active .cat-strip__illustration {
    background: #dbeafe !important;
  }

  .cat-strip__item--active .cat-strip__label,
  .cat-strip__item.active .cat-strip__label {
    font-weight: 700 !important;
    color: var(--color-primary-700) !important;
  }

  /* Consistent icon container for all categories */
  .cat-strip__illustration,
  .cat-strip__img {
    width: 36px !important;
    height: 36px !important;
    border-radius: var(--radius-md, 8px) !important;
    background: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin: 0 auto !important;
    transition: background-color 0.2s ease !important;
  }

  .cat-strip__illustration svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* Consistent labels aligned beneath icons */
  .cat-strip__label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10.5px !important;
    font-weight: 500 !important;
    color: var(--color-text-secondary) !important;
    text-align: center !important;
    line-height: 1.15 !important;
    width: 100% !important;
    height: 22px !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
}

@media (max-width: 480px) {
  .cat-strip__item {
    flex: 0 0 70px !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
  }

  .cat-strip__illustration,
  .cat-strip__img {
    width: 32px !important;
    height: 32px !important;
  }

  .cat-strip__illustration svg {
    width: 20px !important;
    height: 20px !important;
  }

  .cat-strip__label {
    font-size: 10px !important;
    height: 20px !important;
  }
}
