/* ═══════════════════════════════════════
   PRODUCTS GRID
   ═══════════════════════════════════════ */

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: var(--space-md);
  margin: var(--space-md) 0 var(--space-lg);
  contain: layout style;
}

.product-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  padding: var(--space-lg) var(--space-md);
  border: 1px solid var(--border);
  text-align: center;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(40px);
  transition: 
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    border-color var(--transition-base), 
    box-shadow var(--transition-base), 
    background var(--transition-base);
  contain: layout style paint;
  will-change: transform, opacity;
  display: flex;
  flex-direction: column;
}

.product-card.tilting {
  transition: 
    opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    border-color var(--transition-base), 
    box-shadow var(--transition-base), 
    background var(--transition-base);
}

.product-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.product-card.visible:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(74, 158, 255, 0.08);
  background: rgba(14, 30, 60, 0.7);
}

/* ═══ PRODUCT IMAGE ═══ */

.product-image-wrapper {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-md);
  background: rgba(8, 18, 40, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;  /* ← contain вместо cover, чтобы не обрезать */
  transition: transform 0.3s ease;
}

.product-card.visible:hover .product-image {
  transform: scale(1.03);
}

/* Fallback icon */
.product-icon {
  font-size: 3.5rem;
  color: var(--accent-light);
  display: inline-block;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 4px 8px rgba(42, 122, 224, 0.3));
}

.product-card.visible:hover .product-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 6px 12px rgba(42, 122, 224, 0.4));
}

/* ═══ CARD CONTENT ═══ */

.product-card h3 {
  font-size: var(--font-lg);
  font-weight: 700;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.product-desc {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin: var(--space-xs) 0 var(--space-sm);
  line-height: 1.5;
  flex: 1;  /* ← растягиваем описание, чтобы кнопка была внизу */
}

.price {
  font-weight: 900;
  font-size: var(--font-xl);
  color: var(--accent-light);
  margin: var(--space-sm) 0;
  text-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
}

.product-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: var(--font-xs);
  justify-content: center;
  margin-top: auto;  /* ← кнопка прижата к низу */
}

/* Shine effect */
.product-card .shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transition: left 0.8s ease;
  pointer-events: none;
}

.product-card.visible:hover .shine {
  left: 150%;
}

/* Spotlight effect */
.product-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(74, 158, 255, 0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.product-card.visible:hover::before {
  opacity: 1;
}

/* ═══ SEARCH HIGHLIGHT ═══ */
.search-highlight {
  background: rgba(74, 158, 255, 0.25);
  border-radius: 2px;
  padding: 0 2px;
}

.flavor-tags {
  margin: 8px 0;
}

.flavor-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px;
  border-radius: 4px;
  background: rgba(74, 158, 255, 0.15);
  color: var(--accent-light);
  font-size: 0.75rem;
}


/* ═══════════════════════════════════════
   AGE VERIFICATION MODAL — ПОЛНОСТЬЮ ПЕРЕРАБОТАН
   ═══════════════════════════════════════ */

.age-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: rgba(2, 6, 14, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.age-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
  visibility: visible;
}

.age-modal {
  background: linear-gradient(145deg, rgba(10, 24, 52, 0.98), rgba(6, 14, 32, 0.98));
  border: 1.5px solid var(--border-hover);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  max-width: 460px;
  width: 90%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 0 40px rgba(74, 158, 255, 0.15);
  transform: scale(0.9) translateY(30px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.age-modal-overlay.active .age-modal {
  transform: scale(1) translateY(0);
}

.age-modal .age-icon {
  font-size: 4rem;
  color: var(--accent-light);
  margin-bottom: var(--space-md);
  display: block;
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.age-modal h2 {
  font-size: var(--font-xl);
  font-weight: 800;
  margin-bottom: var(--space-sm);
  background: linear-gradient(130deg, #c8e4ff, #64b4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.age-modal p {
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  font-size: var(--font-sm);
  line-height: 1.6;
}

.age-modal .age-warning {
  color: var(--danger);
  font-weight: 600;
  font-size: var(--font-xs);
  margin-bottom: var(--space-lg);
  padding: 8px 12px;
  background: rgba(255, 107, 107, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.age-buttons {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: center;
}

.age-buttons .btn-primary {
  flex: 1;
  min-width: 140px;
  justify-content: center;
  padding: 14px 28px;
}

.age-buttons .btn-outline-glow {
  flex: 1;
  min-width: 140px;
  justify-content: center;
  padding: 14px 28px;
  font-weight: 700;
}

/* ═══════════════════════════════════════
   MOBILE OPTIMIZATIONS
   ═══════════════════════════════════════ */

@media (hover: none) and (pointer: coarse) {
  .product-card {
    transform-style: flat;
    will-change: auto;
  }

  .product-card.visible:hover {
    transform: translateY(-4px);
  }

  .product-card.visible:hover .product-icon {
    transform: scale(1.05);
  }

  .product-card::before {
    display: none;
  }

  .product-card .shine {
    display: none;
  }
}

/* Мобильные — модаль на весь экран */
@media (max-width: 768px) {
  .age-modal-overlay {
    align-items: flex-start;
    padding-top: 20vh;
    padding-top: 20dvh;
  }

  .age-modal {
    width: 92%;
    max-width: 92%;
    padding: var(--space-lg);
    margin: 0 auto;
  }

  .age-modal .age-icon {
    font-size: 3rem;
  }

  .age-modal h2 {
    font-size: var(--font-lg);
  }

  .age-buttons {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .age-buttons .btn-primary,
  .age-buttons .btn-outline-glow {
    width: 100%;
    min-width: unset;
    padding: 14px 20px;
  }
}

/* ═══ MOBILE OPTIMIZATIONS ═══ */
@media (hover: none) and (pointer: coarse) {
  .product-card {
    transform-style: flat;
    will-change: auto;
  }

  .product-card.visible:hover {
    transform: translateY(-4px);
  }

  .product-card.visible:hover .product-image {
    transform: scale(1.02);
  }

  .product-card::before {
    display: none;
  }

  .product-card .shine {
    display: none;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }

  .product-card { 
    padding: var(--space-md);
  }

  .product-image-wrapper {
    aspect-ratio: 16 / 10;
  }
}