
.header-catalog-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.header-catalog-search + .header-nav {
  flex: 0 0 auto;
  margin-left: 16px;
}

.header-catalog-search__toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.header-catalog-search__toggle:hover,
.header-catalog-search__toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.header-catalog-search__toggle:active {
  transform: scale(0.96);
}

.header-catalog-search__toggle:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.header-catalog-search__icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-catalog-search__panel {
  flex: 0 1 auto;
  width: clamp(180px, 24vw, 320px);
  animation: catalogSearchReveal 0.16s ease-out;
}

@keyframes catalogSearchReveal {
  from {
    opacity: 0;
    transform: translateX(6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.catalog-search {
  margin: 0;
}

.catalog-search__inner {
  position: relative;
  width: 100%;
}

.catalog-search__input {
  width: 100%;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 0 16px;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: box-shadow .18s ease, border-color .18s ease;
  background: var(--color-dark-light);
  color: var(--theme-text, #f8fafc);
  caret-color: var(--theme-text, #f8fafc);
}

.catalog-search__input::placeholder {
  color: var(--theme-muted, #94a3b8);
  opacity: 1;
}

.catalog-search__input::-webkit-search-cancel-button {
  width: 1em;
  height: 1em;
  -webkit-appearance: none;
  appearance: none;
  background:
    linear-gradient(
      45deg,
      transparent 44%,
      currentColor 44%,
      currentColor 56%,
      transparent 56%
    ),
    linear-gradient(
      -45deg,
      transparent 44%,
      currentColor 44%,
      currentColor 56%,
      transparent 56%
    );
  cursor: pointer;
}

.catalog-search__input:focus {
  border-color: var(--theme-focus, rgba(96, 165, 250, 0.8));
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.catalog-filters{
  margin: 10px 0 16px;
  position: sticky;
  top: calc(var(--header-height, 72px) + 4px);
  z-index: 25;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--theme-panel-translucent, rgba(255, 255, 255, 0.95));
  border: 1px solid var(--theme-border, rgba(15, 23, 42, 0.10));
  box-shadow: 0 6px 20px rgba(var(--theme-shadow-rgb, 15, 23, 42), 0.06);
  backdrop-filter: blur(6px);
}

.catalog-tags{
  display:flex;
  align-items:center;
  gap:6px;
  flex: 0 0 auto;
  flex-wrap:wrap;
  justify-content:flex-start;
}

.catalog-tags::-webkit-scrollbar {
  height: 6px;
}

.catalog-tags::-webkit-scrollbar-thumb {
  background: var(--theme-hover, rgba(15, 23, 42, 0.2));
  border-radius: 999px;
}

.tag-chip{
  border: 1px solid var(--theme-border, rgba(15, 23, 42, 0.12));
  background: var(--theme-raised, #f8fafc);
  color: var(--theme-text, #334155);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  white-space: nowrap;
  flex: 0 0 auto;
}

.tag-chip:hover{
  background: var(--theme-hover, rgba(15, 23, 42, 0.04));
}

.tag-chip.is-active{
  background: var(--theme-panel, #ffffff);
  border-color: var(--theme-border, rgba(15, 23, 42, 0.24));
  color: var(--theme-text, #0f172a);
  font-weight: 700;
}

@media (min-width: 769px) {
  .header-catalog-search {
    gap: 0;
  }

  .header-catalog-search__toggle {
    display: none;
  }
}

@media (max-width: 768px){
  .header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) repeat(4, 44px);
    column-gap: 4px;
    grid-template-rows: 72px auto;
    align-items: center;
    height: auto;
  }

  .header__logo {
    grid-column: 1;
    grid-row: 1;
  }

  .header-catalog-search {
    display: contents;
  }

  .header-catalog-search__toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-left: 0;
    width: 44px;
    height: 44px;
  }

  .header-catalog-search__panel {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    padding-bottom: 10px;
    animation-name: catalogSearchRevealMobile;
  }

  html.is-catalog-search-open .header-catalog-search__panel {
    display: block;
  }

  .header-catalog-search + .header-nav {
    margin-left: 0;
  }

  .header-mobile-cart {
    grid-column: 4;
    grid-row: 1;
    margin-left: 0;
    width: 44px;
    height: 44px;
  }

  .mobile-toggle {
    grid-column: 5;
    grid-row: 1;
    margin-left: 0;
    width: 44px;
    height: 44px;
  }

  .catalog-filters {
    top: var(--header-height, 72px);
  }

  html.is-catalog-search-open .catalog-filters {
    top: var(--header-height, 124px);
  }

}

@keyframes catalogSearchRevealMobile {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px){
  .catalog-filters{
    padding: 9px;
  }
  .catalog-tags{
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
}

@media (min-width: 769px) and (max-width: 1023px) {
  .header-catalog-search__panel { width: 180px; }
  .header-catalog-search + .header-nav { margin-left: 12px; }
}
@media (max-width: 768px) {
  .theme-toggle { grid-column: 3; grid-row: 1; margin-left: 0; }
  .header__logo { min-width: 0; }
  .header__logo-image {
    max-width: 96px;
    width: 100%;
    height: 20px;
    object-fit: contain;
    object-position: left center;
  }
}
