:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --dark: #111827;
  --sale: #b91c1c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

.store-shell {
  max-width: 1120px;
  margin: 22px auto 48px;
  padding: 0 16px;
}

.catalog-layout {
  display: block;
}

.top-tabs-panel {
  padding: 0;
  overflow: hidden;
}

.sticky-header-panel {
  position: sticky;
  top: 10px;
  z-index: 30;
}

/* Одна белая «плитка» с чипами, как блок категорий ниже (без серой полосы) */
.top-tabs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--card);
}

.top-admin-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.top-admin-links .btn {
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
}

/* Как у .inline-filters: отступы задаёт .top-tabs-row */
.top-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
}

.top-tabs .top-tab {
  flex: 0 0 auto;
}

.top-admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  padding: 14px;
  margin-bottom: 14px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 28px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}

.select-control {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  will-change: transform;
  display: flex;
  flex-direction: column;
}

@media (hover: hover) and (pointer: fine) {
  .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.12);
    border-color: #d6dbe3;
  }
}

.product-card-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  color: inherit;
  text-decoration: none;
}

.product-card-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}


.catalog-cart-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.catalog-cart-controls .btn-qty {
  flex: 0 0 auto;
  min-width: 40px;
  padding: 6px 12px;
  font-weight: 700;
}

.catalog-cart-qty {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
}

.catalog-cart-controls .catalog-cart-add {
  width: 100%;
}

.top-tabs-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
  gap: 8px;
}

.top-store-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.top-store-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
}

.top-store-link.active {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
}

.top-store-link.active .store-cart-qty {
  background: #f3f4f6;
  color: var(--dark);
}

.store-cart-qty {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 1px 6px;
}

.store-cart-qty.hidden {
  display: none;
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  margin-bottom: 8px;
}

.product-image-wrap {
  position: relative;
}

.card-discount-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  display: inline-block;
  background: #fee2e2;
  color: var(--sale);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.product-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
}

.variant-price-row {
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.product-detail-price {
  margin-top: 10px;
  margin-bottom: 12px;
}

.product-detail-price .variant-price-row {
  margin-bottom: 0;
}

.price-current {
  font-size: 18px;
  font-weight: 700;
}

.price-old {
  font-size: 13px;
  color: var(--muted);
  text-decoration: line-through;
}

.discount-badge {
  display: inline-block;
  background: #fee2e2;
  color: var(--sale);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.btn:hover {
  background: #f3f4f6;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.disabled-link {
  opacity: 0.45;
  pointer-events: none;
}

.back-link {
  color: var(--dark);
  text-decoration: none;
  font-weight: 600;
}

.back-btn {
  display: inline-block;
  text-decoration: none;
}

.product-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 14px;
}

.main-image {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
}

.zoom-link,
.thumb-link {
  display: block;
  cursor: zoom-in;
}

.zoom-btn,
.thumb-btn {
  border: 0;
  background: transparent;
  padding: 0;
  width: 100%;
  text-align: inherit;
}

.thumbs {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.thumbs img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.gallery-modal.hidden {
  display: none;
}

.gallery-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.gallery-modal__content {
  position: relative;
  margin: 24px auto;
  width: min(1200px, calc(100vw - 24px));
  height: calc(100vh - 48px);
  background: #fff;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 96px 1fr 92px;
  gap: 10px;
  padding: 12px;
}

.gallery-modal__close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.gallery-modal__thumbs {
  overflow-y: auto;
  display: grid;
  gap: 8px;
  align-content: start;
}

.gallery-modal__thumb {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

.gallery-modal__thumb.is-active {
  border-color: var(--dark);
}

.gallery-modal__thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.gallery-modal__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.gallery-modal__stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-modal__controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}

.gallery-modal__nav {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 42px;
  height: 42px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.feature-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.feature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.feature-card img {
  width: 38px;
  height: 38px;
}

.variant-selector {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.variant-block {
  display: grid;
  gap: 6px;
}

.opt-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  background: #fff;
  color: #374151;
  cursor: pointer;
}

.chip.active {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
}

.chip.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
}

.variant-selected {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f9fafb;
  margin-bottom: 12px;
}

.variant-selected strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.variant-meta {
  font-size: 12px;
  color: var(--muted);
}

.stock-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
}

.stock-badge.out-of-stock {
  background: #fee2e2;
  color: #b91c1c;
}

.stock-badge--low {
  background: #ffedd5;
  color: #c2410c;
}

.stock-badge--last {
  background: #fecaca;
  color: #991b1b;
}

/* Покупатель: в одну строку — наличие, доставка, пол */
.variant-buyer-stock {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 12px;
}

.variant-buyer-stock .stock-badge {
  margin-top: 0;
}

.variant-buyer-inline {
  font-size: 13px;
}

.variant-list {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.section-title {
  margin: 0 0 8px;
}

.inline-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-filters-secondary {
  padding-top: 2px;
}

.category-link,
.top-tab {
  display: inline-block;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  background: #fff;
  font-size: 14px;
}

.category-link.active,
.top-tab.active {
  border-color: var(--dark);
  background: var(--dark);
  color: #fff;
}

/* Как у .btn: лёгкий hover и нажатие */
.category-link,
.top-tab,
.top-store-link,
.top-admin-link {
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease,
    border-color 0.15s ease, color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .category-link:hover:not(.active),
  .top-tab:hover:not(.active),
  .top-store-link:hover:not(.active),
  .top-admin-link:hover {
    background: #f3f4f6;
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08);
  }

  .category-link.active:hover,
  .top-tab.active:hover,
  .top-store-link.active:hover {
    box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.18);
  }
}

.category-link:active,
.top-tab:active,
.top-store-link:active,
.top-admin-link:active {
  transform: translateY(1px);
}

.variant-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  font-size: 13px;
}

.product-cart-panel {
  margin: 16px 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Карточка товара: кнопки корзины слева */
.product-cart-panel--detail {
  justify-content: flex-start;
}

.product-cart-panel--detail #site-detail-cart-controls {
  width: 100%;
}

.product-cart-panel--detail .catalog-cart-controls {
  justify-content: flex-start;
  width: 100%;
}

.site-add-qty-input {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.list-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.order-head {
  cursor: pointer;
}

.cart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.total-label {
  font-size: 18px;
  font-weight: 700;
  margin-top: 12px;
}

.disabled-link {
  pointer-events: none;
  opacity: 0.45;
}

@media (max-width: 980px) {
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-layout { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .top-tabs-row {
    flex-direction: column;
    align-items: stretch;
  }
  .top-store-links {
    margin-left: 0;
  }
  .top-admin-links {
    width: 100%;
    justify-content: flex-start;
  }
}
