/*
 * КОМПОНЕНТЫ COFFEERANKS v3.0
 * Дата: 2025-08-25
 * Современные UI компоненты и интерактивные элементы
 */

/* =============================================================================
   КНОПКИ И ФОРМЫ
   ============================================================================= */

/* Базовые кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--primary-brown);
  color: white;
  box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
  background: var(--primary-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
  color: white;
}

.btn-secondary {
  background: var(--surface-white);
  color: var(--text-primary);
  border: 1.5px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--surface-elevated);
  border-color: var(--primary-brown);
  color: var(--primary-brown);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--primary-brown);
  border: 1.5px solid transparent;
}

.btn-ghost:hover {
  background: var(--surface-white);
  border-color: var(--border-subtle);
  color: var(--primary-brown);
}

/* Размеры кнопок */
.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 28px;
  font-size: 16px;
}

/* Формы */
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-subtle);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface-white);
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-brown);
  box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.1);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* =============================================================================
   МОДАЛЬНЫЕ ОКНА И ПОПОВЕРЫ
   ============================================================================= */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface-elevated);
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-strong);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* =============================================================================
   ЦЕНОВЫЕ СЛАЙДЕРЫ
   ============================================================================= */

.price-slider-container {
  margin: 20px 0;
}

.price-range-display {
  text-align: center;
  font-weight: 600;
  color: var(--primary-brown);
  margin-bottom: 20px;
  font-size: 1.125rem;
  background: var(--surface-white);
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
}

.price-slider-wrapper {
  position: relative;
  height: 40px;
  margin: 20px 0;
}

.price-track {
  position: absolute;
  top: 17px;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
}

.price-range {
  position: absolute;
  top: 17px;
  height: 6px;
  background: var(--gradient-coffee);
  border-radius: 3px;
  transition: all 0.1s ease;
}

.price-slider {
  position: absolute;
  top: 0;
  width: 100%;
  height: 40px;
  background: transparent;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}

.price-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-brown);
  cursor: pointer;
  pointer-events: all;
  border: 3px solid white;
  box-shadow: var(--shadow-medium);
  transition: all 0.2s ease;
}

.price-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  background: var(--primary-accent);
}

.price-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-brown);
  cursor: pointer;
  border: 3px solid white;
  pointer-events: all;
  box-shadow: var(--shadow-medium);
  transition: all 0.2s ease;
}

.price-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.price-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.price-input-group label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.price-input-group input {
  padding: 10px 12px;
  border: 1.5px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface-white);
  transition: border-color 0.2s ease;
}

.price-input-group input:focus {
  outline: none;
  border-color: var(--primary-brown);
}

/* =============================================================================
   ПОИСК И АВТОДОПОЛНЕНИЕ
   ============================================================================= */

.search-container {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  font-size: 14px;
  background: var(--surface-white);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-brown);
  box-shadow: 0 0 0 3px rgba(111, 78, 55, 0.1);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-medium);
  z-index: 100;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 4px;
}

.search-suggestion {
  padding: 12px 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid var(--border-light);
}

.search-suggestion:last-child {
  border-bottom: none;
}

.search-suggestion:hover {
  background: var(--surface-white);
}

.search-suggestion.active {
  background: var(--primary-brown);
  color: white;
}

/* =============================================================================
   ЗАГРУЗКА И СОСТОЯНИЯ
   ============================================================================= */

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle);
  border-radius: 50%;
  border-top-color: var(--primary-brown);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-skeleton {
  background: linear-gradient(90deg, var(--surface-white) 25%, var(--border-light) 50%, var(--surface-white) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Skeleton для карточек */
.coffee-card-skeleton {
  background: var(--surface-elevated);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.coffee-card-skeleton .image-skeleton {
  aspect-ratio: 4/3;
  background: var(--loading-skeleton);
}

.coffee-card-skeleton .content-skeleton {
  padding: 20px;
}

.coffee-card-skeleton .title-skeleton {
  height: 20px;
  background: var(--loading-skeleton);
  border-radius: 4px;
  margin-bottom: 12px;
}

.coffee-card-skeleton .subtitle-skeleton {
  height: 16px;
  background: var(--loading-skeleton);
  border-radius: 4px;
  width: 70%;
  margin-bottom: 8px;
}

/* =============================================================================
   АНИМАЦИИ И МИКРОИНТЕРАКЦИИ
   ============================================================================= */

.fade-in {
  animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.bounce {
  animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* Hover эффекты */
.hover-lift:hover {
  transform: translateY(-2px);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow:hover {
  box-shadow: 0 0 20px rgba(111, 78, 55, 0.3);
}

/* =============================================================================
   УТИЛИТАРНЫЕ КЛАССЫ
   ============================================================================= */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-weight-normal { font-weight: 400; }
.font-weight-medium { font-weight: 500; }
.font-weight-semibold { font-weight: 600; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-brand { color: var(--primary-brown); }

.bg-white { background-color: var(--surface-white); }
.bg-elevated { background-color: var(--surface-elevated); }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }

.shadow-sm { box-shadow: var(--shadow-soft); }
.shadow-md { box-shadow: var(--shadow-medium); }
.shadow-lg { box-shadow: var(--shadow-strong); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
