/**
 * БагетБери — Адаптивные стили
 * Mobile-first подход
 */

/* === TABLET (до 1024px) === */
@media (max-width: 1024px) {
  :root {
    --header-height: 72px;
  }

  .container {
    padding: 0 var(--space-md);
  }

  /* Hero */
  .hero-title {
    font-size: var(--font-size-4xl);
  }

  .hero-subtitle {
    font-size: var(--font-size-lg);
  }

  /* Сетки */
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }

  /* Страница товара */
  .product-detail {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }

  .product-gallery {
    position: relative;
    top: 0;
  }

  /* Корзина */
  .cart-grid {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: relative;
    top: 0;
  }
}

/* === MOBILE (до 768px) === */
@media (max-width: 768px) {
  :root {
    --header-height: var(--header-height-mobile);
    --font-size-5xl: 2.5rem;
    --font-size-4xl: 2rem;
    --font-size-3xl: 1.75rem;
  }

  /* Typography */
  h1 {
    font-size: var(--font-size-3xl);
  }

  h2 {
    font-size: var(--font-size-2xl);
  }

  /* Header */
  .header-inner {
    position: relative;
  }

  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-card);
    flex-direction: column;
    padding: var(--space-xl);
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    overflow-y: auto;
  }

  .main-nav.open {
    transform: translateX(0);
  }

  .nav-list {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }

  .nav-link {
    display: block;
    padding: var(--space-md) 0;
    font-size: var(--font-size-lg);
    border-bottom: 1px solid var(--color-border-light);
  }

  .nav-link::after {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
    order: -1;
  }

  .mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .cart-link {
    padding: var(--space-sm);
  }

  .cart-link span:not(.cart-count) {
    display: none;
  }

  /* Hero */
  .hero {
    min-height: auto;
    padding: var(--space-4xl) 0;
  }

  .hero-content {
    padding: var(--space-xl);
  }

  .hero-title {
    font-size: var(--font-size-3xl);
  }

  .hero-buttons {
    flex-direction: column;
  }

  .hero-buttons .btn {
    width: 100%;
  }

  /* Сетки */
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .category-card {
    aspect-ratio: 1;
  }

  .category-overlay {
    padding: var(--space-md);
  }

  .category-name {
    font-size: var(--font-size-base);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

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

  .product-name {
    font-size: var(--font-size-base);
  }

  /* Section */
  .section {
    padding: var(--space-3xl) 0;
  }

  .section-header {
    margin-bottom: var(--space-2xl);
  }

  /* Buttons */
  .btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-base);
  }

  /* Footer */
  .footer {
    padding: var(--space-2xl) 0 var(--space-lg);
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    text-align: center;
  }

  .footer-brand {
    max-width: 100%;
  }

  .footer-contact {
    align-items: center;
  }

  .contact-item {
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--space-md);
  }

  /* Product page */
  .product-page {
    padding: var(--space-xl) 0;
  }

  .product-info-box {
    padding: var(--space-xl);
  }

  .product-title {
    font-size: var(--font-size-2xl);
  }

  .product-meta {
    flex-wrap: wrap;
    gap: var(--space-md);
  }

  .product-price-current {
    font-size: var(--font-size-2xl);
  }

  .product-actions {
    flex-direction: column;
  }

  .quantity-selector {
    justify-content: center;
  }

  /* Cart */
  .cart-item {
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
    gap: var(--space-md);
  }

  .cart-item-image {
    width: 80px;
    height: 80px;
    grid-row: span 2;
  }

  .cart-item-info {
    grid-column: 2;
  }

  .cart-item-quantity {
    grid-column: 2;
  }

  /* Breadcrumbs */
  .breadcrumbs {
    display: none;
  }
}

/* === QUANTITY SELECTOR RESPONSIVE FIXES === */
@media (max-width: 1200px) {
  .product-card-add-section {
    flex-wrap: nowrap;
  }
}

@media (max-width: 992px) {
  .product-card-quantity__btn {
    width: 26px;
    height: 26px;
    min-width: 26px;
    min-height: 26px;
  }
  
  .product-card-quantity__input {
    width: 28px;
    height: 26px;
    min-width: 28px;
  }
}

@media (max-width: 768px) {
  .product-card-add-section {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
  
  .product-card-quantity {
    gap: 2px;
    padding: 1px;
  }
  
  .product-card-quantity__btn {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    font-size: var(--font-size-base);
  }
  
  .product-card-quantity__input {
    width: 26px;
    height: 24px;
    min-width: 26px;
    font-size: var(--font-size-xs);
  }
  
  .btn-add-cart-modern {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
  }
  
  .btn-add-cart-modern svg {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .product-card-add-section {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: var(--space-xs);
  }
  
  .product-card-quantity {
    flex-shrink: 0;
  }
  
  .btn-add-cart-modern {
    flex: 1;
    min-width: 0;
    justify-content: center;
  }
}

/* === SMALL MOBILE (до 480px) === */
@media (max-width: 480px) {
  :root {
    --font-size-3xl: 1.5rem;
    --font-size-2xl: 1.25rem;
  }

  .container {
    padding: 0 var(--space-md);
  }

  /* Logo */
  .logo-text {
    font-size: var(--font-size-lg);
  }

  /* Categories - одна колонка */
  .categories-grid {
    grid-template-columns: 1fr;
  }

  .category-card {
    aspect-ratio: 16/9;
  }

  /* Products - одна колонка */
  .products-grid {
    grid-template-columns: 1fr;
  }

  .product-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--space-md);
  }

  .product-image-wrap {
    aspect-ratio: 1;
  }

  .product-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Hero */
  .hero-content {
    padding: var(--space-lg);
  }

  .hero-title {
    font-size: var(--font-size-2xl);
  }

  .hero-subtitle {
    font-size: var(--font-size-base);
  }

  /* Section */
  .section-title {
    font-size: var(--font-size-xl);
  }

  .section-subtitle {
    font-size: var(--font-size-base);
  }

  /* Cart */
  .cart-item {
    grid-template-columns: 60px 1fr;
  }

  .cart-item-image {
    width: 60px;
    height: 60px;
  }
}

/* === LARGE SCREENS (от 1280px) === */
@media (min-width: 1280px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* === TOUCH УСТРОЙСТВА === */
@media (hover: none) {
  .product-card:hover,
  .category-card:hover {
    transform: none;
  }

  .product-card:active,
  .category-card:active {
    transform: scale(0.98);
  }

  .btn:hover {
    transform: none;
  }

  .btn:active {
    transform: scale(0.95);
  }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* === PRINT === */
@media print {
  .header,
  .footer,
  .hero-video-bg,
  .btn,
  .cart-link {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .product-detail {
    grid-template-columns: 1fr 1fr;
  }
}
