/* ===================================
   РАСШИРЕННЫЕ СТИЛИ ДЛЯ ПРОДУКТОВ
   =================================== */

/* CSS Custom Properties для темизации */
:root {
  --brand-green: #10b981;
  --brand-green-dark: #059669;
  --brand-yellow: #fbbf24;
  --animation-duration: 0.2s;
  --border-radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ===================================
   БАЗОВЫЕ УТИЛИТЫ
   =================================== */

/* Screen reader only контент */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sr-only:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0.5rem 1rem !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  background: white !important;
  border: 2px solid var(--brand-green) !important;
  border-radius: var(--border-radius) !important;
  z-index: 9999 !important;
}

/* Скрытие полос прокрутки */
.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Line clamp утилиты */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===================================
   КОМПОНЕНТЫ ПРОДУКТОВ
   =================================== */

/* Контейнер продуктов */
.products-container {
  position: relative;
  min-height: 200px;
}

.products-container[aria-busy="true"] {
  pointer-events: none;
  opacity: 0.6;
}

/* Карточка продукта */
.product-card {
  position: relative;
  transform: translateY(0);
  transition: all var(--animation-duration) ease;
  will-change: transform, box-shadow;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.product-card:focus-within {
  box-shadow: 0 0 0 2px var(--brand-green);
}

/* Изображение продукта */
.product-image-container {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--border-radius) * 1.5);
}

.product-card img {
  transition: transform var(--animation-duration) ease;
  will-change: transform;
}

.product-card:hover img {
  transform: scale(1.02);
}

/* Действия с продуктом */
.product-actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: all var(--animation-duration) ease;
}

.product-card:hover .product-actions,
.product-card:focus-within .product-actions {
  opacity: 1;
  transform: translateY(0);
}

.product-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all var(--animation-duration) ease;
  cursor: pointer;
}

.product-actions button:hover {
  background: white;
  border-color: rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.product-actions button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-green);
}

/* Информация о продукте */
.product-info {
  padding-top: 0.75rem;
  space-y: 0.5rem;
}

.product-title a {
  color: #1f2937;
  text-decoration: none;
  transition: color var(--animation-duration) ease;
}

.product-title a:hover,
.product-title a:focus {
  color: var(--brand-green);
  outline: none;
}

/* Цена продукта */
.price-container {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.price-current {
  font-weight: 600;
  color: var(--brand-green);
  font-size: 1.125rem;
}

.price-old {
  text-decoration: line-through;
  color: #6b7280;
  font-size: 0.875rem;
}

/* Информация о наличии */
.stock-info {
  font-size: 0.75rem;
  font-weight: 500;
}

.stock-available {
  color: #059669;
}

.stock-low {
  color: #d97706;
}

.stock-out {
  color: #dc2626;
}

/* ===================================
   СЛАЙДЕР И НАВИГАЦИЯ
   =================================== */

/* Контейнер слайдера */
.slider-container {
  position: relative;
  padding: 0.5rem 0;
}

.slider-track {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.5rem;
  margin-bottom: -0.5rem;
}

.slider-item {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* Навигационные кнопки */
.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: white;
  color: #6b7280;
  transition: all var(--animation-duration) ease;
  cursor: pointer;
}

.nav-btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
  color: #374151;
}

.nav-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-green);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Индикаторы прокрутки */
.scroll-indicator {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.scroll-indicator .dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #e5e7eb;
  transition: all var(--animation-duration) ease;
  cursor: pointer;
}

.scroll-indicator .dot.active {
  background: var(--brand-green);
  transform: scale(1.2);
}

.scroll-indicator .dot:hover {
  background: #9ca3af;
}

/* ===================================
   КНОПКИ И ФОРМЫ
   =================================== */

/* Базовые стили кнопок */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--animation-duration) ease;
  cursor: pointer;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--brand-green), 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Основная кнопка */
.btn-primary {
  background: var(--brand-green);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-green-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Вторичная кнопка */
.btn-secondary {
  background: white;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
  transform: translateY(-1px);
}

/* Селектор количества */
.quantity-selector {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid #d1d5db;
  background: white;
  overflow: hidden;
}

.quantity-selector button {
  padding: 0.25rem 0.75rem;
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  transition: all var(--animation-duration) ease;
}

.quantity-selector button:hover:not(:disabled) {
  background: #f9fafb;
  color: #374151;
}

.quantity-selector button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quantity-selector input {
  width: 3rem;
  text-align: center;
  border: none;
  background: transparent;
  font-size: 0.875rem;
}

.quantity-selector input:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--brand-green);
}

/* ===================================
   СОСТОЯНИЯ ЗАГРУЗКИ
   =================================== */

/* Анимация загрузки */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Пульсация */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Загрузочный оверлей */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: all var(--animation-duration) ease;
}

.loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid #e5e7eb;
  border-top: 2px solid var(--brand-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===================================
   УВЕДОМЛЕНИЯ
   =================================== */

.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  max-width: 24rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.notification.show {
  transform: translateX(0);
}

.notification-success {
  border-left: 4px solid #10b981;
}

.notification-error {
  border-left: 4px solid #ef4444;
}

.notification-warning {
  border-left: 4px solid #f59e0b;
}

.notification-info {
  border-left: 4px solid #3b82f6;
}

/* ===================================
   АДАПТИВНОСТЬ
   =================================== */

/* Мобильные устройства */
@media (max-width: 640px) {
  .product-card {
    padding: 0.75rem;
  }
  
  .product-actions {
    position: static;
    opacity: 1;
    transform: none;
    justify-content: center;
    margin-top: 0.5rem;
  }
  
  .btn {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }
  
  .nav-btn {
    width: 2.5rem;
    height: 2.5rem;
  }
  
  .slider-track {
    gap: 0.75rem;
  }
  
  .notification {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

/* Планшеты */
@media (min-width: 641px) and (max-width: 1024px) {
  .product-card {
    padding: 1rem;
  }
}

/* Высокие плотности пикселей */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .product-card {
    border-width: 0.5px;
  }
}

/* ===================================
   ПЕЧАТЬ
   =================================== */

@media print {
  .product-actions,
  .nav-btn,
  .scroll-indicator,
  .btn {
    display: none !important;
  }
  
  .product-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
  
  .slider-track {
    display: block;
  }
  
  .slider-item {
    display: block;
    margin-bottom: 1rem;
  }
}

/* ===================================
   ТЕМНАЯ ТЕМА (ОПЦИОНАЛЬНО)
   =================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --border-color: #374151;
  }
  
  .product-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
  }
  
  .btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
  }
  
  .quantity-selector {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
  }
  
  .notification {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
  }
}

/* ===================================
   АНИМАЦИИ ПОЯВЛЕНИЯ
   =================================== */

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.slide-in-right {
  animation: slideInRight 0.3s ease-out;
}

/* Scale animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in {
  animation: scaleIn 0.2s ease-out;
}

/* ===================================
   ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ
   =================================== */

/* Позиционирование */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }

/* Flexbox */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Spacing */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Размеры */
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-72 { width: 18rem; }

/* Текст */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }

/* Цвета */
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-900 { color: #0f172a; }
.text-green-600 { color: #16a34a; }
.text-red-600 { color: #dc2626; }

/* Отступы */
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

/* Границы */
.border { border-width: 1px; }
.border-slate-200 { border-color: #e2e8f0; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* Эффекты */
.shadow-lg { box-shadow: var(--shadow-lg); }
.transition-all { transition: all var(--animation-duration) ease; }

/* Hover эффекты */
.hover\:bg-slate-50:hover { background-color: #f8fafc; }
.hover\:text-brand-green:hover { color: var(--brand-green); }
.hover\:shadow-lg:hover { box-shadow: var(--shadow-lg); }