/**
 * WooCommerce Category Sidebar Widget — Styles
 *
 * @package    woo-category-sidebar
 * @developer  TheTechiez (https://thetechiez.com)
 * @version    1.0.0
 *
 * Design language: Matches Certification Showcase + Products Showcase widgets
 * Fonts: DM Serif Display (label) + Inter (items)
 */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Inter:wght@300;400;500;600;700&display=swap');

/* ============================================================
   Variables
   ============================================================ */
.wcs-sidebar {
  --wcs-accent: #c0151a;
  --wcs-ink: #1a1714;
  --wcs-ink-mid: #444444;
  --wcs-ink-muted: #888888;
  --wcs-border: rgba(0, 0, 0, 0.08);
  --wcs-bg: #f0ede8;
  --wcs-white: #ffffff;
  --wcs-font-serif: 'DM Serif Display', Georgia, serif;
  --wcs-font-sans: 'Inter', system-ui, sans-serif;

  font-family: var(--wcs-font-sans);
  background: var(--wcs-white);
  border: 1px solid var(--wcs-border);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.wcs-sidebar *,
.wcs-sidebar *::before,
.wcs-sidebar *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================================
   Label / Header
   ============================================================ */
.wcs-label {
  display: block;
  background: var(--wcs-ink);
  color: var(--wcs-white);
  font-family: var(--wcs-font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 13px 20px;
  border-bottom: 1px solid var(--wcs-border);
}

/* ============================================================
   List
   ============================================================ */
.wcs-list {
  list-style: none;
}

.wcs-item {
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--wcs-border);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.wcs-item:last-child {
  border-bottom: none;
}

.wcs-item>a,
.wcs-item-inner>a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wcs-ink-mid);
  text-decoration: none;
  transition: color 0.2s ease;
  line-height: 1.4;
  flex: 1;
}

/* Hover */
.wcs-item:hover {
  border-left-color: var(--wcs-accent);
  background: var(--wcs-bg);
}

.wcs-item:hover a {
  color: var(--wcs-ink);
}

/* Active */
.wcs-item.active {
  border-left-color: var(--wcs-accent);
  background: color-mix(in srgb, var(--wcs-accent) 8%, white);
}

.wcs-item.active a {
  color: var(--wcs-accent);
  font-weight: 600;
}

/* ============================================================
   Item Icon
   ============================================================ */
.wcs-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
  color: var(--wcs-ink-muted);
  transition: color 0.2s;
  font-size: 13px;
}

.wcs-item:hover .wcs-item-icon,
.wcs-item.active .wcs-item-icon {
  color: var(--wcs-accent);
}

/* ============================================================
   Item Inner Wrapper
   ============================================================ */
.wcs-item-inner {
  display: flex;
  align-items: center;
  position: relative;
}

/* ============================================================
   Item Label
   ============================================================ */
.wcs-item-label {
  flex: 1;
}

/* ============================================================
   Sub-Menu & Sub-Items
   ============================================================ */
.wcs-sub-menu {
  display: none;
  list-style: none;
  /* Remove default padding/margin */
  padding: 0;
  margin: 0;
  background: var(--wcs-white);
}

.wcs-item.active-parent>.wcs-sub-menu {
  display: block;
}

.wcs-sub-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px 9px 45px;
  /* Deep indentation for hierarchy */
  font-size: 13.5px;
  font-weight: 400;
  /* Regular weight, distinct from parent */
  color: var(--wcs-ink-mid);
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
  line-height: 1.4;
}

.wcs-sub-item:hover a {
  color: var(--wcs-ink);
  background: var(--wcs-bg);
}

.wcs-sub-item.active a {
  color: var(--wcs-accent);
  font-weight: 500;
  background: color-mix(in srgb, var(--wcs-accent) 6%, white);
}

/* ============================================================
   Sub-Menu Toggle (Arrow)
   ============================================================ */
.wcs-sub-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--wcs-ink-muted);
  transition: color 0.2s;
  margin-right: -10px;
  /* Pull text slightly closer */
  z-index: 2;
  /* Ensure it lies above the clickable area if needed */
}

.wcs-sub-toggle svg {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wcs-item:hover>.wcs-item-inner>.wcs-sub-toggle,
.wcs-item.active-parent>.wcs-item-inner>.wcs-sub-toggle {
  color: var(--wcs-accent);
}

/* Rotate down when parent is active (expanded) */
.wcs-item.active-parent>.wcs-item-inner>.wcs-sub-toggle svg {
  transform: rotate(90deg);
}

/* Spacer for items without children to align nicely */
.wcs-sub-spacer {
  width: 30px;
  flex-shrink: 0;
  margin-right: -10px;
}

/* ============================================================
   Count Badge
   ============================================================ */
.wcs-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--wcs-ink-muted);
  background: var(--wcs-bg);
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  line-height: 1.8;
}

.wcs-item.active .wcs-count {
  color: #ffffff !important;
  background: var(--wcs-accent) !important;
}

/* Active indicator arrow — removed for cleaner look */

/* ============================================================
   Empty state
   ============================================================ */
.wcs-empty {
  padding: 20px;
  font-size: 13px;
  color: var(--wcs-ink-muted);
  line-height: 1.6;
  font-style: italic;
}

/* ============================================================
   Highlight animation — subtle pulse on active item load
   ============================================================ */
@keyframes wcs-highlight {
  0% {
    background: color-mix(in srgb, var(--wcs-accent) 20%, white);
  }

  100% {
    background: color-mix(in srgb, var(--wcs-accent) 8%, white);
  }
}

.wcs-item.active {
  animation: wcs-highlight 0.5s ease both;
}

/* ============================================================
   MOBILE SIDEBAR TOGGLE — below 768px
   ============================================================ */

@media (max-width: 768px) {

  /* Toggle button — hidden by default, shown on mobile */
  .wcs-mobile-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: #1a1714;
    color: #ffffff;
    border: none;
    padding: 13px 20px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    cursor: pointer;
    margin-bottom: 0;
    transition: background 0.3s ease;
  }

  .wcs-mobile-toggle svg {
    margin-left: auto;
    transition: transform 0.3s ease;
  }

  .wcs-mobile-toggle.open svg {
    transform: rotate(180deg);
  }

  /* Hide the list by default on mobile */
  .wcs-sidebar .wcs-list {
    display: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  /* Show when open */
  .wcs-sidebar .wcs-list.wcs-list--open {
    display: block;
    animation: wcs-slide-down 0.25s ease both;
  }

  /* Hide the static label on mobile — replaced by toggle button */
  .wcs-sidebar .wcs-label {
    display: none;
  }

  /* Ensure sidebar takes full width on mobile */
  .wcs-sidebar,
  .elementor-widget-wcs_category_sidebar {
    width: 100% !important;
    border-radius: 0 !important;
    margin-bottom: 20px;
    position: static !important;
  }

  /* Stack layout vertically on mobile */
  .tax-product_cat .e-con-inner,
  .post-type-archive-product .e-con-inner {
    flex-direction: column !important;
  }
}

@media (min-width: 769px) {

  /* Hide toggle button on desktop */
  .wcs-mobile-toggle {
    display: none;
  }
}

/* Slide down animation */
@keyframes wcs-slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}