/* --- Общие --- */
body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f9f9f9;
  color: #222;
}

header {
  background: #0088cc;
  color: white;
  text-align: center;
  padding: 12px;
  font-weight: 600;
  font-size: 1.2rem;
}

/* --- Сетка карточек --- */
main {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 10px;
  margin-bottom: 70px;
}

.card {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  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(0,0,0,0.12);
}

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

.card h3 {
  margin: 6px 0 2px;
  font-size: 0.95rem;
  line-height: 1.2;
}

.card p {
  color: #666;
  font-size: 0.85rem;
}

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

.tag {
  background: #ff4444;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.tag.new {
  background: #00b894;
}

.tag.discount {
  background: #ff6b6b;
}

/* ====== Цены ====== */
.old-price {
  color: #888;
  text-decoration: line-through;
  margin-right: 4px;
  font-size: 0.9rem;
}

.new-price {
  color: #e60023;
  font-weight: 600;
  font-size: 1rem;
}

/* --- Нижнее меню --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #ddd;
  z-index: 999;
}

.bottom-nav button {
  background: none;
  border: none;
  cursor: pointer;
}

.bottom-nav img {
  width: 26px;
  height: 26px;
}

/* ======== МОДАЛКА ======== */
.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: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  padding: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  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: white;
  text-shadow: 0 0 5px rgba(0,0,0,0.8);
  cursor: pointer;
  z-index: 1001;
}

/* ======== ГАЛЕРЕЯ ======== */
.image-gallery {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 240px;
  border-radius: 12px;
  margin-bottom: 12px;
  background: #fdfdfd;
}

.gallery-track {
  display: flex;
  transition: transform 0.3s ease;
  height: 100%;
}

.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;
}

.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(0,0,0,0.3);
  border: none;
  color: white;
  font-size: 24px;
  padding: 6px 10px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1000;
}

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

.gallery-btn:hover {
  background: rgba(0,0,0,0.6);
}

/* ======== КОЛИЧЕСТВО ======== */
.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 {
  background: #007bff;
  color: white;
  width: 100%;
  border: none;
  padding: 10px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.add-btn:hover {
  background: #0056d2;
}

/* ======== КОРЗИНА ======== */
.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;
}

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

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