/* ====================================================
   INDEX.CSS - стили для главной страницы и каталога
   ==================================================== */

:root {
  --primary: #6c5ce7;
  --primary-hover: #5649c0;
  --accent: hsl(0, 0%, 0%);
  --text: #2d3436;
  --text-light: #636e72;
  --bg: #f5f6fa;
  --card-bg: #ffffff;
  --border: #dfe6e9;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #ef4444;
  --ink: #111827;
  --muted: #4b5563;
  --line: #e5e7eb;
  --panel: #fff;
}

/* Базовые стили */
body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Шапка */
.header {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 14px 0;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Логотип */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 22px;
  text-decoration: none;
  color: var(--primary);
}

.logo__icon { color: var(--primary); }
.logo__text { color: var(--primary); }
.logo__text span { color: #111827; }

/* Навигация */
.nav {
  flex: 1;
  display: flex;
  justify-content: center;
}

.nav__list {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__link {
  color: #4b5563;
  font-weight: 700;
  position: relative;
  padding: .5rem 0;
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav__link:hover,
.nav__link.active {
  color: var(--primary);
}

.nav__link.active::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 100%;
  height: 3px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
}

/* Кнопки справа */
.header__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fav-btn, .cart-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.fav-btn {
  background: #fff;
  color: var(--danger);
  box-shadow: var(--shadow);
}

.cart-btn {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(108, 92, 231, .3);
}

.cart-btn:hover {
  transform: translateY(-2px);
  background: var(--primary-hover);
}

.fav-count, .cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

/* Герой-баннер */
.hero {
  position: relative;
  height: 500px;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.hero__content {
  position: relative;
  z-index: 2;
  text-align: center;
  color: white;
  padding: 2rem;
  max-width: 800px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.hero__title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.hero__subtitle {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn--primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(108, 92, 231, 0.4);
}

.btn--primary:active {
  transform: translateY(0);
}

.btn--load-more {
  margin: 3rem auto 0;
  padding: 1rem 2.5rem;
  background: var(--primary);
  color: white;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn--load-more:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
}

/* Заголовки секций */
.section {
  margin: 4rem 0;
}

.section__title {
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1rem;
  color: var(--ink);
}

.section__subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 1.1rem;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Карточки товаров - НОВАЯ СЕТКА */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.06);
  transition: transform .2s ease, box-shadow .2s ease;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
}

/* КРИТИЧЕСКИЙ ФИКС: Изображение с aspect-ratio */
.product-media {
  width: 100%;
  aspect-ratio: 1 / 1; /* 🔥 КВАДРАТНАЯ ОБЛАСТЬ */
  background: #f6f7fb;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 1px solid var(--line);
  padding: 12px; /* Уменьшен паддинг */
  box-sizing: border-box;
}

.product-media img {
  max-width: 100%;  /* Не больше контейнера */
  max-height: 100%; /* Не больше контейнера */
  width: auto;
  height: auto;
  object-fit: contain; /* 🔥 НЕ РЕЖЕМ ФОТО */
  display: block;
  transition: transform 0.3s ease;
}

.product-card:hover .product-media img {
  transform: scale(1.05);
}

/* Бейджи */
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  font-weight: 800;
  font-size: 13px;
  border-radius: 999px;
  color: #fff;
  z-index: 2;
}

.badge.badge-discount {
  background: var(--danger);
}

/* Тело карточки */
.product-body {
  padding: 14px 14px 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.product-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  margin: 0 0 8px;
  text-decoration: none;
  line-height: 1.35;
  height: 2.7em;
  min-height: 2.7em;
}

/* Мета-информация */
.product-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: .9rem;
  margin-bottom: 6px;
}

.meta-stars {
  color: #f59e0b;
  letter-spacing: 2px;
  font-size: .95rem;
}

/* Цены */
.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.price-old {
  color: #9ca3af;
  text-decoration: line-through;
  font-size: .9rem;
}

.price-current {
  color: var(--ink);
  font-weight: 900;
  font-size: 1.1rem;
}

.price-row.has-discount .price-current {
  color: var(--danger) !important;
}

/* Кнопки действия */
.card-cta {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.card-cta .to-cart {
  flex: 1;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  border: 0;
  height: 44px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(108,92,231,.25);
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
  font-family: 'Manrope', sans-serif;
  font-size: 1rem;
}

.card-cta .to-cart:hover {
  transform: translateY(-1px);
  background: var(--primary-hover);
  box-shadow: 0 12px 22px rgba(108,92,231,.3);
}

.card-cta .fav-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.card-cta .fav-icon:hover {
  background: #f8fafc;
  border-color: #e5e7eb;
}

.card-cta .fav-icon.favorited svg {
  fill: red;
}

/* Ссылки в карточке */
.product-card a {
  text-decoration: none;
  color: inherit;
}

.card-link {
  position: absolute;
  inset: 0;
  text-indent: -9999px;
  z-index: 1;
}

/* Микро-анимации */
@keyframes bump {
  0% { transform: scale(1); }
  10% { transform: scale(1.06); }
  30% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@keyframes heart-pop {
  0% { transform: scale(0.6); opacity: .2; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.to-cart.success {
  background: #10b981 !important;
  box-shadow: 0 2px 12px rgba(16,185,129,.35);
}

.to-cart.success::after {
  content: "✓";
  font-weight: 900;
  margin-left: .35rem;
}

.to-cart.success,
.to-cart.bump {
  animation: bump .35s ease;
}

.fav-icon.pop svg {
  animation: heart-pop .28s ease;
}

/* SEO-блок */
.seo-block {
  max-width: 1550px;
  margin: 40px auto;
  padding: 30px 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  font-family: 'Manrope', Arial, sans-serif;
  color: #333;
  line-height: 1.6;
}

.seo-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #1a1a1a;
  text-align: center;
}

.seo-subtitle {
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 30px;
  margin-bottom: 12px;
  color: #2a7ae2;
}

.seo-text {
  font-size: 1rem;
  margin-bottom: 20px;
}

.seo-list {
  margin-left: 20px;
  list-style-type: disc;
  margin-bottom: 20px;
}

.seo-list li {
  margin-bottom: 8px;
  font-size: 1rem;
}

/* Подвал */
.footer {
  background: #fff;
  border-top: 1px solid var(--line);
  margin-top: auto;
  padding: 32px 0 16px;
  color: var(--muted);
}

.footer .container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 32px;
  align-items: flex-start;
}

.footer__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.footer__logo .logo__icon {
  color: var(--primary);
}

.footer__logo .logo__text {
  color: var(--primary);
}

.footer__logo .logo__text span {
  color: var(--text);
}

.footer__about {
  margin: 10px 0 14px;
  color: var(--muted);
}

.footer__social {
  display: flex;
  gap: 10px;
}

.footer__social a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f3f4f6;
  color: #111827;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease;
}

.footer__social a:hover {
  transform: translateY(-2px);
  background: #e5e7eb;
}

.footer__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 800;
  color: #111827;
}

.footer__contacts p {
  margin: .25rem 0;
  display: flex;
  gap: .5rem;
  align-items: center;
}

.footer__contacts a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed #d1d5db;
  transition: border-color .2s ease, color .2s ease;
}

.footer__contacts a:hover {
  border-bottom-color: transparent;
  color: var(--primary);
}

.footer__bottom {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  color: #6b7280;
  font-size: .95rem;
}

.legal-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.legal-links a {
  color: #6b7280;
  text-decoration: none;
  transition: color .2s ease;
}

.legal-links a:hover {
  color: #111827;
}

/* Декоративные элементы */
.decorative-elements {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(108, 92, 231, 0.05);
  filter: blur(40px);
}

.circle-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation: float 15s infinite ease-in-out;
}

.circle-2 {
  width: 200px;
  height: 200px;
  bottom: -50px;
  right: -50px;
  animation: float 12s infinite ease-in-out reverse;
}

.circle-3 {
  width: 150px;
  height: 150px;
  top: 30%;
  right: 10%;
  animation: float 10s infinite ease-in-out;
}

/* Анимации */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(20px, 20px);
  }
}

/* КАСТОМНЫЙ СКРОЛЛ ДЛЯ НАВИГАЦИИ НА МОБИЛЬНЫХ */
.nav__list::-webkit-scrollbar {
  height: 3px;
}

.nav__list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.nav__list::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* Утилиты */
.alert {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  z-index: 9999;
  animation: slideInRight 0.3s ease;
  max-width: 400px;
}

.alert.success {
  background: var(--success);
}

.alert.error {
  background: var(--danger);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* АДАПТИВНОСТЬ */

/* Планшеты */
@media (max-width: 1024px) {
  .container {
    padding: 0 1.5rem;
  }
  
  .hero__title {
    font-size: 2.5rem;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
  }
}

/* Мобильные устройства (768px и меньше) */
@media (max-width: 768px) {
  .header__inner {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
  }
  
  /* Логотип слева */
  .logo {
    order: 1;
    font-size: 18px;
  }
  
  /* Навигация по центру - ГОРИЗОНТАЛЬНАЯ */
  .nav {
    order: 3;
    width: 100%;
    margin-top: 10px;
    flex: 0 0 100%;
  }
  
  .nav__list {
    gap: 12px;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  
  .nav__item {
    flex-shrink: 0;
  }
  
  .nav__link {
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    background: #f8f9fa;
  }
  
  .nav__link.active {
    background: var(--primary);
    color: white;
  }
  
  .nav__link.active::after {
    display: none;
  }
  
  /* Кнопки справа */
  .header__actions {
    order: 2;
    gap: 8px;
  }
  
  .fav-btn, .cart-btn {
    width: 40px;
    height: 40px;
  }
  
  /* Герой */
  .hero {
    height: 400px;
  }
  
  .hero__title {
    font-size: 2rem;
  }
  
  .hero__subtitle {
    font-size: 1rem;
  }
  
  /* Секции */
  .section__title {
    font-size: 2rem;
  }
  
  /* Карточки товаров для мобильных */
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
  
  .product-media {
    padding: 10px;
  }
  
  .product-title {
    font-size: 0.9rem;
    height: 2.4em;
  }
  
  .price-current {
    font-size: 1rem;
  }
  
  .price-old {
    font-size: 0.8rem;
  }
  
  .card-cta .to-cart {
    height: 38px;
    font-size: 0.85rem;
  }
  
  .card-cta .fav-icon {
    width: 38px;
    height: 38px;
  }
  
  /* Подвал */
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* Маленькие мобильные (600px и меньше) */
@media (max-width: 600px) {
  .products-grid {
    gap: 10px;
  }
  
  .product-body {
    padding: 12px 10px;
  }
  
  .product-title {
    font-size: 0.85rem;
    height: 2.3em;
  }
  
  .price-current {
    font-size: 0.95rem;
  }
  
  .card-cta .to-cart {
    height: 36px;
    font-size: 0.8rem;
  }
  
  .card-cta .fav-icon {
    width: 36px;
    height: 36px;
  }
  
  .hero {
    height: 300px;
  }
  
  .hero__title {
    font-size: 1.8rem;
  }
  
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }
  
  .seo-block {
    padding: 20px 15px;
  }
  
  .seo-title {
    font-size: 1.5rem;
  }
  
  .seo-subtitle {
    font-size: 1.2rem;
  }
  
  /* Навигация */
  .nav__list {
    gap: 8px;
  }
  
  .nav__link {
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
  }
}

/* Очень маленькие экраны (480px и меньше) */
@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }
  
  .products-grid {
    gap: 8px;
  }
  
  .product-media {
    padding: 8px;
  }
  
  .product-body {
    padding: 10px 8px;
  }
  
  .product-title {
    font-size: 0.75rem;
    height: 2.2em;
  }
  
  .price-current {
    font-size: 0.9rem;
  }
  
  .card-cta {
    gap: 6px;
  }
  
  .card-cta .to-cart {
    height: 34px;
    font-size: 0.75rem;
  }
  
  .card-cta .fav-icon {
    width: 34px;
    height: 34px;
  }
  
  /* Навигация */
  .logo {
    font-size: 16px;
  }
  
  .nav__link {
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
  }
  
  .legal-links {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
  }
}

/* Супер маленькие экраны (360px и меньше) */
@media (max-width: 360px) {
  .products-grid {
    gap: 6px;
  }
  
  .product-media {
    padding: 6px;
  }
  
  .nav__list {
    gap: 6px;
  }
  
  .nav__link {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
  }
  
  .logo {
    font-size: 15px;
  }
  
  .product-title {
    font-size: 0.7rem;
  }
  
  .price-current {
    font-size: 0.85rem;
  }
  
  .card-cta .to-cart {
    height: 32px;
    font-size: 0.7rem;
  }
  
  .card-cta .fav-icon {
    width: 32px;
    height: 32px;
  }
}

/* Специальные классы для вертикальных/горизонтальных фото (если нужно) */
.product-media.tall-image img {
  max-height: 90%;
  max-width: 80%;
}

.product-media.wide-image img {
  max-width: 90%;
  max-height: 80%;
}
/* =========================
   FIX CARD BUTTON CLICKS
   ========================= */

/* Кнопки всегда выше ссылки */
.card-cta,
.card-cta * {
  position: relative;
  z-index: 5;
}

/* Заголовок тоже кликабельный */
.product-title {
  position: relative;
  z-index: 5;
}

/* Ссылка-карточка ниже кнопок */
.card-link {
  z-index: 1;
}

/* ИСКЛЮЧЕНИЕ: не ловим клики на кнопках */
.card-cta button {
  pointer-events: auto;
}
