/* === Общие стили блоков главной === */
.navi-home-section {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 16px;
}
.navi-home-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.navi-home-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--navi-text-strong, #1F2A2E);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navi-home-title h2 i {
  color: var(--navi-teal, #30A495);
  font-size: 18px;
}
.navi-home-title a {
  font-size: 13px;
  font-weight: 600;
  color: var(--navi-teal, #30A495);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap .15s ease;
}
.navi-home-title a:hover { gap: 10px; }

/* === Карточка товара (компактная для главной) === */
.navi-product-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.navi-mini-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--navi-border, #E3E8EB);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.navi-mini-card:hover {
  border-color: var(--navi-teal, #30A495);
  box-shadow: 0 4px 14px rgba(48,164,149,.12);
  transform: translateY(-2px);
}
.navi-mini-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.navi-mini-card-img img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 8px;
}
.navi-mini-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: .03em;
}
.navi-mini-card-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
/* Ссылка-обёртка для изображения (кликабельное фото) */
.navi-mini-card-img-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}
/* Имя товара как ссылка */
.navi-mini-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--navi-text-strong, #1F2A2E);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
}
.navi-mini-card-name:hover {
  color: var(--navi-teal, #30A495);
}
.navi-mini-card-brand {
  font-size: 13px;
  color: var(--navi-muted, #5F6F75);
  font-weight: 500;
}
.navi-mini-card-tooltip {
  font-size: 13px;
  font-weight: 500;
  color: var(--navi-text-strong, #1F2A2E);
  line-height: 1.35;
}
.navi-mini-card-stock {
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.navi-mini-card-stock.success { color: #1FA971; }
.navi-mini-card-stock.danger { color: #DC3545; }
.navi-mini-card-stock.warning { color: #b8860b; }  /* жёлтый текст для "В наличии < 5 шт" (как в hardware-details.tpl) */
.navi-mini-card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0;                    /* прижаты вплотную */
  padding-top: 4px;
}
/* Наличие — сразу над ценой, без отступа */
.navi-mini-card-stock {
  margin-bottom: 2px;        /* минимальный отступ до цены */
}
/* Цена + количество + корзина — в одной строке */
.navi-mini-card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
}
.navi-mini-card-cart-area {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
/* Wishlist-кнопка — как в search.tpl (search-mini-wishlist-btn), адаптирована под navi-mini-card */
.navi-mini-wishlist-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid var(--navi-border, #E3E8EB);
  border-radius: 6px;
  background: #fff;
  color: var(--navi-muted, #5F6F75);
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s ease;
}
.navi-mini-wishlist-btn:hover {
  border-color: #D04848;
  color: #D04848;
  background: #FEF2F2;
}
.navi-mini-wishlist-btn:active { transform: scale(.95); }
.navi-mini-wishlist-btn.active {
  background: #D04848;
  border-color: #D04848;
  color: #fff;
}
.navi-mini-card-price {
  white-space: nowrap;
  font-size: 16px;
  font-weight: 700;
  color: var(--navi-text-strong, #1F2A2E);
}
.navi-mini-card-price small {
  font-size: 13px;
  font-weight: 400;
  color: var(--navi-muted, #5F6F75);
}
/* Кнопки количества (- 1 +) — как в каталоге */
.navi-mini-quantity {
  display: inline-flex;
  align-items: center;
  background: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  height: 36px;
}
.navi-mini-qty-btn {
  border: none;
  background: #dee2e6;
  color: var(--navi-text-strong, #1F2A2E);
  width: 32px;
  height: 36px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease;
}
.navi-mini-qty-btn:hover { background: #ced4da; }
.navi-mini-qty-btn:active { transform: scale(.95); }
.navi-mini-qty-input {
  width: 36px;
  height: 36px;
  border: none;
  background: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--navi-text-strong, #1F2A2E);
  -moz-appearance: textfield;
}
.navi-mini-qty-input::-webkit-outer-spin-button,
.navi-mini-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.navi-mini-cart-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: var(--navi-teal, #30A495);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .1s ease;
}
.navi-mini-cart-btn:hover { background: var(--navi-teal-hover, #2A9585); }
.navi-mini-cart-btn:active { transform: scale(.95); }
/* Бейдж количества на кнопке корзины (как в hardware-details.tpl — .cart-qty-badge) */
.navi-mini-cart-btn { position: relative; }
.navi-mini-cart-btn .cart-qty-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
  line-height: 1;
  z-index: 2;
}
/* Когда товар в корзине — кнопка темнеет (как .in-cart в hardware-details.tpl) */
.navi-mini-cart-btn.in-cart {
  background: #15867a !important;
}
.navi-mini-card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--navi-text-strong, #1F2A2E);
  white-space: nowrap;
}
.navi-mini-card-price small {
  font-size: 13px;
  font-weight: 400;
  color: var(--navi-muted, #5F6F75);
}


/* === Новости на главной (1:1 копия из news.tpl) === */
/* Убираем лишние рамки внутри карточек новостей */
.news-card * {
  border: none !important;
}
/* Оставляем рамку только у самого блока */
.news-card {
  border: 1px solid rgba(0,0,0,0.05) !important;
  border-radius: 16px !important;  /* закруглённые углы (как в news.tpl через rounded-4) */
  height: 100%;  /* карточки в 2 колонки одной высоты */
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.25s, box-shadow 0.25s;
}
.news-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.news-card time {
  font-size: 0.9rem;
  letter-spacing: 0.2px;
  color: #6c757d;
}

/* Обёртка для кнопки — прижимаем вправо */
.news-more-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
/* Стили кнопки "Подробнее" — как в старом шаблоне index */
.news-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 22px;
  background: #111827;
  border-radius: 12px;
  color: #ffffff !important;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: .2s;
}
.news-more:hover {
  background: #18b79d;
  transform: translateY(-2px);
}

/* === Бренды на главной === */
.navi-brands-strip {
  display: flex;
  gap: 16px;
  overflow: hidden;
  padding: 8px 0 16px;
  position: relative;
  mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 40px, #000 calc(100% - 40px), transparent 100%);
}
.navi-brands-track {
  display: flex;
  gap: 16px;
  animation: navi-brands-scroll 40s linear infinite;
  flex-shrink: 0;
}
.navi-brands-strip:hover .navi-brands-track {
  animation-play-state: paused;
}
@keyframes navi-brands-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.navi-brand-logo {
  flex-shrink: 0;
  width: 180px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--navi-border, #E3E8EB);
  border-radius: 10px;
  padding: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.navi-brand-logo:hover {
  border-color: var(--navi-teal, #30A495);
  box-shadow: 0 2px 8px rgba(48,164,149,.1);
}
.navi-brand-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* === Адаптив === */

/* ПК-версия (≥1281px): фото товаров в Новинках/Распродаже компактнее (-15%) */
@media (min-width: 1281px) {
  .navi-mini-card-img img {
    max-width: 85%;   /* было 100% → компактнее на 15% (не 75% — иначе слишком много воздуха) */
    max-height: 85%;
    padding: 6px;      /* было 16px → 6px, меньше воздуха вокруг */
  }
}

@media (max-width: 1280px) {
  .navi-product-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 991px) {
  /* На планшете 2 колонки + максимум 4 товара (5-й и далее скрыты) */
  .navi-product-grid { grid-template-columns: repeat(2, 1fr); }
  .navi-product-grid .navi-mini-card:nth-child(n+5) { display: none !important; }
}
@media (max-width: 575px) {
  .navi-product-grid { grid-template-columns: repeat(2, 1fr); }
  /* Скрываем товары после 4-го на мобиле */
  .navi-product-grid .navi-mini-card:nth-child(n+5) { display: none !important; }
  .navi-home-section { padding: 16px 12px; }
}
/* === МОБИЛЬНАЯ ОПТИМИЗАЦИЯ (Яндекс: шрифты ≥14px для читаемости) === */
@media (max-width: 768px) {
  .navi-mini-cart-btn { width: 44px; height: 44px; }
  .navi-mini-wishlist-btn { width: 44px; height: 44px; }
  .navi-mini-qty-btn { width: 44px; height: 44px; }
  .navi-mini-qty-input { height: 44px; }
  .navi-mini-quantity { height: 44px; }
  .navi-home-title h2 { font-size: 22px; }
  .navi-home-title a { font-size: 14px; }
  .navi-mini-card-brand { font-size: 13px; }
  .navi-mini-card-name { font-size: 14px; min-height: 40px; }
  .navi-mini-card-tooltip { font-size: 13px; }
  .navi-mini-card-stock { font-size: 13px; }
  .navi-mini-card-price { font-size: 16px; }
  .navi-mini-card-price small { font-size: 13px; }
  .navi-brand-logo { font-size: 13px; }
  .navi-section-title { font-size: 20px; }
}
@media (max-width: 480px) {
  .navi-mini-card-name { font-size: 13px; min-height: 36px; }
  .navi-mini-card-brand { font-size: 13px; }
  .navi-mini-card-tooltip { font-size: 13px; }
  .navi-mini-card-price { font-size: 15px; }
  .navi-home-title h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
  .navi-brands-track { animation: none !important; }
}
