/* --- Общие --- */
html, body {
  height: 100%;
  margin: 0;
  padding: 5;
  overflow: auto;
}

body {
  display: flex;
  flex-direction: column;
  font-family: 'Outfit', sans-serif;
  background-image: url('assets/cover.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  /* фон заменяем на изображение */

}

/* --- Сетка карточек --- */
main {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px;
  padding-bottom: calc(50px + 10px);
  min-height: 0;
}

.card {
  position: relative;
  background: #fffaf5;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 2px 6px rgba(139, 94, 53, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 10px rgba(139, 94, 53, 0.25);
}

.card img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  aspect-ratio: 1/1;
}

.card h3 {
  font-family: 'system-ui', sans-serif;
  font-size: 1rem; /* чуть больше для лучшей читаемости */
  font-weight: 600;
  color: #3b2f2f; /* тёплый тёмно-коричневый */
  margin: 6px 0 4px;
  line-height: 1.3;
  text-transform: capitalize; /* аккуратные заглавные буквы */
  text-shadow: 0 1px 2px rgba(0,0,0,0.1); /* лёгкая тень для объёма */
}

.card p {
  font-family: 'system-ui', sans-serif;
  font-size: 0.85rem;
  color: #5a4b3b; /* мягкий коричневый, не отвлекает */
  margin: 2px 0 6px;
  line-height: 1.4;
}

/* ====== Теги на карточке ====== */
.card-tags {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}

/* ====== Теги на карточке в стиле магазина ====== */
.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Мягкий зеленый для "Новинка" */
.tag.new {
  background: linear-gradient(145deg, #66bb6a, #4caf50);
  box-shadow: 0 4px 10px rgba(76, 175, 80, 0.3);
}

/* Мягкий красный для "Скидка" */
.tag.discount {
  background: linear-gradient(145deg, #ef5350, #e53935);
  box-shadow: 0 4px 10px rgba(229, 57, 53, 0.3);
}

/* Небольшой эффект при наведении */
.tag:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 12px rgba(0,0,0,0.25);
}

/* ====== Цены ====== */
.old-price {
  font-family: 'system-ui', sans-serif;
  color: #888;
  text-decoration: line-through;
  margin-right: 6px;
  font-size: 0.9rem;
}

.new-price {
  font-family: 'system-ui', sans-serif;
  color: #e60023; /* яркий красный, как в магазине */
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1); /* объём */
}

/* --- Нижнее меню --- */
.bottom-nav {
  position: fixed;
  bottom: 10px; /* меньше отступ от низа */
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 360px;
  height: 50px; /* уменьшена высота */
  background: #a97447;
  border-radius: 25px; /* скругление под новую высоту */
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 6px 15px rgba(0,0,0,0.15);
  z-index: 999;
  padding: 0 6px;
}

.bottom-nav button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 6px;
  border-radius: 50%;
  transition: transform 0.2s ease, background 0.2s ease;
}
.bottom-nav button:hover {
  transform: translateY(-3px) scale(1.05);
  background: rgba(255,255,255,0.15);
}

.bottom-nav img {
  width: 22px;
  height: 22px;
  filter: brightness(0) invert(1); /* белые иконки */
  transition: filter 0.2s ease, transform 0.2s ease;
}
/* Активная кнопка (можно добавлять через JS) */
.bottom-nav button.active img {
  transform: scale(1.1);
  filter: brightness(1) saturate(1.5) invert(0.1);
}

/* Для мобильного касания */
.bottom-nav button:active {
  transform: translateY(-2px) scale(1.05);
}

/* Немного увеличиваем область для легкого нажатия */
.bottom-nav button::after {
  content: '';
  position: absolute;
  inset: -8px; /* расширяем кликабельную зону */
}
/* ======== МОДАЛКА ======== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.modal.show {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: #fffaf5;
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(100, 70, 40, 0.3);
  transform: translateY(30px);
  transition: transform 0.3s ease;
  position: relative;
}

.modal.show .modal-content {
  transform: translateY(0);
}

.close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 28px;
  font-weight: bold;
  color: #8b5e35; /* насыщенный коричневый */
  text-shadow: 0 0 5px rgba(0,0,0,0.8);
  cursor: pointer;
  z-index: 1001;
}
.close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 28px;
  font-weight: bold;
  color: #8b5e35; /* насыщенный коричневый */
  cursor: pointer;
  z-index: 1001;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: color 0.2s ease, transform 0.2s ease;
}

.close:hover {
  color: #a97447; /* чуть светлее при наведении */
  transform: scale(1.2);
}

/* ======== ГАЛЕРЕЯ ======== */
.image-gallery {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 240px;
  border-radius: 12px;
  margin-bottom: 12px;
  background: #fdfdfd;
  z-index: 0; /* создаем stacking context */
}

.gallery-track {
  display: flex;
  transition: transform 0.3s ease;
  height: 100%;
  position: relative; /* добавляем */
  z-index: 1;        /* картинки ниже кнопок */
}

.gallery-track img {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  user-select: none;
  -webkit-user-drag: none;
  position: relative; /* чтобы не перекрывать стрелки */
  z-index: 1;
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}

.gallery-dots span {
  width: 8px;
  height: 8px;
  background: #ccc;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.gallery-dots span.active {
  background: #333;
}

/* ======== КНОПКИ ГАЛЕРЕИ ======== */
.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(169, 116, 71, 0.8); /* кофейный полупрозрачный */
  border: none;
  color: #fffaf5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: all; /* стрелки ловят клики */
}

.gallery-btn.left { left: 8px; }
.gallery-btn.right { right: 8px; }

.gallery-btn:hover {
  background: #8b5e35;
  transform: translateY(-50%) scale(1.1);
}

/* ======== КОЛИЧЕСТВО ======== */
.quantity-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 12px 0;
}

.quantity-control button {
  background: #f0f0f0;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.quantity-control button:hover {
  background: #ddd;
}

.add-btn,
#checkoutBtn{
  background: #a97447;
  color: #fffaf5;
  width: 100%;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.1s ease;
}

.add-btn:hover,
#checkoutBtn:hover {
  background: #8b5e35;
  transform: translateY(-2px);
}

/* ======== КОРЗИНА ======== */
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
}

.cart-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cart-controls button {
  background: #eee;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

.cart-controls button:hover {
  background: #ddd;
}

.cart-controls span {
  min-width: 24px;
  text-align: center;
  font-weight: 500;
}

/* ======== ФИЛЬТРЫ ======== */
.filter-section {
  margin: 10px 0;
}

.filter-section h3 {
  font-size: 16px;
  margin-bottom: 5px;
}

#resetFilterBtn {
  background: #a97447;
  color: #fffaf5;
  width: 100%;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.3s ease, transform 0.1s ease;
}

#resetFilterBtn:hover {
  background: #8b5e35;
  transform: translateY(-2px);
}

#applyFilterBtn {
  background: #a97447;
  color: #fffaf5;
  width: 100%;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.3s ease, transform 0.1s ease;
}

#applyFilterBtn:hover {
  background: #8b5e35;
  transform: translateY(-2px);
}

.filter-buttons {
  display: flex;
  gap: 10px; /* расстояние между кнопками */
  margin-top: 10px;
}

.filter-buttons button {
  flex: 1; /* обе кнопки одинаковой ширины */
  background: #ccc;
  color: #222;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.filter-buttons button:hover {
  background: #999;
}

#userInfo p {
  margin: 6px 0;
}

#userPhoto {
  display: block;
  margin: 10px auto;
  border: 2px solid #ddd;
}
/* ======== МОДАЛКА ПОИСКА ======== */
#searchModal input {
  width: 100%;
  box-sizing: border-box; /* чтобы padding не вылезал */
  padding: 10px;
  margin: 12px 0;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid #d5b895;
  background: #fffaf5;
  color: #3b2f2f;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
  transition: border 0.2s ease, box-shadow 0.2s ease;
}
#searchModal input:focus {
  border-color: #a97447;
  box-shadow: 0 0 4px rgba(169,116,71,0.4);
}
#searchModal .search-buttons {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}
#searchModal .search-buttons button {
  flex: 1;
  background: #a97447;
  color: #fffaf5;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease, transform 0.1s ease;
}
#searchModal .search-buttons button:hover {
  background: #8b5e35;
  transform: translateY(-2px);
}
/* ======== Кнопки + / - ======== */
.quantity-control button,
.cart-controls button {
  background: #a97447;
  color: #fffaf5;
  border: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  padding: 0;

  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
  user-select: none;
}

.quantity-control button:hover,
.cart-controls button:hover {
  background: #8b5e35;
}

/* Для "прыжка" используем класс через JS */
.quantity-control button.jump,
.cart-controls button.jump {
  transform: translateY(-6px);
}

/* ======== Количество ======== */
.quantity-control span,
.cart-controls span,
#quantityValue {
  min-width: 24px;
  text-align: center;
  font-weight: 500;
  font-size: 18px;
  user-select: none;
}
/* Красная точка на кнопке корзины */
.cart-btn-wrapper {
  position: relative;
}
/* Красная точка с числом */
.cart-badge {
  display: none; /* изначально скрыт */
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  background: red;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1px solid #fff; /* небольшая белая граница */
  box-sizing: border-box;
  z-index: 10;
}
.hidden-id {
  display: none;
}

/* Подключаем минималистичный шрифт */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&display=swap');

header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
}

.store-link {
  text-decoration: none;
}

.header-logo-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Овальный фон для надписи */
.store-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: #fffaf5;              /* светлый текст для контраста */
  background-color: #a97447;   /* новый фон */
  padding: 10px 30px;          /* вертикальные и горизонтальные отступы */
  border-radius: 50px;         /* делает фон овальным */
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25); /* легкая тень для объёма */
}

.store-title:hover {
  color: #fff1d6;               /* чуть светлее при наведении */
  transform: scale(1.05);
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.3);  /* усиленная тень при наведении */
}

#feed:empty::before {
  content: "";
  flex: 1;
  display: block;
  height: 100%;
}

/* ======== Адаптивность ======== */
@media (min-width: 600px) {
  main { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  main { grid-template-columns: repeat(4, 1fr); }
}

#feed-wrapper {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* плавный скролл на iOS */
  position: relative;
  overscroll-behavior: contain; /* блокирует «сворачивание» body при скролле */
  padding: 0;
}
#scroll-anchor,
#scroll-anchor-bottom {
  height: 10px;   /* задаёт «невидимую высоту» */
  width: 100%;
}

#scroll-anchor {
  /* полностью прозрачный */
  background: transparent;
}

#scroll-anchor-bottom {
  background: transparent;
}

#modalDescription {
  white-space: pre-line;
}


/* Общий контейнер модалки */
.modal-content2 {
  background: #fffaf5;
  border-radius: 20px;
  width: 90%;
  max-width: 420px;
  padding: 0;
  box-shadow: 0 6px 18px rgba(139, 94, 53, 0.35);
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  overflow: hidden;
  border: 1px solid #e9d8c2;
  line-height: 1.5; /* или 1.6 / 1.7 / 2.0 */
  position: relative;
}

/* Анимация появления */
@keyframes modalFade {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Верхняя часть (галерея) */
.product-header {
  background: #fffaf5;
  padding: 12px;
  border-bottom: 1px solid #e9d8c2;
}


/* Центральная скролл-зона */
.product-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: #fff5ea; /* нежный кремовый */
  border-radius: 16px;
  margin: 14px;
  border: 1px solid #e4c9a8;

  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.05),
    inset 0 -2px 4px rgba(0,0,0,0.03);
}


/* Красивый стильный скроллбар */
.product-scroll::-webkit-scrollbar {
  width: 6px;
}

.product-scroll::-webkit-scrollbar-thumb {
  background: #6b4a2f; /* кофейный */
  border-radius: 10px;
}

.product-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.product-scroll h2,
.product-scroll p {
  margin: 0;          /* убирает внешние отступы */
  padding: 0;         /* на всякий случай */
}

/* Отступ после цены */
#modalPrice {
  margin-bottom: 10px;
}

/* Нижняя область */
.product-footer {
  background: #fffaf5;
  border-top: 1px solid #e9d8c2;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}


/* Кнопки +/- */
.product-footer button {
  background: #a97447;
  color: #fffaf5;
  border: none;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 20px;
  cursor: pointer;
  transition: 0.15s;
}

.product-footer button:active {
  background: #e0e0e0;
}
/* Кнопка "Добавить в корзину" */
.add-cart-btn {
  flex: 1;
  background: #a97447;
  color: #fffaf5;
  font-weight: 600;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  font-size: 16px;
  transition: 0.2s;
}

.add-cart-btn:active {
  background: #222;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 8px; /* расстояние между иконкой и текстом */
}

.modal-title .title-icon {
  width: 22px;
  height: 22px;
  filter: brightness(0); /* делает иконку чёрной */
}

/* Общая стандартизированная скролл-зона */
.modal-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
  margin: 12px 0;
  max-height: 60vh;
}

/* Красивый скролл */
.modal-scroll::-webkit-scrollbar {
  width: 6px;
}

.modal-scroll::-webkit-scrollbar-thumb {
  background: #6b4a2f;
  border-radius: 10px;
}

.modal-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* Чтобы контейнер модалки позволял центру растягиваться */
.modal-content {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
