/* ==========================================================================
   Component styles — Avatar UI kit
   Depends on tokens.css (custom properties + type utility classes)
   ========================================================================== */

/* ---------------------------------------------------------------- Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-button);
  line-height: var(--lh-button);
  letter-spacing: -0.02em;
  white-space: nowrap;
  transition: background-color .15s ease, opacity .15s ease;
}
.btn__icon { width: 20px; height: 20px; flex-shrink: 0; }

.btn--primary { background: var(--color-accent); color: var(--color-text-on-accent); }
.btn--primary:hover { background: var(--color-accent-hover); }

.btn--secondary { background: var(--color-surface); color: var(--color-text); }
.btn--secondary:hover { background: var(--color-surface-hover); }

.btn:disabled,
.btn--disabled { opacity: .4; pointer-events: none; }

.btn--block { width: 100%; }

/* ------------------------------------------------------------ Search input */
.input-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-input-bg);
  transition: box-shadow .15s ease, background-color .15s ease;
}
.input-search__icon { width: 14px; height: 14px; opacity: .5; flex-shrink: 0; }
.input-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-label-m);
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.input-search input::placeholder { color: var(--color-text); opacity: .5; }

.input-search:hover { background: rgba(255, 255, 255, 0.14); }
.input-search--active { box-shadow: inset 0 0 0 1px var(--color-accent); }

/* ------------------------------------------------------------------ Header */
.site-header {
  background: var(--color-header-bg);
  backdrop-filter: var(--blur-header);
  -webkit-backdrop-filter: var(--blur-header);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-4) var(--gutter-desktop);
}

.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-10);
  min-width: 0;
}
.site-header__logo { flex-shrink: 0; }
.site-header__logo img { width: 138px; height: 22px; }

.site-header__geo {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
}
.site-header__geo img { width: 32px; height: 32px; }
.site-header__geo .arrow { width: 14px; height: 14px; opacity: .7; }

.site-header__search { flex: 1 1 auto; min-width: 0; max-width: 520px; }

.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  margin-left: auto;
}
.site-header__nav a { font-size: var(--fs-label-m); letter-spacing: -0.02em; opacity: .8; }
.site-header__nav a:hover { opacity: 1; }

.site-header__burger {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
}
.site-header__burger img { width: 20px; height: 20px; }

.site-header__categories {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}
.category-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-label-m);
  letter-spacing: -0.02em;
  opacity: .8;
}
.category-link--active { opacity: 1; }
.category-link__dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: transparent; }
.category-link--active .category-link__dot { background: var(--color-accent); }

@media (max-width: 768px) {
  .site-header { padding: var(--space-4) var(--gutter-tablet); }
}
@media (max-width: 480px) {
  .site-header { padding: var(--space-4) var(--gutter-mobile); }
}
.site-header__icon-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
.site-header__icon-btn img { width: 24px; height: 24px; }
.site-header__close-toggle { display: none; }

/* Tablet + mobile: top nav links and category chips collapse into
   a "burger" that opens the full-width .mobile-menu drawer below the header. */
@media (max-width: 900px) {
  .site-header__nav,
  .site-header__geo-label,
  .site-header__categories { display: none; }
  .site-header__burger { display: flex; flex-shrink: 0; }

  .site-header--menu-open .site-header__burger { display: none; }
  .site-header--menu-open .site-header__close-toggle { display: flex; }
  .site-header--menu-open .mobile-menu { display: flex; }
}

/* Mobile only: geo + search additionally collapse to icon buttons;
   tapping search expands it inline (replacing the icon row). */
@media (max-width: 480px) {
  .site-header__bar { gap: var(--space-3); }
  .site-header__geo,
  .site-header__search { display: none; }
  .site-header__geo-icon,
  .site-header__search-toggle { display: flex; }

  .site-header--search-open .site-header__geo-icon,
  .site-header--search-open .site-header__search-toggle,
  .site-header--search-open .site-header__burger { display: none; }
  .site-header--search-open .site-header__search {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
  }
  .site-header--search-open .site-header__close-toggle { display: flex; }

  .site-header--menu-open .site-header__search-toggle { display: none; }
}

/* ------------------------------------------------------------- Mobile menu */
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: var(--space-10);
  padding: 0 var(--gutter-mobile) var(--space-5);
}
@media (min-width: 481px) and (max-width: 900px) {
  .mobile-menu { padding: 0 var(--gutter-tablet) var(--space-5); }
}

.mobile-menu__categories,
.mobile-menu__links,
.mobile-menu__contacts,
.mobile-menu__brand { display: flex; flex-direction: column; }
.mobile-menu__categories { gap: var(--space-6); }
.mobile-menu__links { gap: var(--space-6); }
.mobile-menu__contacts { gap: var(--space-6); }
.mobile-menu__brand { gap: var(--space-5); }

.mobile-menu__category,
.mobile-menu__links a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  opacity: .8;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--fs-label-m-mobile);
  letter-spacing: -0.01em;
}
.mobile-menu__category.is-active { opacity: 1; }
.mobile-menu__category .category-link__dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: transparent; }
.mobile-menu__category.is-active .category-link__dot { background: var(--color-accent); }

.mobile-menu__contacts .h5 { display: block; }
.mobile-menu__contact-buttons { display: flex; gap: var(--space-2); }
.mobile-menu__contact-buttons .btn { flex: 1; }

.mobile-menu__brand img { width: 138px; height: 22px; }
.mobile-menu__brand p { margin: 0; color: var(--color-text-muted-50); }
.mobile-menu__social { display: flex; align-items: center; gap: var(--space-3); }
.mobile-menu__social img { width: 44px; height: 44px; }

/* ------------------------------------------------------------------ Footer */
.site-footer {
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  padding: var(--space-6) var(--gutter-desktop);
}

.site-footer__top {
  display: flex;
  gap: var(--space-10);
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  flex: 0 0 240px;
}
.site-footer__brand img { width: 138px; height: 22px; }
.site-footer__brand p { color: var(--color-text-muted-50); margin: 0; }

.footer-heading {
  display: block;
  color: var(--color-text-muted-50);
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

.site-footer__social { display: flex; align-items: center; gap: var(--space-3); }
.site-footer__social img { width: 44px; height: 44px; }

.site-footer__col {
  display: flex;
  flex-direction: column;
  flex: 0 0 180px;
}
.site-footer__col a { display: block; padding: var(--space-1) 0; font-size: var(--fs-label-m); letter-spacing: -0.02em; }
.site-footer__col a.is-active { color: var(--color-accent-hover); }

.site-footer__contacts {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  margin-left: auto;
}
.site-footer__contacts .h5 { display: block; }

.site-footer__contact-buttons { display: flex; gap: var(--space-2); }
.site-footer__contact-buttons .btn { flex: 1; }

.site-footer__divider { border: none; border-top: 1px solid var(--color-text-muted-30); margin: 0; }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-footer__legal { display: flex; gap: var(--space-10); flex-wrap: wrap; }
.site-footer__legal :first-child { color: var(--color-text-muted-50); }
.site-footer__legal a { color: var(--color-text-muted-80); }
.site-footer__credits { display: flex; gap: var(--space-1); color: var(--color-text-muted-50); }
.site-footer__credits a { color: var(--color-text-muted-80); }

@media (max-width: 768px) {
  .site-footer { padding: var(--space-6) var(--gutter-tablet); }
  .site-footer__top { flex-wrap: wrap; }
  .site-footer__contacts { margin-left: 0; }
}
@media (max-width: 480px) {
  .site-footer { padding: var(--space-6) var(--gutter-mobile); }
  .site-footer__top { flex-direction: column; gap: var(--space-8); }
  .site-footer__brand,
  .site-footer__col { flex: 1 1 auto; }
}

/* ------------------------------------------------------------- Product card */
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.product-card__link { display: flex; flex-direction: column; color: inherit; text-decoration: none; }

.product-card__media { position: relative; height: 320px; }
.product-card__media img { width: 100%; height: 100%; object-fit: cover; }
.product-card__swiper,
.product-card__swiper .swiper-wrapper,
.product-card__swiper .swiper-slide { width: 100%; height: 100%; }
.product-card__pagination {
  position: absolute;
  bottom: var(--space-2);
  left: 0;
  width: 100%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.product-card__dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--color-text-muted-30); cursor: pointer; }
.product-card__dot.is-active { background: var(--color-accent); }
.product-card__badge {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-size: var(--fs-label-m);
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
}

.product-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-6);
}

.product-card__price-row { display: flex; align-items: baseline; gap: var(--space-2); }
.product-card__price { color: var(--color-text); }
.product-card--sale .product-card__price { color: var(--color-accent); }
.product-card__price-old {
  color: var(--color-text-muted-50);
  text-decoration: line-through;
  text-decoration-color: var(--color-gray);
}

.product-card__title { margin: 0; color: var(--color-text-muted-80); }

.product-card__specs {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
}
.product-card__specs > div {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  border-bottom: 1px solid var(--color-text-muted-30);
  padding-bottom: var(--space-2);
}
.product-card__specs dt { margin: 0; color: var(--color-text-muted-50); font-weight: 500; }
.product-card__specs dd { margin: 0 0 0 auto; color: var(--color-text); font-weight: 500; }

@media (max-width: 480px) {
  .product-card__media { height: 142px; }
  .product-card__body { padding: var(--space-4); gap: var(--space-3); }
  .product-card__specs > div { padding-bottom: var(--space-1); }
  .product-card__price-row { flex-wrap: wrap; row-gap: 0; }
  .product-card__price { font-size: 16px; white-space: nowrap; }
  .product-card__price-old { white-space: nowrap; }
}
