/* Digikala-inspired mobile categories panel — sits above bottom nav */
#kavani-mobile-categories {
  --kavani-mcat-nav-h: calc(3.85rem + env(safe-area-inset-bottom, 0px));
  display: none;
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  bottom: var(--kavani-mcat-nav-h) !important;
  width: 100% !important;
  height: auto !important;
  z-index: 980 !important; /* below .nav-mobile-tw (z-990) */
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
}

#kavani-mobile-categories.open {
  display: block !important;
}

/* Closed state must not steal taps from the bottom nav */
#kavani-mobile-categories:not(.open),
#kavani-mobile-categories:not(.open) * {
  pointer-events: none !important;
}

.kavani-mcat__shell {
  position: absolute !important;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex !important;
  flex-direction: column !important;
  width: 100%;
  height: 100%;
  background: #fff !important;
}

.kavani-mcat__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: calc(0.65rem + env(safe-area-inset-top, 0px)) 0.75rem 0.65rem;
  border-bottom: 1px solid #ececec;
  background: #fff;
  min-height: 3.5rem;
  position: relative;
  z-index: 5;
}

.kavani-mcat__title {
  margin: 0;
  flex: 1;
  text-align: right;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0c0c0c;
}

.kavani-mcat__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 4.25rem;
  height: 2.35rem;
  padding: 0 0.7rem;
  border: 1px solid #e5e5e5;
  border-radius: 9999px;
  background: #f3f3f3;
  color: #0c0c0c;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  flex-shrink: 0;
}

.kavani-mcat__close svg {
  flex-shrink: 0;
}

.kavani-mcat__close:active {
  background: #fd4718;
  border-color: #fd4718;
  color: #fff;
}

.kavani-nav-cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  line-height: 0;
}

.kavani-nav-cat-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.kavani-mcat__body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.kavani-mcat__rail {
  width: 5.5rem;
  flex-shrink: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f5f5f5;
  border-left: 1px solid #ececec;
  scrollbar-width: thin;
}

.kavani-mcat__panels {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  background: #fff;
}

.kavani-mcat__ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 55%;
  height: 55%;
  color: #b0b0b0;
}

.kavani-mcat__ph svg {
  width: 100%;
  height: 100%;
  display: block;
}

.kavani-mcat__rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.75rem 0.4rem;
  border: 0;
  border-bottom: 1px solid #e8e8e8;
  background: #f5f5f5;
  color: #62666d;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.kavani-mcat__rail-item.is-active {
  background: #fff;
  color: #fd4718;
  box-shadow: inset -3px 0 0 #fd4718;
}

.kavani-mcat__rail-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #eee;
}

.kavani-mcat__rail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.kavani-mcat__rail-label {
  font-size: 0.68rem;
  line-height: 1.25;
  text-align: center;
  font-weight: 500;
}

.kavani-mcat__panel {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 0.75rem 2rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.kavani-mcat__panel.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.kavani-mcat__all-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 0.15rem;
  color: #fd4718;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
}

.kavani-mcat__all-link:hover {
  color: #e03d12;
}

.kavani-mcat__section {
  border-bottom: 1px solid #f0f0f0;
}

.kavani-mcat__section-toggle,
.kavani-mcat__section-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.85rem 0.15rem;
  border: 0;
  background: transparent;
  color: #0c0c0c;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: right;
  text-decoration: none;
  cursor: pointer;
}

.kavani-mcat__section-toggle > span:not(.kavani-mcat__section-link-img),
.kavani-mcat__section-link .grow {
  flex: 1;
}

.kavani-mcat__chevron {
  transition: transform 0.25s ease;
  color: #81858b;
}

.kavani-mcat__section.is-open .kavani-mcat__chevron {
  transform: rotate(180deg);
  color: #fd4718;
}

.kavani-mcat__section-link-img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  overflow: hidden;
  background: #f5f5f5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kavani-mcat__section-link-img img,
.kavani-mcat__section-link-img .kavani-mcat__ph {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.kavani-mcat__section-link-img .kavani-mcat__ph {
  width: 55%;
  height: 55%;
}

.kavani-mcat__section-body {
  padding: 0 0 0.85rem;
}

.kavani-mcat__leaf-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.25rem;
}

.kavani-mcat__leaf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.2rem;
  text-decoration: none;
  color: #3f4064;
  text-align: center;
  border-radius: 0.75rem;
  transition: background 0.2s ease;
}

.kavani-mcat__leaf:active {
  background: #f7f7f7;
}

.kavani-mcat__leaf-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 9999px;
  background: #f5f5f5;
  overflow: hidden;
}

.kavani-mcat__leaf-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.25rem;
}

.kavani-mcat__leaf-img--icon {
  color: #81858b;
}

.kavani-mcat__leaf-name {
  font-size: 0.6875rem;
  line-height: 1.35;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kavani-mcat__brands {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f0f0f0;
}

.kavani-mcat__brands-title {
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0c0c0c;
}

.kavani-mcat__brand-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem 0.4rem;
}

.kavani-mcat__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: #3f4064;
  text-align: center;
}

.kavani-mcat__brand-img {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  max-width: 4.5rem;
  border-radius: 0.85rem;
  background: #fafafa;
  border: 1px solid #eee;
  overflow: hidden;
  padding: 0.45rem;
}

.kavani-mcat__brand-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: darken;
}

.kavani-mcat__brand-name {
  font-size: 0.6875rem;
  line-height: 1.3;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Keep panel available whenever mobile nav exists (wp_is_mobile), even on wide viewports. */
