/* assets/tt-shop-archive.css */

/* === 0. БАЗА / ТЕМНЫЕ ПЕРЕМЕННЫЕ === */
:root {
  --tt-primary: #1e56a0;
  --tt-success: #008a3c;
  --tt-border: #e5e5e5;
  --tt-bg-soft: #f5f7fb;
  --tt-text-main: #111827;
  --tt-text-muted: #6b7280;
}

/* Скрываем стандартные фильтры темы */
.bzotech-container.top_filter-shop,
.main-top-filter,
.content-top-filter {
  display: none !important;
  content: none !important;
}

/* === 1. УБИВАЕМ ЛИШНЕЕ В СЕТКЕ === */
html body .tt-shop-main a.added_to_cart.wc-forward,
html body .tt-shop-main .product-quick-view,
html body .tt-shop-main .quickview-link,
html body .tt-shop-main ul.products::before,
html body .tt-shop-main ul.products::after {
  display: none !important;
  content: none !important;
}

/* === 2. ГЛАВНАЯ РАЗМЕТКА (LAYOUT) === */
html body .tt-shop-layout {
  display: flex !important;
  flex-direction: row-reverse !important;
  align-items: flex-start !important;
  gap: 30px !important;
  width: 100% !important;
  margin-top: 20px !important;
}

html body .tt-shop-sidebar {
  width: 25% !important;
  min-width: 260px !important;
}

html body .tt-shop-main {
  width: 75% !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
}

/* убираем маркеры у любых li в сайдбаре */
html body .tt-shop-sidebar ul,
html body .tt-shop-sidebar li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

html body .tt-shop-sidebar li::before,
html body .tt-shop-sidebar li::after {
  content: none !important;
  display: none !important;
}

/* === 3. ТУЛБАР СОРТИРОВКИ + VIEW SWITCHER === */
html body .tt-shop-main .tt-shop-toolbar {
  width: 100% !important;
  margin-bottom: 24px !important;
  padding: 14px 18px !important;
  background: #ffffff !important;
  border-radius: 14px !important;
  border: 1px solid #e5e7eb !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 16px !important;
}

html body .tt-shop-main .tt-toolbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
}

html body .tt-shop-main .tt-result-count {
  font-size: 14px !important;
  color: var(--tt-text-muted) !important;
}

/* select WooCommerce */
html body .tt-shop-main .woocommerce-ordering {
  margin: 0 !important;
}

html body .tt-shop-main .woocommerce-ordering select {
  min-width: 220px !important;
  height: 40px !important;
  padding: 0 36px 0 12px !important;
  border-radius: 10px !important;
  border: 1px solid #d1d5db !important;
  font-size: 14px !important;
  color: var(--tt-text-main) !important;
  background-color: #ffffff !important;
  background-image: none !important;
  outline: none !important;
}

/* view switcher */
html body .tt-view-switcher {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0 !important;
  padding: 2px !important;
  background: #eef2ff !important;
  border-radius: 999px !important;
}

.tt-view-btn {
  position: relative !important;
  border: none !important;
  background: transparent !important;
  padding: 6px 14px !important;
  min-width: 44px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #374151 !important;
  border-radius: 999px !important;
  cursor: pointer !important;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease !important;
}

.tt-view-btn.is-active {
  background: var(--tt-primary) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 18px rgba(30, 86, 160, 0.35) !important;
}

/* === 4. СЕТКА ТОВАРОВ (GRID) === */
/* Используем minmax(0, 1fr) чтобы картинки не распирали колонки */
html body .tt-shop-main ul.products,
html body .tt-shop-main .tt-products-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 20px !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

html body .tt-shop-main.view-grid-3 ul.products {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
html body .tt-shop-main.view-grid-4 ul.products {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

html body .tt-shop-main ul.products > *,
html body .tt-shop-main .list-col-item {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  clear: none !important;
  display: flex !important;
  flex-direction: column !important;
}

/* Фикс для изображений */
html body .tt-shop-main ul.products img {
  width: 100% !important;
  height: auto !important;
  object-fit: cover !important;
  display: block !important;
}

/* === 4.5. UX LOADER ДЛЯ СЕТКИ === */
html body .tt-shop-main.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 100;
}

html body .tt-shop-main.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 5px solid #f3f4f6;
  border-top: 5px solid var(--tt-primary);
  animation: tt-spin 1s linear infinite;
  z-index: 101;
}

@keyframes tt-spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* === 5. КАРТОЧКА ТОВАРА === */
html body .tt-shop-main .item-product {
  height: 100% !important;
  border: 1px solid #eceff4 !important;
  border-radius: 12px !important;
  padding: 10px !important;
  background: #ffffff !important;
  display: flex !important;
  flex-direction: column !important;
  position: relative !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease !important;
  overflow: hidden !important; /* Важно для мобильных */
}

html body .tt-shop-main .item-product:hover {
  border-color: #d1d5db !important;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.08) !important;
  transform: translateY(-2px) !important;
}

/* базовая кнопка */
html body .tt-shop-main .add_to_cart_button {
  position: relative !important;
  width: 100% !important;
  display: block !important;
  background-color: var(--tt-primary) !important;
  color: #fff !important;
  border: none !important;
  padding: 9px 20px !important;
  border-radius: 999px !important;
  margin-top: 8px !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  text-align: center !important;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease !important;
}
/* лоадер от Woo (класс loading) */
html body .tt-shop-main .add_to_cart_button.loading {
  opacity: 0.9 !important;
}

html body .tt-shop-main .add_to_cart_button.loading::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #ffffff;
  animation: tt-btn-spin 0.8s linear infinite;
}

@keyframes tt-btn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* зелёное состояние "Добавлено" */
html body .tt-shop-main .add_to_cart_button.tt-added-success {
  background-color: var(--tt-success) !important;
  color: #fff !important;
}

html body .tt-shop-main .add_to_cart_button.tt-added-success::before {
  content: "✓";
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
}

html body .tt-shop-main .add_to_cart_button:hover {
  background-color: #18457f !important;
  box-shadow: 0 10px 25px rgba(24, 69, 127, 0.35) !important;
  transform: translateY(-1px) !important;
}

/* === 6. ФИЛЬТРЫ / ВИДЖЕТ (SIDEBAR CARD) === */

.tt-filters-wrapper {
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
  padding: 20px 18px 22px;
}

.tt-filter-block {
  padding: 12px 0 16px;
  border-bottom: 1px solid #edf0f7;
}

.tt-filter-block:last-child {
  border-bottom: none;
}

.tt-filter-title {
  font-weight: 800;
  font-size: 18px;
  color: var(--tt-text-main);
  margin: 0 0 12px 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding-bottom: 4px;
}

.tt-filter-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 40px;
  height: 2px;
  border-radius: 999px;
  background: var(--tt-primary);
}

.tt-filter-list {
  margin: 0;
  padding: 4px 0 0;
}

.tt-filter-list li {
  margin: 2px 0;
}

.tt-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.tt-checkbox-label:hover {
  background: #f4f6fb;
}

.tt-checkbox-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
}

.tt-cat-checkbox,
.tt-flag-checkbox {
  display: none !important;
}

.tt-custom-check {
  width: 18px !important;
  height: 18px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px !important;
  margin-right: 4px !important;
  display: inline-block !important;
  position: relative !important;
  background: #fff !important;
  flex-shrink: 0 !important;
}

.tt-cat-checkbox:checked + .tt-custom-check,
.tt-flag-checkbox:checked + .tt-custom-check {
  background: var(--tt-primary) !important;
  border-color: var(--tt-primary) !important;
}

.tt-cat-checkbox:checked + .tt-custom-check::after,
.tt-flag-checkbox:checked + .tt-custom-check::after {
  content: "" !important;
  position: absolute !important;
  left: 5px !important;
  top: 2px !important;
  width: 5px !important;
  height: 10px !important;
  border: solid white !important;
  border-width: 0 2px 2px 0 !important;
  transform: rotate(45deg) !important;
}

.tt-cat-name {
  flex: 1 1 auto;
  font-size: 14px;
  color: var(--tt-text-main);
}

.tt-cat-count {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--tt-primary);
  background: #e0e7ff;
  padding: 2px 8px;
  border-radius: 999px;
}

.tt-filter-block.flags-filter .tt-filter-list {
  margin-top: 4px;
}
.tt-filter-block.flags-filter .tt-cat-name {
  font-weight: 500;
}

.tt-filter-block.scenario-filter {
  padding-top: 10px;
}

.tt-scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.tt-scenario-chip {
  border: 1px solid #d1d5db;
  background: #ffffff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;
  color: var(--tt-text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease,
    box-shadow 0.18s ease;
  font-family: inherit;
}

.tt-scenario-chip:hover {
  border-color: var(--tt-primary);
  background: #eff6ff;
  color: var(--tt-primary);
}

.tt-scenario-chip.is-active {
  border-color: var(--tt-primary);
  background: var(--tt-primary);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(30, 86, 160, 0.4);
}

/* === 6.3. ЦЕНОВОЙ СЛАЙДЕР === */
.tt-slider-container {
  margin: 16px 4px 10px;
}

html body .tt-filters-wrapper .ui-slider-horizontal {
  height: 4px !important;
  background: #e5e7eb !important;
  border-radius: 999px !important;
  border: none !important;
}

html body .tt-filters-wrapper .ui-slider .ui-slider-range {
  background: var(--tt-primary) !important;
}

html body .tt-filters-wrapper .ui-slider .ui-slider-handle {
  width: 16px !important;
  height: 16px !important;
  background: #ffffff !important;
  border: 2px solid var(--tt-primary) !important;
  border-radius: 50% !important;
  top: -6px !important;
  outline: none !important;
  cursor: pointer !important;
}

.tt-price-inputs {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.tt-price-inputs .input-group {
  flex: 1 1 0;
}
.tt-price-inputs input {
  width: 100%;
  text-align: center;
  border: 1px solid #d1d5db;
  padding: 7px 8px;
  border-radius: 10px;
  font-size: 14px;
  background: #f9fafb;
  color: var(--tt-text-main);
}
.tt-price-inputs .separator {
  align-self: center;
  font-size: 14px;
  color: var(--tt-text-muted);
}

.tt-btn-apply {
  width: 100%;
  background: var(--tt-primary);
  color: #ffffff;
  border: none;
  padding: 11px 0;
  cursor: pointer;
  margin-top: 18px;
  font-weight: 700;
  font-size: 15px;
  border-radius: 999px;
  text-align: center;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.1s ease;
}

.tt-btn-apply:hover {
  background: #18457f;
  box-shadow: 0 14px 28px rgba(24, 69, 127, 0.45);
  transform: translateY(-1px);
}

/* === 7. ПАГИНАЦИЯ === */
html body .tt-shop-pagination {
  width: 100% !important;
  margin-top: 40px !important;
  display: block !important;
  text-align: center !important;
}

html body .tt-shop-pagination .woocommerce-pagination ul.page-numbers {
  display: inline-flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  gap: 8px !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 auto !important;
  list-style: none !important;
  width: auto !important;
}

html body .tt-shop-pagination .woocommerce-pagination ul.page-numbers::before,
html body .tt-shop-pagination .woocommerce-pagination ul.page-numbers::after {
  display: none !important;
  content: none !important;
}

html body .tt-shop-pagination .woocommerce-pagination ul.page-numbers li {
  display: block !important;
  float: none !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
}

html body .tt-shop-pagination .woocommerce-pagination ul.page-numbers li a,
html body .tt-shop-pagination .woocommerce-pagination ul.page-numbers li span {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  line-height: 1 !important;
  padding: 0 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 10px !important;
  background: #ffffff !important;
  color: #111827 !important;
  font-weight: 600 !important;
  font-size: 14px !important;
}

html
  body
  .tt-shop-pagination
  .woocommerce-pagination
  ul.page-numbers
  li
  span.current {
  background: var(--tt-primary) !important;
  color: #ffffff !important;
  border-color: var(--tt-primary) !important;
}

/* === 9. ЭЛЕМЕНТЫ ПРОДУКТА === */
html body .blockUI.blockOverlay {
  display: none !important;
}

html body .tt-shop-main .product-thumb {
  position: relative !important;
  width: 100% !important;
  margin-bottom: 5px !important;
}

html body .tt-shop-main .tt-wishlist-loop-wrap {
  position: absolute !important;
  top: 0 !important;
  right: 0 !important;
  z-index: 10 !important;
}

html body .tt-shop-main .product-label {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 10 !important;
}

html body .tt-shop-main .product-info {
  margin-top: auto !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 5px !important;
  width: 100% !important;
  align-items: center !important;
  text-align: center !important;
}

html body .tt-shop-main .product-title {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 14px !important;
  line-height: 1.3 !important;
  min-height: 36px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Ограничиваем 2 строками */
  -webkit-box-orient: vertical;
}

html body .tt-shop-main .price {
  margin: 0 !important;
  padding: 0 !important;
  color: #111827 !important;
  font-weight: 700 !important;
}

/* Убираем лишние иконки */
html body .tt-shop-main .add_to_cart_button.added::after,
html body .tt-shop-main .add_to_cart_button.added i.la-check,
html body .tt-shop-main .add_to_cart_button.tt-added-success i.la-check {
  display: none !important;
  content: none !important;
}

/* ========================================= */
/* === 8. АДАПТИВ (RESPONSIVE) - ГЛАВНОЕ === */
/* ========================================= */

@media (max-width: 1200px) {
  html body .tt-shop-layout {
    gap: 20px !important;
  }
  /* Планшет - 3 колонки */
  html body .tt-shop-main ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  html body .tt-shop-layout {
    flex-direction: column !important;
  }
  html body .tt-shop-sidebar,
  html body .tt-shop-main {
    width: 100% !important;
  }
  .tt-filters-wrapper {
    border-radius: 14px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.05);
  }
}

/* Мобильные устройства (включая планшеты в портрете) */
@media (max-width: 768px) {
  /* Форсируем 2 колонки */
  html body .tt-shop-main ul.products,
  html body .tt-shop-main.view-grid-3 ul.products,
  html body .tt-shop-main.view-grid-4 ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  /* Тулбар */
  html body .tt-shop-main .tt-shop-toolbar {
    flex-direction: column;
    align-items: stretch !important;
    padding: 12px !important;
  }
  html body .tt-shop-main .tt-toolbar-left {
    width: 100%;
    justify-content: space-between;
  }
  html body .tt-shop-main .woocommerce-ordering select {
    width: 100% !important;
    min-width: 0 !important;
  }
  html body .tt-view-switcher {
    display: none !important; /* На мобильном не нужен переключатель, всегда 2 кол. */
  }

  /* Карточка товара - адаптация */
  html body .tt-shop-main .item-product {
    padding: 8px !important;
    border-radius: 8px !important;
  }

  /* Заголовок поменьше */
  html body .tt-shop-main .product-title {
    font-size: 13px !important;
    min-height: 34px;
  }

  /* Кнопка "В корзину" - компактная */
  html body .tt-shop-main .add_to_cart_button {
    padding: 8px 10px !important;
    font-size: 12px !important;
    margin-top: 6px !important;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
  }

  html body .tt-shop-main .add_to_cart_button.tt-added-success::before {
    left: 8px; /* Чуть ближе иконка */
  }
}

/* Старые и очень узкие телефоны (iPhone SE 1st gen и т.д.) */
@media (max-width: 370px) {
  html body .tt-shop-main ul.products {
    gap: 8px !important; /* Уменьшаем отступ между колонками */
  }
  html body .tt-shop-main .item-product {
    padding: 5px !important; /* Меньше воздуха внутри карточки */
  }
  html body .tt-shop-main .product-title {
    font-size: 12px !important; /* Еще меньше текст */
    line-height: 1.2 !important;
  }
  html body .tt-shop-main .add_to_cart_button {
    font-size: 11px !important;
    padding: 6px 4px !important;
  }
}
