/* ============================================================
   JBB — Component Styles
   Location: assets/css/components.css
   ============================================================ */

/* ============================================================
   PRODUCT CARD
   ============================================================ */
.jbb-product-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  padding: 12px;
  transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow .25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.jbb-product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(20, 17, 16, 0.08);
}

.jbb-product-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  flex: 1;
}

.jbb-product-card-image {
  position: relative;
  background: #F5EFE7;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  margin-bottom: 14px;
}

.jbb-product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(0.16, 1, 0.3, 1);
}

.jbb-product-card:hover .jbb-product-card-image img {
  transform: scale(1.05);
}

.jbb-product-card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #233345;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 2;
  letter-spacing: 0.02em;
}

.jbb-product-card-badge-out {
  background: var(--c-danger);
  left: auto;
  right: 10px;
}

.jbb-product-card-body {
  padding: 0 4px 12px;
}

.jbb-product-card-name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: #141110;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.jbb-product-card-price {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.jbb-product-card-old {
  font-size: 12px;
  color: var(--c-ink-5);
  text-decoration: line-through;
}

.jbb-product-card-new {
  font-size: 15px;
  font-weight: 700;
  color: #141110;
}

.jbb-product-card-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.jbb-product-card-review-count {
  color: var(--c-ink-5);
  font-size: 11px;
}

.jbb-product-card-add {
  width: 100%;
  background: #141110;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  transition: background .2s ease, opacity .2s ease;
}

.jbb-product-card-add:hover:not(:disabled) {
  background: #333;
}

.jbb-product-card-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.jbb-product-card-add i {
  font-size: 12px;
}

/* ============================================================
   PRODUCT GRID
   Global rule: every grid collapses to 2 columns on mobile —
   never 1. Works for ALL pages that use ProductGrid.
   ============================================================ */
.jbb-product-grid {
  display: grid;
  gap: 24px;
  width: 100%;
}

.jbb-product-grid-1 { grid-template-columns: 1fr; }
.jbb-product-grid-2 { grid-template-columns: repeat(2, 1fr); }
.jbb-product-grid-3 { grid-template-columns: repeat(3, 1fr); }
.jbb-product-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .jbb-product-grid-4 { grid-template-columns: repeat(3, 1fr); }
  .jbb-product-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .jbb-product-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .jbb-product-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ---- MOBILE: force 2 columns, never 1 ---- */
@media (max-width: 560px) {
  .jbb-product-grid-1 { grid-template-columns: 1fr; } /* keep single col only if caller asked */
  .jbb-product-grid-2,
  .jbb-product-grid-3,
  .jbb-product-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Progressive shrink so 2 columns always look clean */
  .jbb-product-card {
    padding: 8px;
  }
  .jbb-product-card-name {
    font-size: 12px;
    margin-bottom: 4px;
  }
  .jbb-product-card-new {
    font-size: 13px;
  }
  .jbb-product-card-old {
    font-size: 11px;
  }
  .jbb-product-card-add {
    font-size: 11px;
    padding: 9px 6px;
  }
  .jbb-product-card-add i {
    font-size: 11px;
  }
  .jbb-product-card-image {
    margin-bottom: 10px;
  }
}

@media (max-width: 400px) {
  .jbb-product-grid-2,
  .jbb-product-grid-3,
  .jbb-product-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  .jbb-product-card {
    padding: 6px;
    border-radius: 10px;
  }
  .jbb-product-card-name {
    font-size: 11px;
  }
  .jbb-product-card-new {
    font-size: 12px;
  }
  .jbb-product-card-add {
    font-size: 10px;
    padding: 8px 4px;
    gap: 4px;
  }
  .jbb-product-card-badge {
    font-size: 9px;
    padding: 2px 6px;
    top: 6px;
    left: 6px;
  }
  .jbb-product-card-wishlist {
    width: 24px;
    height: 24px;
    top: 6px;
    right: 6px;
  }
  .jbb-product-card-wishlist i {
    font-size: 11px;
  }
}

@media (max-width: 340px) {
  /* On very tiny screens, hide stars to avoid cramping */
  .jbb-product-card-stars,
  .jbb-product-card-review-count {
    display: none;
  }
}

/* ============================================================
   HOME SECTIONS
   ============================================================ */
.jbb-home-section {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

/* ============================================================
   HOME — CATEGORY HORIZONTAL SCROLLER
   ============================================================ */
.jbb-home-cat {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  padding: 4px 4px 16px;
  margin: 0 -4px;
  scrollbar-width: thin;
  scrollbar-color: #D6C7B8 transparent;
}

.jbb-home-cat > .jbb-category-card {
  flex: 0 0 auto;
  width: 240px;
  scroll-snap-align: start;
}

.jbb-home-cat::-webkit-scrollbar { height: 6px; }
.jbb-home-cat::-webkit-scrollbar-track { background: transparent; }
.jbb-home-cat::-webkit-scrollbar-thumb {
  background: #D6C7B8;
  border-radius: 999px;
}
.jbb-home-cat::-webkit-scrollbar-thumb:hover { background: #C07D5A; }

@media (hover: none) and (pointer: coarse) {
  .jbb-home-cat {
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .jbb-home-cat::-webkit-scrollbar { display: none; }
}

@media (max-width: 560px) {
  .jbb-home-cat > .jbb-category-card {
    width: 200px;
  }
}

/* ============================================================
   HOME — COLLECTIONS BENTO
   ============================================================ */
.jbb-home-collections {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 20px;
  width: 100%;
  height: 520px;
}

.jbb-home-collections > :nth-child(1) { grid-column: 1; grid-row: 1 / span 2; }
.jbb-home-collections > :nth-child(2) { grid-column: 2 / span 2; grid-row: 1; }
.jbb-home-collections > :nth-child(3) { grid-column: 2 / span 2; grid-row: 2; }

/* ============================================================
   NEW DESIGN ELEMENTS (HERO, TRUST BAR, CATEGORIES)
   ============================================================ */
.jbb-home section:first-of-type { background: #FDFBF7; }

.home-badges {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.jbb-category-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--c-line);
  text-decoration: none;
  color: inherit;
  transition: transform .25s ease, box-shadow .25s ease;
}

.jbb-category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(20, 17, 16, 0.08);
}

.jbb-category-card-image {
  aspect-ratio: 1/1;
  background: #EFE8E0;
  overflow: hidden;
  position: relative;
}

.jbb-category-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

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

.jbb-category-card-body {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-top: 1px solid var(--c-line-2);
}

.jbb-category-card-title {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: #141110;
}

.jbb-category-card-arrow {
  color: var(--c-ink-4);
  font-size: 12px;
  transition: color .2s ease, transform .2s ease;
}

.jbb-category-card:hover .jbb-category-card-arrow {
  color: #141110;
  transform: translateX(3px);
}

.jbb-cat-arrow:hover {
  background: #F5EFE7 !important;
  border-color: #C07D5A !important;
}

/* ============================================================
   RESPONSIVE — HOME
   ============================================================ */
@media (max-width: 1024px) {
  .jbb-home-collections {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
  }
  .jbb-home-collections > * {
    grid-column: 1 !important;
    grid-row: auto !important;
    min-height: 260px;
  }
  .home-badges {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .jbb-home-faq {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .jbb-home > section:first-of-type > div > div {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .jbb-home > section:first-of-type {
    padding: 64px 16px 32px !important;
  }
}

@media (max-width: 560px) {
  .home-badges {
    grid-template-columns: 1fr !important;
  }
  .jbb-category-card-body {
    padding: 12px 16px;
  }
}

/* ============================================================
   PAGINATION
   ============================================================ */
.jbb-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.jbb-page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--c-line);
  background: #fff;
  color: var(--c-ink);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.jbb-page-btn:hover:not(:disabled) { background: var(--c-line-2); }
.jbb-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.jbb-page-btn-active { background: #141110; color: #fff; border-color: #141110; }
.jbb-page-ellipsis { color: var(--c-ink-4); padding: 0 6px; font-size: 13px; }

/* ============================================================
   FILTERS
   ============================================================ */
.jbb-filter-title {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  color: #141110;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--c-line);
}

.jbb-filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jbb-filter-item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--c-ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .15s ease;
  font-family: inherit;
}

.jbb-filter-item:hover { background: var(--c-line-2); }
.jbb-filter-item.is-active { background: #F5EFE7; font-weight: 600; }

/* ============================================================
   SEARCH BAR
   ============================================================ */
.jbb-search-bar { position: relative; width: 100%; }

.jbb-search-input {
  width: 100%;
  padding: 14px 88px 14px 20px;
  border: 1px solid var(--c-line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s ease;
}

.jbb-search-input:focus { border-color: var(--c-ink-3) !important; }

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.jbb-breadcrumbs a:hover { color: var(--c-ink) !important; }

/* ============================================================
   RATING STARS
   ============================================================ */
.jbb-rating-stars {
  color: #F59E0B;
  font-size: 11px;
  letter-spacing: 2px;
  display: inline-flex;
  gap: 1px;
}

.jbb-star-picker i { cursor: pointer; transition: transform .1s ease; }
.jbb-star-picker i:hover { transform: scale(1.15); }

/* ============================================================
   QUANTITY PICKER
   ============================================================ */
.jbb-qty {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--c-line);
  background: #fff;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  user-select: none;
}

.jbb-qty button {
  color: var(--c-ink);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  background: none;
  border: none;
}

.jbb-qty button:hover { color: var(--c-brand); }
.jbb-qty-value { font-weight: 500; min-width: 16px; text-align: center; }

/* ============================================================
   COUPON
   ============================================================ */
.jbb-coupon { display: flex; flex-direction: column; gap: 10px; }

.jbb-coupon-input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  font-size: 13px;
  text-transform: uppercase;
  font-family: inherit;
  outline: none;
  letter-spacing: 0.05em;
}

.jbb-coupon-input:focus { border-color: var(--c-ink-3) !important; }

.jbb-coupon-apply {
  background: #141110;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
}

.jbb-coupon-apply:disabled { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   SHIPPING
   ============================================================ */
.jbb-shipping label input[type="radio"] {
  accent-color: #141110;
  width: 16px;
  height: 16px;
}

/* ============================================================
   ORDER SUMMARY
   ============================================================ */
.jbb-summary { display: flex; flex-direction: column; gap: 10px; font-size: 13px; }

/* ============================================================
   STATES
   ============================================================ */
.jbb-state-block {
  text-align: center;
  padding: 64px 24px;
  max-width: 460px;
  margin: 0 auto;
}

.jbb-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--c-brand-soft);
  color: var(--c-brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  font-size: 30px;
}

.jbb-state-icon-danger { background: #FEE2E2; color: var(--c-danger); }
.jbb-state-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 600;
  color: var(--c-ink);
  margin-bottom: 12px;
}
.jbb-state-text {
  font-size: 14px;
  color: var(--c-ink-4);
  line-height: 1.6;
  margin-bottom: 28px;
}
.jbb-state-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.jbb-state-btn {
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .2s ease;
}
.jbb-state-btn-primary { background: var(--c-ink); color: #fff; }
.jbb-state-btn-primary:hover { background: #333; }
.jbb-state-btn-ghost {
  background: #fff;
  color: var(--c-ink);
  border: 1px solid var(--c-line);
}
.jbb-state-btn-ghost:hover { background: var(--c-line-2); }

/* ============================================================
   PRODUCT DETAIL HELPERS
   ============================================================ */
.jbb-tab { transition: color .15s ease, border-color .15s ease; }

.jbb-variant-btn {
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.jbb-variant-btn:not(:disabled):hover { border-color: #141110; }

/* ============================================================
   SPINNER
   ============================================================ */
.jbb-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: jbb-spin .7s linear infinite;
  vertical-align: -2px;
}

@keyframes jbb-spin { to { transform: rotate(360deg); } }

/* ============================================================
   CART ROWS
   ============================================================ */
@media (max-width: 900px) {
  .jbb-cart-row {
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 10px !important;
  }
  .jbb-cart-row .jbb-cart-price { grid-column: 2 / 3; }
}

/* ============================================================
   FOOTER / NAV
   ============================================================ */
footer a:hover { color: #fff !important; opacity: 1 !important; }
footer .jbb-social i { margin-right: 6px; }
.jbb-nav a:hover { color: var(--c-brand) !important; }

.jbb-mobile-link {
  display: block;
  color: #141110;
  text-decoration: none;
  font-weight: 500;
  transition: color .15s ease;
}
.jbb-mobile-link:hover { color: var(--c-brand); }

/* ============================================================
   MISC
   ============================================================ */
a { transition: color .15s ease, opacity .15s ease; }
::selection { background: var(--c-brand); color: #fff; }
html { scroll-behavior: smooth; }

/* ============================================================
   PRODUCT CARD WISHLIST BUTTON
   ============================================================ */
.jbb-product-card-wishlist {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  color: #78716C;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  transition: color .2s ease, transform .2s ease;
}

.jbb-product-card-wishlist:hover {
  color: #B91C1C;
  transform: scale(1.1);
}

.jbb-product-card-wishlist i {
  font-size: 14px;
}

/* ============================================================
   CATEGORIES / COLLECTIONS LISTING GRIDS
   These pages build their own grids (not via ProductGrid),
   so they need their own mobile rule to force 2 columns.
   ============================================================ */
@media (max-width: 560px) {
  #categories-grid,
  #collections-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  #categories-grid .jbb-category-card-body,
  #collections-grid > a > div:last-child {
    padding: 12px !important;
  }

  #categories-grid h3,
  #collections-grid h3 {
    font-size: 13px !important;
  }

  #categories-grid p,
  #collections-grid p {
    font-size: 11px !important;
  }
}

@media (max-width: 400px) {
  #categories-grid,
  #collections-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
}