/*
 * Мобильная оптимизация ультра-минималистичного дизайна
 * CoffeeRanks - Mobile Responsive Design
 * Дата: 2025-07-08
 */

/* =============================================================================
   МОБИЛЬНЫЕ УСТРОЙСТВА (до 768px)
   ============================================================================= */

@media (max-width: 768px) {
  
  /* Убираем все лишние отступы */
  .container,
  .container-fluid {
    padding: 10px !important;
  }
  
  /* Упрощаем навигацию */
  .main-nav {
    flex-direction: column !important;
    padding: 10px !important;
  }
  
  .nav-links {
    width: 100% !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
  }
  
  .nav-links a {
    padding: 8px 12px !important;
    margin: 2px !important;
    font-size: 14px !important;
    border-radius: 4px !important;
  }
  
  /* Логотип на мобилке */
  .logo {
    margin-bottom: 10px !important;
    text-align: center !important;
  }
  
  .logo-text {
    font-size: 1.5em !important;
  }
  
  .logo-tagline {
    display: none !important; /* Скрываем на мобилке */
  }
  
  /* Карточки товаров - одна колонка */
  .coffee-list,
  .products-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
    padding: 15px 10px !important;
  }
  
  .product-card {
    padding: 12px !important;
    margin-bottom: 10px !important;
  }
  
  .product-image {
    height: 180px !important;
  }
  
  .product-title {
    font-size: 1.1em !important;
    line-height: 1.4 !important;
  }
  
  .product-price {
    font-size: 1.2em !important;
  }
  
  /* Кнопки на мобилке */
  .btn,
  .button,
  button {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important;
    margin-bottom: 10px !important;
  }
  
  /* Формы на мобилке */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select {
    width: 100% !important;
    padding: 12px !important;
    font-size: 16px !important; /* Предотвращает zoom на iOS */
  }
  
  /* Поиск */
  .search-form {
    width: 100% !important;
    margin-bottom: 15px !important;
  }
  
  .search-form input {
    width: 100% !important;
    margin-bottom: 10px !important;
  }
  
  /* Пагинация на мобилке */
  .pagination {
    justify-content: center !important;
    flex-wrap: wrap !important;
  }
  
  .pagination a,
  .pagination span {
    padding: 8px 12px !important;
    margin: 2px !important;
    font-size: 14px !important;
  }
  
  /* Footer на мобилке */
  .footer,
  .main-footer {
    padding: 15px 10px !important;
    text-align: center !important;
  }
  
  /* Убираем сложную структуру в футере */
  .footer .row,
  .footer .col-md-3,
  .footer .col-md-6 {
    display: block !important;
    width: 100% !important;
    margin-bottom: 15px !important;
  }
}

/* =============================================================================
   ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (до 480px)
   ============================================================================= */

@media (max-width: 480px) {
  
  /* Еще более компактный дизайн */
  .container,
  .container-fluid {
    padding: 5px !important;
  }
  
  .product-card {
    padding: 8px !important;
  }
  
  .product-image {
    height: 150px !important;
  }
  
  .product-title {
    font-size: 1em !important;
  }
  
  .product-price {
    font-size: 1.1em !important;
  }
  
  .nav-links a {
    padding: 6px 8px !important;
    font-size: 13px !important;
  }
  
  .logo-text {
    font-size: 1.3em !important;
  }
  
  /* Очень компактные кнопки */
  .btn,
  .button,
  button {
    padding: 10px !important;
    font-size: 14px !important;
  }
}

/* =============================================================================
   ПЛАНШЕТЫ (768px - 1024px)
   ============================================================================= */

@media (min-width: 768px) and (max-width: 1024px) {
  
  /* Двухколоночная сетка для планшетов */
  .coffee-list,
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 18px !important;
    padding: 18px !important;
  }
  
  .nav-links a {
    padding: 10px 14px !important;
  }
  
  .product-card {
    padding: 14px !important;
  }
  
  .product-image {
    height: 190px !important;
  }
}

/* =============================================================================
   ОПТИМИЗАЦИЯ ДЛЯ TOUCH УСТРОЙСТВ
   ============================================================================= */

@media (hover: none) {
  
  /* Убираем hover эффекты на touch устройствах */
  .product-card:hover {
    transform: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
  }
  
  .nav-links a:hover,
  .navbar a:hover,
  .navigation a:hover {
    background-color: transparent !important;
  }
  
  /* Увеличиваем размер кликабельных элементов */
  .nav-links a,
  .btn,
  .button,
  button {
    min-height: 44px !important; /* Apple recommendation */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  /* Улучшаем тап цели */
  a, button, input, select, textarea {
    -webkit-tap-highlight-color: rgba(44, 24, 16, 0.1) !important;
  }
}

/* =============================================================================
   ВЫСОКИЕ РАЗРЕШЕНИЯ (RETINA)
   ============================================================================= */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  
  /* Более четкие границы для retina дисплеев */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select {
    border-width: 0.5px !important;
  }
  
  .product-card {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  }
  
  hr {
    height: 0.5px !important;
  }
}

/* =============================================================================
   ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ НА МОБИЛКЕ
   ============================================================================= */

@media (max-width: 768px) and (orientation: landscape) {
  
  /* В ландшафте можем позволить 2 колонки */
  .coffee-list,
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  .product-image {
    height: 120px !important;
  }
  
  .product-card {
    padding: 10px !important;
  }
  
  /* Более компактная навигация */
  .nav-links {
    flex-direction: row !important;
    justify-content: space-around !important;
  }
  
  .nav-links a {
    padding: 6px 10px !important;
    font-size: 13px !important;
  }
}

/* =============================================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================================= */

/* Улучшения для пользователей с проблемами зрения */
@media (prefers-reduced-motion: reduce) {
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .product-card {
    transition: none !important;
  }
  
  .product-card:hover {
    transform: none !important;
  }
}

/* Высококонтрастный режим */
@media (prefers-contrast: high) {
  
  :root {
    --color-primary: #000000 !important;
    --color-secondary: #333333 !important;
    --color-border: #666666 !important;
    --color-text: #000000 !important;
    --color-text-light: #333333 !important;
  }
  
  .product-card {
    border: 2px solid var(--color-border) !important;
  }
  
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  textarea,
  select {
    border: 2px solid var(--color-border) !important;
  }
}
