/*
 * АДАПТИВНЫЕ СТИЛИ COFFEERANKS v3.0
 * Дата: 2025-08-25
 * Полная мобильная и планшетная адаптация
 */

/* =============================================================================
   ПЛАНШЕТЫ (768px - 1024px)
   ============================================================================= */
@media (max-width: 1024px) {
  .coffee-page-content {
    grid-template-columns: 260px 1fr;
    gap: 20px;
  }
  
  .filters-section {
    padding: 20px;
    top: 90px;
  }
  
  .coffee-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
  
  .container {
    padding: 0 16px;
  }
}

/* =============================================================================
   МОБИЛЬНЫЕ УСТРОЙСТВА (до 768px)
   ============================================================================= */
@media (max-width: 768px) {
  /* Навигация */
  .main-nav {
    padding: 8px 16px;
    position: relative;
  }
  
  .mobile-menu-button {
    display: flex;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-overlay);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-subtle);
    flex-direction: column;
    padding: 16px;
    gap: 8px;
  }
  
  .nav-links.mobile-open {
    display: flex;
  }
  
  .nav-links a {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    border-radius: 8px;
  }
  
  /* Анимация мобильного меню */
  .mobile-menu-button.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .mobile-menu-button.open span:nth-child(2) {
    opacity: 0;
  }
  
  .mobile-menu-button.open span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
  
  /* Layout страницы кофе */
  .coffee-page-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* Фильтры становятся модальным окном */
  .filters-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    transform: translateY(100%);
    z-index: 1001;
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
  }
  
  .filters-section.mobile-open {
    transform: translateY(0);
  }
  
  /* Кнопка открытия фильтров */
  .mobile-filters-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary-brown);
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    box-shadow: var(--shadow-strong);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
  }
  
  .mobile-filters-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 32px rgba(111, 78, 55, 0.3);
  }
  
  /* Overlay для модального окна фильтров */
  .filters-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  
  .filters-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  /* Сетка карточек на мобильных */
  .coffee-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  /* Карточки кофе на мобильных */
  .coffee-card {
    border-radius: 12px;
  }
  
  .coffee-info {
    padding: 16px;
  }
  
  .coffee-name {
    font-size: 1rem;
    margin-bottom: 6px;
  }
  
  .coffee-roaster {
    font-size: 13px;
    margin-bottom: 10px;
  }
  
  /* Типографика */
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.125rem; }
  
  body {
    font-size: 14px;
  }
  
  .container {
    padding: 0 12px;
  }
  
  .main-content {
    padding: 16px 0;
  }
}

/* =============================================================================
   МАЛЕНЬКИЕ МОБИЛЬНЫЕ (до 480px)
   ============================================================================= */
@media (max-width: 480px) {
  /* Одна колонка карточек */
  .coffee-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* Более компактные карточки */
  .coffee-image {
    aspect-ratio: 3/2;
  }
  
  .coffee-info {
    padding: 12px;
  }
  
  .coffee-name {
    font-size: 0.9rem;
    line-height: 1.4;
  }
  
  /* Навигация */
  .logo {
    font-size: 1.125rem;
  }
  
  .logo-icon {
    width: 28px;
    height: 28px;
  }
  
  /* Фильтры */
  .filters-section {
    padding: 16px;
    max-height: 80vh;
  }
  
  .filter-chips {
    gap: 6px;
  }
  
  .filter-chip {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  /* Типографика */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.125rem; }
  
  body {
    font-size: 13px;
  }
}

/* =============================================================================
   БОЛЬШИЕ ЭКРАНЫ (1200px+)
   ============================================================================= */
@media (min-width: 1200px) {
  .coffee-page-content {
    grid-template-columns: 320px 1fr;
    gap: 40px;
  }
  
  .filters-section {
    padding: 28px;
  }
  
  .coffee-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
  }
  
  .coffee-info {
    padding: 24px;
  }
}

/* =============================================================================
   УТИЛИТЫ ДЛЯ АДАПТИВНОСТИ
   ============================================================================= */

/* Скрытие элементов на разных экранах */
.hide-mobile {
  display: block;
}

.hide-desktop {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
  
  .hide-desktop {
    display: block;
  }
}

/* Предотвращение zoom на iOS */
input[type="search"],
input[type="text"],
input[type="email"],
select,
textarea {
  font-size: 16px;
}

/* Плавная прокрутка и улучшения для тач-устройств */
* {
  -webkit-tap-highlight-color: transparent;
}

button,
.filter-chip,
.coffee-card {
  touch-action: manipulation;
}

/* Анимации только для устройств с достаточной производительностью */
@media (prefers-reduced-motion: no-preference) {
  .coffee-card,
  .filter-chip,
  .nav-links a {
    transition: all 0.2s ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  .coffee-card,
  .filter-chip,
  .nav-links a {
    transition: none;
  }
}
