/* ====================================================================
   ALQUSSADI — Category Archive (taxonomy-product_cat.php)
   Namespaced to .cat-hero, .cat-sidebar-*, .cat-subcat-*, .cat-empty
   All other shop layout/grid/card styles live in woocommerce.css.
   ==================================================================== */

/* ============================================================
   CATEGORY HERO
   ============================================================ */
.cat-hero {
  position: relative;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

/* Image variant — background-image set inline */
.cat-hero--image {
  background-size: cover;
  background-position: center;
  min-height: 260px;
}

/* Dark overlay for image variant */
.cat-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(11,24,73,.72) 0%, rgba(11,24,73,.45) 100%);
  z-index: 1;
}

.cat-hero__inner {
  position: relative;
  z-index: 2;
  padding: 36px 0 32px;
}

/* Breadcrumb */
.cat-hero__breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-500);
  margin-bottom: 14px;
}

.cat-hero__breadcrumb a {
  color: var(--ink-500);
  transition: color 0.15s;
}

.cat-hero__breadcrumb a:hover {
  color: var(--blue-600);
}

/* Override colours in image variant */
.cat-hero--image .cat-hero__breadcrumb,
.cat-hero--image .cat-hero__breadcrumb a {
  color: rgba(255, 255, 255, 0.75);
}

.cat-hero--image .cat-hero__breadcrumb a:hover {
  color: #fff;
}

/* Title */
.cat-hero__title {
  font-size: 32px;
  font-weight: 800;
  color: var(--navy-900);
  margin: 0 0 10px;
  line-height: 1.25;
}

.cat-hero--image .cat-hero__title {
  color: #fff;
}

/* Description */
.cat-hero__desc {
  font-size: 15px;
  color: var(--ink-600, var(--ink-500));
  margin: 0;
  max-width: 600px;
  line-height: 1.7;
}

.cat-hero--image .cat-hero__desc {
  color: rgba(255, 255, 255, 0.85);
}

/* ============================================================
   SIDEBAR HEADER (close button row — mobile only)
   ============================================================ */
.cat-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cat-sidebar-header .sidebar-title {
  margin: 0;
}

.cat-sidebar-close {
  display: none;
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--ink-500);
  line-height: 1;
}

.cat-sidebar-close:hover {
  color: var(--navy-900);
}

/* ============================================================
   SUBCATEGORY LIST
   ============================================================ */
.cat-subcats {
  margin-bottom: 24px;
}

.cat-subcat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 14px;
  color: var(--ink-700);
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.cat-subcat-item:hover {
  background: var(--bg-soft);
  color: var(--navy-900);
}

.cat-subcat-item.active {
  background: var(--blue-50, #eff6ff);
  color: var(--blue-600);
  font-weight: 700;
}

.cat-subcat-all {
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  margin-bottom: 4px;
  padding-bottom: 12px;
}

.cat-subcat-all:hover {
  background: none;
  color: var(--blue-600);
}

.cat-subcat-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-subcat-count {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ink-400);
  background: var(--bg-soft);
  border-radius: var(--r-full);
  padding: 2px 7px;
  font-weight: 600;
}

.cat-subcat-item.active .cat-subcat-count {
  background: var(--blue-100, #dbeafe);
  color: var(--blue-600);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.cat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 64px 24px;
  min-height: 40vh;
}

.cat-empty-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--r-full);
  background: var(--bg-soft);
  color: var(--ink-300);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  flex-shrink: 0;
}

.cat-empty h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy-900);
  margin: 0 0 10px;
}

.cat-empty p {
  font-size: 14px;
  color: var(--ink-500);
  margin: 0 0 28px;
}

.cat-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--navy-900);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-full);
  transition: background 0.2s, transform 0.15s;
}

.cat-empty-btn:hover {
  background: var(--blue-600);
  transform: translateY(-1px);
}

/* ============================================================
   PRODUCT GRID OVERRIDE — 4 columns on wide desktop
   (sidebar is 260px; main area is wide enough for 4 cols at ≥1280px)
   ============================================================ */
@media (min-width: 1280px) {
  .shop-layout .shop-main .shop-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

/* ============================================================
   RESPONSIVE — Tablet ≤ 1023px
   ============================================================ */
@media (max-width: 1023px) {
  .cat-hero__title {
    font-size: 26px;
  }

  .cat-hero--image {
    min-height: 200px;
  }

  .cat-hero__inner {
    padding: 28px 0 24px;
  }
}

/* ============================================================
   RESPONSIVE — Mobile ≤ 767px
   ============================================================ */
@media (max-width: 767px) {
  .cat-hero__title {
    font-size: 22px;
  }

  .cat-hero__desc {
    font-size: 14px;
  }

  .cat-hero__inner {
    padding: 22px 0 18px;
  }

  .cat-hero--image {
    min-height: 160px;
  }

  /* Sidebar becomes a slide-in panel from the right (RTL) */
  #cat-sidebar {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    border-radius: 0;
    overflow-y: auto;
    max-width: 300px;
    right: 0;
    left: auto;
  }

  #cat-sidebar.open {
    display: block;
  }

  .cat-sidebar-close {
    display: block;
  }
}

/* ============================================================
   OVERFLOW SAFETY
   ============================================================ */
.cat-hero,
.cat-hero * {
  box-sizing: border-box;
  max-width: 100%;
}
