/* ============================================================
   MOBILE.CSS — Адаптив ≤768px
   ============================================================ */

/* === FAB КОРЗИНА === */
.fab-cart {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1B2A4A;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  z-index: 190;
  flex-shrink: 0;
  animation: fab-rise 0.45s 0.15s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes fab-rise {
  from { transform: translateY(80px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.fab-cart svg {
  width: 24px; height: 24px;
  stroke: #fff; fill: none;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.fab-cart-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #E8C4C4;
  color: #1B2A4A;
  font-family: 'Jost', sans-serif;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #fff;
}

/* === DRAWER НАВИГАЦИЯ === */
.nav-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 299;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.nav-drawer-overlay.is-visible {
  display: block;
  opacity: 1;
}
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 285px;
  max-width: 85vw;
  background: var(--color-bg-card, #FEFCF9);
  z-index: 300;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: 4px 0 24px rgba(0,0,0,0.12);
}
.nav-drawer.is-open { transform: translateX(0); }

.nav-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--color-border, #EDE8E3);
  flex-shrink: 0;
}
.nav-drawer-brand {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--color-primary, #1B2A4A);
}
.nav-drawer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light, #7A6F66);
  padding: 6px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.nav-drawer-close:hover { background: #f0ece7; }

.nav-drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  flex-shrink: 0;
}
.nav-drawer-nav a {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 400;
  color: var(--color-text, #2A2A2A);
  text-decoration: none;
  border-bottom: 1px solid var(--color-border, #EDE8E3);
  transition: background 0.15s, color 0.15s;
  letter-spacing: 0.02em;
}
.nav-drawer-nav a:last-child { border-bottom: none; }
.nav-drawer-nav a:active { background: #f5f0ea; }

.nav-drawer-bonus {
  margin: 16px 16px 0;
  padding: 14px 16px;
  background: var(--color-primary, #1B2A4A);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  flex-shrink: 0;
}
.nav-drawer-bonus-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-drawer-bonus-icon svg { stroke: #fff; fill: none; width: 18px; height: 18px; stroke-width: 1.5; }
.nav-drawer-bonus-text {}
.nav-drawer-bonus-label {
  font-size: 10px;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 2px;
}
.nav-drawer-bonus-amount {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
}

.nav-drawer-phone {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border, #EDE8E3);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-primary, #1B2A4A);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.nav-drawer-phone svg { stroke: var(--color-primary, #1B2A4A); fill: none; width: 16px; height: 16px; stroke-width: 1.5; flex-shrink: 0; }

/* === STICKY BAR ТОВАРА (мобиле) === */
.mob-product-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--color-border, #EDE8E3);
  padding: 10px 16px env(safe-area-inset-bottom, 0);
  z-index: 150;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  align-items: center;
  gap: 12px;
}
.mob-product-bar-price { flex-shrink: 0; }
.mob-product-bar-current {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-primary, #1B2A4A);
  display: block;
  line-height: 1.1;
}
.mob-product-bar-old {
  font-size: 12px;
  color: var(--color-text-light, #7A6F66);
  text-decoration: line-through;
  display: block;
}
.mob-product-bar-actions {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.mob-product-bar-actions .btn-primary,
.mob-product-bar-actions .btn-outline {
  flex: 1;
  min-height: 44px;
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === ГЛОБАЛЬНЫЕ ПРАВИЛА 768px === */
@media (max-width: 768px) {

  /* Запрет горизонтального скролла */
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }

  /* Минимальный шрифт и кнопки */
  body { font-size: 14px; }
  .btn-primary,
  .btn-outline,
  .btn-ghost { min-height: 44px; }

  /* Контейнер */
  .container {
    padding: 0 16px;
    box-sizing: border-box;
    max-width: 100vw;
    width: 100%;
  }

  /* --- HEADER --- */
  .site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    background: rgba(250,246,241,0.98);
    box-shadow: 0 1px 10px rgba(0,0,0,0.08);
  }
  /* Смещаем контент вниз из-за fixed header */
  body { padding-top: 72px; }

  /* Порядок: burger | logo (центр) | иконки */
  .site-header .container { gap: 0; }
  .burger-menu { order: 1; flex-shrink: 0; }
  .site-logo   { order: 2; flex: 1; text-align: center; }
  .header-nav  { display: none !important; }
  .header-actions { order: 3; flex-shrink: 0; gap: 8px; }

  /* Корзина — в FAB, убираем из шапки */
  .header-actions .cart-btn { display: none; }

  /* FAB показываем */
  .fab-cart { display: flex; }

  /* --- ГЛАВНАЯ СТРАНИЦА --- */
  .hero-title { font-size: clamp(2.8rem, 11vw, 5rem); line-height: 1.1; white-space: normal; }
  .hero-actions {
    flex-direction: column;
    gap: 12px;
  }
  .hero-actions .btn-primary,
  .hero-actions .btn-outline { width: 100%; justify-content: center; }

  /* Преимущества — уже 2 кол. на 768px */
  /* Отзывы — горизонтальный скролл */
  .reviews-section .container { padding-right: 0; }
  .reviews-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 16px;
    padding-bottom: 12px;
    padding-right: 16px;
    grid-template-columns: unset;
  }
  .reviews-grid::-webkit-scrollbar { display: none; }
  .reviews-grid .review-card {
    flex: 0 0 82vw;
    max-width: 320px;
  }

  /* --- КАТАЛОГ --- */
  .catalog-page { max-width: 100%; }
  .catalog-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: auto;
  }
  .catalog-main {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  /* Категории — горизонтальный скролл пилюль, вертикаль — обычный поток */
  .catalog-sidebar {
    display: block !important;
    order: -1;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-bottom: 16px;
  }
  .catalog-sidebar::-webkit-scrollbar { display: none; }
  .catalog-sidebar .sidebar-title { display: none; }
  .sidebar-categories {
    display: flex !important;
    flex-direction: row !important;
    gap: 8px;
    white-space: nowrap;
    padding: 4px 0 8px;
  }
  .sidebar-category {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1px solid var(--color-border, #EDE8E3);
    font-size: 13px;
    color: var(--color-text, #2A2A2A);
    background: #fff;
    text-decoration: none;
    min-height: 36px;
    transition: none;
  }
  .sidebar-category.active {
    background: var(--color-primary, #1B2A4A);
    color: #fff;
    border-color: var(--color-primary, #1B2A4A);
  }

  /* Фильтры по цене — обычный поток, кнопки переносятся */
  .price-filters {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    gap: 8px;
    margin-bottom: 20px;
  }
  .price-filter-btn { white-space: nowrap; min-height: 36px; }

  /* Карточки товаров — 2 в ряд */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }
  .product-card {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .product-card__image-wrap {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
  }
  .product-card__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
  .product-card__info { overflow: hidden; }
  .product-card__title { overflow: hidden; word-break: break-word; }

  /* Блок «Ничего не найдено» */
  .empty-state {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-align: center;
    padding: 0 16px;
    box-sizing: border-box;
  }
  .empty-state h3,
  .empty-state p { word-break: break-word; overflow-wrap: break-word; }
  .empty-state .btn-primary {
    max-width: 280px;
    width: 100%;
    margin: 8px auto 0;
    display: block;
  }

  /* --- СТРАНИЦА ТОВАРА --- */
  .mob-product-bar { display: none; }
  .product-actions { display: flex; flex-direction: column; gap: 12px; }
  .product-page { padding-bottom: 24px; }
  .product-main-image-wrap { aspect-ratio: unset; max-height: none; background: #F9F5F0; border-radius: 12px; }
  .product-main-image { max-height: none; width: 100%; height: auto; object-fit: contain; }
  .product-detail-layout { gap: 20px; }
  .product-actions .btn-primary,
  .product-actions .btn-outline { width: 100%; }

  /* --- КОРЗИНА --- */
  .cart-table,
  .cart-table tbody { display: block; }
  .cart-table thead { display: none; }
  .cart-table tr {
    display: block;
    position: relative;
    padding: 14px;
    border: 1px solid var(--color-border, #EDE8E3);
    border-radius: 12px;
    margin-bottom: 12px;
    background: var(--color-bg-card, #FEFCF9);
  }
  .cart-table td {
    display: block;
    padding: 0;
    border: none;
  }
  .cart-table td:nth-child(1) { padding-right: 40px; margin-bottom: 10px; }
  .cart-table td:nth-child(2) { display: none; }
  .cart-table td:nth-child(3) { display: inline-block; vertical-align: middle; margin-right: 12px; }
  .cart-table td:nth-child(4) {
    display: inline-block;
    vertical-align: middle;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-primary, #1B2A4A);
  }
  .cart-table td:nth-child(5) {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
  }

  /* --- ОФОРМЛЕНИЕ ЗАКАЗА --- */
  .checkout-layout { grid-template-columns: 1fr; }
  /* Дата+время в 2 кол */
  .form-row-slots { grid-template-columns: 1fr 1fr !important; gap: 10px; }

  /* --- ПРОФИЛЬ --- */
  .profile-layout { grid-template-columns: 1fr; }
  .profile-sidebar { position: static; }
  .orders-tab-btn  { font-size: 1rem; padding: 8px 0; margin-right: 24px; }
  .order-card      { padding: 14px 16px; }
  .profile-data-fields { grid-template-columns: 1fr; }
  .profile-data-form .form-row { grid-template-columns: 1fr; }

  /* --- ДОСТАВКА --- */
  .delivery-cards { grid-template-columns: 1fr !important; max-width: 100%; }
  .zones-grid     { grid-template-columns: 1fr 1fr; }

  /* --- ОБЩИЕ УЛУЧШЕНИЯ --- */
  .section { padding: 48px 0; }
  .page-intro { padding-top: 32px; }
  .form-section-title { font-size: 1.1rem; }

  /* Отступ снизу для страниц где есть FAB (не перекрывает контент) */
  .cart-page  { padding-bottom: 24px; }
  .catalog-page { padding-bottom: 24px; }

  /* Убираем hover-эффекты на touch */
  @media (hover: none) {
    .product-card:hover { box-shadow: none; transform: none; }
    .btn-primary:hover  { background: var(--color-primary, #1B2A4A); transform: none; }
    .btn-outline:hover  { background: transparent; color: var(--color-primary, #1B2A4A); }
    .product-card:hover .product-card__quick-add { bottom: -50px; }
  }
}

/* === 480px === */
@media (max-width: 480px) {
  /* 2 карточки в ряд сохраняем, уменьшаем зазор */
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }

  /* Отзывы — чуть шире карточка */
  .reviews-grid .review-card { flex: 0 0 90vw; }

  /* Статистика — 2 кол */
  .advantages-grid { grid-template-columns: repeat(2, 1fr); }

  /* Зоны — 1 кол */
  .zones-grid { grid-template-columns: 1fr; }

  /* Форма авторизации */
  .auth-card { padding: 28px 20px; }
}
