/* build:202606270806 */
/**
 * Мобильная вёрстка (телефоны и узкие планшеты ≤960px).
 * Подключается после steam-theme.css.
 */

@media (max-width: 960px) {
  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden;
  }

  body.nav-open {
    overflow: hidden;
    touch-action: none;
  }

  .app {
    display: block;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    min-height: 100vh;
  }

  .main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    padding: calc(52px + env(safe-area-inset-top, 0px) + 12px) 12px calc(88px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    z-index: 300;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .nav-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface2);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 301;
  }

  .mobile-topbar-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0, 0, 0, 0.62);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
  }

  .app.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 92vw);
    max-width: 92vw;
    height: 100vh;
    height: 100dvh;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translate3d(-110%, 0, 0) !important;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 280;
    box-shadow: 12px 0 48px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    overflow: hidden;
    visibility: hidden;
  }

  .app.sidebar-open .sidebar {
    transform: translate3d(0, 0, 0) !important;
    pointer-events: auto;
    visibility: visible;
    /* Логотип ниже фиксированной шапки с бургером */
    padding-top: calc(52px + env(safe-area-inset-top, 0px));
    z-index: 290;
  }

  .app.sidebar-open .mobile-topbar {
    z-index: 300;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
  }

  .brand-logo-wordmark {
    padding: 8px 14px 12px !important;
  }

  .logo-img-wordmark {
    max-width: 140px;
    max-height: 90px;
  }

  .nav-item {
    min-height: 44px;
    padding: 12px 16px !important;
    font-size: 14px !important;
    touch-action: manipulation;
  }

  .nav-theme-row {
    min-height: 44px;
    padding: 12px 16px !important;
  }

  .nav-theme-label {
    flex: 1;
  }

  .theme-switch--nav {
    margin-left: auto;
  }

  .nav-icon {
    font-size: 18px;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-title {
    font-size: 20px;
  }

  .page-header .search-box,
  .page-header .btn,
  .page-header > div:last-child {
    width: 100%;
    max-width: none;
  }

  .search-box {
    max-width: none !important;
    width: 100%;
    font-size: 16px;
    padding: 10px 14px;
  }

  .catalog-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .catalog-meta {
    min-width: 0;
    font-size: 12px;
    line-height: 1.4;
  }

  .catalog-page-size-label {
    width: 100%;
    justify-content: space-between;
  }

  .catalog-page-size-select {
    flex: 1;
    max-width: 120px;
  }

  .catalog-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-height: none;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .catalog-filter-chips::-webkit-scrollbar {
    display: none;
  }

  .catalog-filter-chips.is-expanded {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    -webkit-overflow-scrolling: touch;
  }

  .filter-chip,
  .filter-row .btn {
    flex-shrink: 0;
    min-height: 36px;
  }

  .product-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .product-card {
    flex-direction: row;
    align-items: stretch;
  }

  .product-card .product-img {
    width: 108px;
    min-width: 108px;
    aspect-ratio: 1;
    flex-shrink: 0;
    font-size: 36px;
  }

  .product-card .product-info {
    flex: 1;
    min-width: 0;
    padding: 12px 10px 8px !important;
  }

  .product-card .product-name,
  .product-card .product-brand,
  .product-card .product-variant {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .product-card-qty {
    width: 120px;
    min-width: 120px;
    flex-shrink: 0;
    border-top: none;
    border-left: 1px solid var(--border);
    flex-direction: column;
    justify-content: center;
    padding: 8px;
  }

  .order-bar {
    left: 0 !important;
    right: 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
    gap: 10px;
  }

  .order-bar.visible {
    display: flex;
  }

  .theme-switch:not(.theme-switch--nav) {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    right: 14px;
    z-index: 90;
  }

  body:has(.order-bar.visible) .theme-switch:not(.theme-switch--nav) {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .card {
    padding: 16px;
  }

  .stats-row,
  .grid-2,
  .grid-2-wide {
    grid-template-columns: 1fr !important;
  }

  .modal {
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    margin: 12px;
    padding: 20px 16px;
    max-height: calc(100dvh - 24px);
  }

  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .batch-list-item,
  .admin-bulk-bar {
    flex-wrap: wrap;
  }

  .table {
    font-size: 12px;
  }

  .sidebar-bottom {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}

/* Узкие телефоны: одна колонка, компактнее */
@media (max-width: 400px) {
  .main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .product-card .product-img {
    width: 96px;
    min-width: 96px;
  }

  .product-card-qty {
    width: 64px;
    min-width: 64px;
    padding: 4px 2px;
  }

  .product-card-qty .qty-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
}

/* Планшет в портрете: 2 колонки каталога */
@media (min-width: 600px) and (max-width: 960px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

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

  .product-card .product-img {
    width: 100%;
    min-width: 0;
  }

  .product-card-qty {
    width: 100%;
    min-width: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    flex-direction: row;
  }
}
