/* ============================================================================
 *  mobile-app.css — мобильная версия сайта в стиле приложения (iOS-like)
 * ----------------------------------------------------------------------------
 *  Активируется автоматически на узких экранах (телефоны/маленькие планшеты).
 *  Десктоп не затрагивается. Подключать ПОСЛЕ components.css.
 * ========================================================================== */

/* Нижняя таб-навигация по умолчанию скрыта (десктоп) */
.app-tabbar { display: none; }

@media (max-width: 768px) {

  :root { --app-tabbar-h: 64px; }

  /* --- База: фон страницы + отступ снизу под таб-бар --- */
  body {
    background: var(--color-bg);
    padding-bottom: calc(var(--app-tabbar-h) + env(safe-area-inset-bottom, 0px));
  }

  /* ----------------------------- Шапка → ЧЁРНЫЙ app-bar (стиль Big Boss) -- */
  .pub-header {
    position: sticky; top: 0; z-index: var(--z-header);
    background: #000; box-shadow: none; border-bottom: none;
  }
  .pub-header .header__inner {
    display: flex; align-items: center; gap: 10px;
    height: var(--header-height-mobile); padding: 6px 14px;
    padding-top: calc(6px + env(safe-area-inset-top, 0px));
  }
  /* Фирменный логотип — акцентом на чёрном */
  .pub-header .header__logo { font-size: 1.25rem; font-weight: 800; color: var(--color-primary); letter-spacing: -.3px; }
  /* Поиск в шапке прячем — для поиска есть отдельная вкладка снизу */
  .pub-header .header__search { display: none; }
  /* Город — полупрозрачная пилюля на чёрном */
  .pub-header .city-btn {
    margin-left: auto; font-size: var(--fs-sm); padding: 7px 12px; max-width: 45vw; overflow: hidden;
    background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: var(--radius-full);
  }
  .pub-header .city-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
  .pub-header .city-btn #city-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pub-header .city-btn .text-light { color: rgba(255,255,255,.6); }
  /* Кнопки-иконки — полупрозрачные круги с белыми иконками */
  .pub-header .header__actions { gap: 6px; }
  .pub-header .header__actions .btn-icon {
    width: 40px; height: 40px; background: rgba(255,255,255,.12); color: #fff; border: none;
  }
  .pub-header .header__actions .btn-icon:hover { background: rgba(255,255,255,.2); transform: none; }
  .pub-header .header__actions .btn-icon i { color: #fff; }
  .pub-header .header__actions .btn.btn-primary { padding: 8px 14px; min-height: 0; width: auto; }

  /* --------------------------- Контейнеры -------------------------------- */
  .container { padding-left: 14px; padding-right: 14px; max-width: 100%; }
  main.container { padding-top: 14px !important; padding-bottom: 18px !important; }

  /* ----------------- Переключатель режимов (сегмент-контрол) ------------- */
  .view-switch { width: 100%; display: flex; background: var(--color-surface-2); border-radius: var(--radius-full); padding: 4px; }
  .view-switch__btn { flex: 1; justify-content: center; border-radius: var(--radius-full); padding: 9px 0; font-size: var(--fs-sm); }

  /* ------------------- Горизонтальные скроллеры без полос ---------------- */
  .cat-scroller, .jobs-scroller, .home-actions {
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .cat-scroller::-webkit-scrollbar, .jobs-scroller::-webkit-scrollbar, .home-actions::-webkit-scrollbar { display: none; }

  /* ----------------------------- Сетки ----------------------------------- */
  /* Заведения — лентой в одну колонку (как в приложении) */
  .shop-grid { grid-template-columns: 1fr !important; gap: 12px; }
  /* Товары — в две колонки */
  .product-grid { grid-template-columns: 1fr 1fr !important; gap: 10px; }

  /* Карточки: крупный радиус и мягкая тень */
  .card, .product-card, .shop-card { border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }

  .home-actions { gap: 8px; padding-bottom: 4px; }
  .home-actions .select, .home-actions .chip { font-size: var(--fs-sm); flex-shrink: 0; }

  /* --------------------------- Заголовки секций -------------------------- */
  .section-head { margin-top: 20px; }
  .section-head h2 { font-size: var(--fs-h3); }

  /* ----------------------------- Кнопки/поля ----------------------------- */
  .btn { min-height: 46px; border-radius: var(--radius-md); }
  .btn-primary, .btn-block { width: 100%; }
  .btn-sm { min-height: 38px; width: auto; }
  .input, .select, textarea.input { min-height: 46px; font-size: var(--fs-base); border-radius: var(--radius-md); }

  /* Десктопный футер не нужен — его роль выполняет таб-бар */
  .pub-footer { display: none; }

  /* --------------- Модалки → нижние «листы» (bottom sheet) --------------- */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-backdrop .modal {
    max-width: 100% !important; width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    margin: 0; max-height: 88vh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: appSheetUp .28s cubic-bezier(.2,.8,.2,1);
  }
  @keyframes appSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

  /* Корзина-drawer — на всю ширину снизу */
  .cart-drawer { width: 100% !important; max-width: 100% !important; }

  /* ===================== НИЖНЯЯ ТАБ-НАВИГАЦИЯ ===================== */
  .app-tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-header);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  }
  .app-tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; height: var(--app-tabbar-h);
    color: var(--color-text-muted); text-decoration: none;
    font-size: 11px; font-weight: 500; position: relative;
    transition: color .15s; -webkit-tap-highlight-color: transparent;
  }
  .app-tab i { font-size: 23px; line-height: 1; }
  .app-tab.is-active { color: var(--color-primary); }
  .app-tab.is-active i { font-weight: 700; }
  .app-tab__badge {
    position: absolute; top: 6px; left: 50%; margin-left: 3px;
    min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;
    background: var(--color-primary); color: #fff; border-radius: 999px;
    font-size: 10px; line-height: 16px; text-align: center; font-weight: 600;
  }
}

/* Очень узкие телефоны — товары тоже в одну колонку */
@media (max-width: 380px) {
  .product-grid { grid-template-columns: 1fr !important; }
}

/* ===== Компактная карточка товара с круглой «+» (стиль Big Boss) — все экраны ===== */
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.pc-price { font-size: 1.05rem; font-weight: 800; color: var(--color-dark); line-height: 1.1; }
.pc-old { font-size: .8rem; color: var(--color-text-light); text-decoration: line-through; margin-left: 5px; font-weight: 500; }
.pc-add {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--color-surface-2); color: var(--color-dark);
  font-size: 24px; font-weight: 400; line-height: 1;
  display: flex; align-items: center; justify-content: center; border: none;
  transition: transform .12s, background .12s, color .12s;
}
.pc-add:hover { background: var(--color-primary); color: #fff; }
.pc-add:active { transform: scale(.9); background: var(--color-primary); color: #fff; }

/* ===== Плавающая кнопка «наверх» (стиль Big Boss) ===== */
.scrolltop-btn {
  position: fixed; right: 16px; z-index: 150;
  bottom: calc(var(--app-tabbar-h, 64px) + env(safe-area-inset-bottom, 0px) + 16px);
  width: 48px; height: 48px; border-radius: 50%;
  background: #fff; color: var(--color-dark);
  box-shadow: 0 4px 20px rgba(0,0,0,.15), 0 1px 4px rgba(0,0,0,.1);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  border: none; opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: opacity .25s, transform .25s;
}
.scrolltop-btn.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
@media (min-width: 769px) { .scrolltop-btn { bottom: 24px; } }

/* ===== Лист блюда (bottom-sheet, стиль Big Boss) ===== */
@keyframes dishSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.dish-sheet-bg { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; }
.dish-sheet { background: #fff; width: 100%; max-width: 520px; margin: 0 auto; border-radius: 22px 22px 0 0; max-height: 92vh; overflow-y: auto; position: relative; animation: dishSheetUp .3s cubic-bezier(.32,.72,0,1); }
.dish-sheet__grab { width: 36px; height: 4px; background: #C7C7CC; border-radius: 100px; margin: 12px auto 0; }
.dish-sheet__close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; font-size: 18px; display: flex; align-items: center; justify-content: center; border: none; }
.dish-sheet__foot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--color-border); padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }

/* ===== Скроллящиеся табы (организация/поиск) — чтобы влезали на узких экранах ===== */
.tabs { overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab { white-space: nowrap; flex: 0 0 auto; }
#shop-tabs { gap: 4px; }
#shop-tabs .tab { padding: 10px 14px; font-weight: 600; }
#shop-tabs .tab [data-c]:empty { display: none; }

/* ===== Красивый чат по заказу (сайт) ===== */
.order-chat {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 360px; overflow-y: auto; padding: 14px;
  background: var(--color-bg); border-radius: 16px; margin-top: 4px;
  scroll-behavior: smooth;
}
.chat-msg {
  max-width: 80%; padding: 9px 13px; border-radius: 16px;
  font-size: 14px; line-height: 1.38; word-break: break-word;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); position: relative;
}
.chat-msg.mine { align-self: flex-end; background: var(--color-primary); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.theirs { align-self: flex-start; background: var(--color-surface); color: var(--color-text); border-bottom-left-radius: 5px; }
.chat-msg + .chat-msg.same { margin-top: -3px; }
.chat-msg__name { font-size: .72rem; font-weight: 700; color: var(--color-primary); margin-bottom: 2px; }
.chat-msg__time { font-size: .64rem; opacity: .65; margin-top: 3px; text-align: right; }
.chat-day { align-self: center; font-size: .7rem; color: var(--color-text-muted); background: var(--color-surface-2); padding: 3px 12px; border-radius: 999px; margin: 6px 0; }
.chat-empty { text-align: center; color: var(--color-text-muted); padding: 28px 8px; font-size: 13px; }
.chat-empty i { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }
.chat-bar { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.chat-bar .input { border-radius: 999px; }
.chat-send-btn { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; padding: 0; }
