/* Оптовой — адаптив всех страниц (подключать последним) */

@media (max-width: 768px) {
  :root {
    --om-container: min(1280px, calc(100% - 32px));
  }
}

@media (max-width: 480px) {
  :root {
    --om-container: min(1280px, calc(100% - 24px));
  }
}

/* ——— Мобильное меню ——— */
.om-header__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: var(--om-surface);
  cursor: pointer;
  flex-shrink: 0;
}
.om-header__burger span {
  display: block;
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--om-text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.om-header__burger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.om-header__burger.is-open span:nth-child(2) {
  opacity: 0;
}
.om-header__burger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.om-mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.om-mobile-drawer.is-open {
  pointer-events: auto;
}
.om-mobile-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.25s;
}
.om-mobile-drawer.is-open .om-mobile-drawer__backdrop {
  opacity: 1;
}
.om-mobile-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(320px, 88vw);
  height: 100%;
  background: #fff;
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  overflow-y: auto;
}
.om-mobile-drawer.is-open .om-mobile-drawer__panel {
  transform: translateX(0);
}
.om-mobile-drawer__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 20px;
}
.om-mobile-drawer__nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--om-text);
}
.om-mobile-drawer__nav a:hover {
  background: var(--om-surface);
}
.om-mobile-drawer__auth {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--om-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.om-mobile-drawer__user {
  font-size: 14px;
  font-weight: 600;
  color: var(--om-text);
  padding: 0 4px 8px;
}
.om-mobile-drawer__auth .om-btn {
  width: 100%;
}
.om-mobile-drawer__auth button.om-header__login,
.om-mobile-drawer__auth .om-btn {
  width: 100%;
}

body.om-scroll-lock {
  overflow: hidden;
}

@media (max-width: 1024px) {
  .om-catalog-btn__text {
    display: none;
  }
  .om-catalog-btn {
    padding: 10px 12px;
  }
}

@media (max-width: 768px) {
  .om-header__inner {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 10px 0;
  }
  .om-header__burger {
    display: flex;
    order: 4;
  }
  .om-header__tools {
    order: 3;
    margin-left: auto;
  }
  .om-logo {
    order: 1;
  }
  .om-logo__img {
    height: 32px;
  }
  .om-catalog-btn {
    order: 2;
  }
  .om-header__search-zone {
    order: 5;
    flex: 1 1 100%;
    width: 100%;
  }
  .om-search {
    flex: 1 1 100%;
    width: 100%;
  }
  .om-header__nav,
  .om-header__auth {
    display: none !important;
  }
  .om-header__register {
    display: none;
  }
  .om-header__user {
    max-width: 100px;
  }
}

@media (max-width: 480px) {
  .om-header__tool {
    width: 36px;
    height: 36px;
  }
}

@media (min-width: 769px) {
  .om-filters.om-filters--drawer {
    position: static;
    transform: none !important;
    width: auto;
    height: auto;
    padding: 0;
    box-shadow: none;
    overflow: visible;
  }
  .om-filters-backdrop {
    display: none !important;
  }
}

/* ——— Каталог: фильтры-drawer ——— */
.om-filters-toggle {
  display: none;
  margin-bottom: 12px;
}

.om-filters-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 23, 42, 0.45);
}

@media (max-width: 768px) {
  .om-filters-toggle {
    display: inline-flex;
  }
  .om-catalog__main {
    min-width: 0;
  }
  .om-catalog-toolbar {
    flex-wrap: wrap;
    gap: 10px;
  }
  .om-catalog-toolbar__left,
  .om-catalog-toolbar__right {
    flex: 1 1 100%;
  }
  .om-filters.om-filters--drawer {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 160;
    width: min(320px, 90vw);
    height: 100%;
    margin: 0;
    padding: 20px 16px;
    background: #fff;
    box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
  }
  .om-filters.om-filters--drawer.is-open {
    transform: translateX(0);
  }
  .om-filters.om-filters--drawer {
    display: flex;
    flex-direction: column;
  }
  .om-filters__close {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    width: 36px;
    height: 36px;
    margin-left: auto;
    margin-bottom: 12px;
    border: none;
    border-radius: 8px;
    background: var(--om-surface);
    font-size: 20px;
    cursor: pointer;
  }
  .om-filters-backdrop.is-open {
    display: block;
  }
}

@media (min-width: 769px) {
  .om-filters__close {
    display: none;
  }
}

@media (max-width: 480px) {
  .om-catalog-grid:not(.om-catalog-grid--list) {
    grid-template-columns: 1fr !important;
  }
}

/* ——— Таблицы → карточки ——— */
@media (max-width: 768px) {
  .om-cab-table-wrap--responsive {
    overflow: visible;
  }
  .om-cab-table--responsive thead {
    display: none;
  }
  .om-cab-table--responsive tbody tr {
    display: block;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid var(--om-border);
    border-radius: var(--om-radius);
  }
  .om-cab-table--responsive tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border: none;
    font-size: 14px;
    text-align: right;
  }
  .om-cab-table--responsive tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--om-muted);
    font-size: 12px;
    text-align: left;
    flex-shrink: 0;
    max-width: 45%;
  }
  .om-cab-table--responsive tbody td.om-cab-table__actions,
  .om-cab-table--responsive tbody td.om-order-row__actions {
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--om-border);
    margin-top: 4px;
  }
  .om-cab-table--responsive tbody td.om-cab-table__actions::before,
  .om-cab-table--responsive tbody td.om-order-row__actions::before {
    display: none;
  }
  .om-cab-table--responsive tfoot {
    display: block;
    margin-top: 8px;
  }
  .om-cab-table--responsive tfoot tr {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--om-surface);
    border-radius: var(--om-radius);
  }
  .om-cab-table--responsive tfoot td {
    border: none;
    padding: 0;
  }
  .om-order-item {
    flex-wrap: wrap;
  }
  .om-order-item__img {
    width: 48px;
    height: 48px;
  }
}

/* ——— Кабинет: горизонтальная навигация ——— */
@media (max-width: 768px) {
  .om-cabinet {
    gap: 16px;
  }
  .om-cabinet-side {
    padding: 0;
    background: transparent;
    border: none;
  }
  .om-cabinet-side__user,
  .om-cabinet-side__footer {
    display: none;
  }
  .om-cabinet-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .om-cabinet-nav::-webkit-scrollbar {
    display: none;
  }
  .om-cabinet-nav__btn {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 13px;
  }
  .om-cabinet-nav__btn svg {
    width: 16px;
    height: 16px;
  }
  .om-cabinet-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .om-cabinet-head__title {
    font-size: 22px;
  }
  .om-cabinet-head__actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .om-cabinet-head__actions .om-btn {
    flex: 1 1 auto;
  }
}

/* ——— Чат ——— */
.om-chat__back {
  display: none;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  padding: 0;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--om-blue);
  cursor: pointer;
}

@media (max-width: 768px) {
  .om-chat {
    min-height: 0 !important;
  }
  .om-chat__back {
    display: inline-flex;
  }
  .om-chat__room-head {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .om-chat.om-chat--show-thread .om-chat__list {
    display: none;
  }
  .om-chat:not(.om-chat--show-thread) .om-chat__room {
    display: none;
  }
  .om-chat__list {
    max-height: none;
  }
  .om-ticket-layout .om-ticket-list-card {
    max-height: none;
  }
}

/* ——— Товар ——— */
@media (max-width: 768px) {
  .om-pinfo__actions {
    flex-direction: column;
  }
  .om-pinfo__actions .om-btn,
  .om-pinfo__actions .om-inline-form {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
  .om-pinfo__actions .om-btn {
    white-space: normal;
  }
  .om-pinfo__title {
    font-size: 22px;
  }
  .om-specs--responsive thead {
    display: none;
  }
  .om-specs--responsive tr {
    display: block;
    border-bottom: 1px solid var(--om-border);
    padding: 10px 0;
  }
  .om-specs--responsive th,
  .om-specs--responsive td {
    display: block;
    width: 100%;
    padding: 4px 0;
    border: none;
    background: transparent;
  }
  .om-specs--responsive th {
    font-size: 12px;
    margin-bottom: 2px;
  }
}

@media (max-width: 480px) {
  .om-products__grid--related {
    grid-template-columns: 1fr !important;
  }
  .om-fav-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ——— Commerce ——— */
@media (max-width: 768px) {
  .om-commerce-head__title,
  .om-order-head__title {
    font-size: 22px;
  }
  .om-order-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .om-order-head__actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .om-cart-item {
    grid-template-columns: 72px 1fr;
    gap: 12px;
  }
  .om-checkout-grid {
    gap: 20px;
  }
  .om-compare-wrap {
    margin: 0 -4px;
  }
  .om-compare-table {
    min-width: 520px;
  }
}

/* ——— Формы кабинета ——— */
@media (max-width: 768px) {
  .om-cab-repeater__row {
    grid-template-columns: 1fr !important;
    gap: 8px;
  }
  .om-cab-repeater__remove {
    justify-self: start;
  }
  .om-cab-ptabs__nav {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
  }
  .om-cab-ptabs__nav::-webkit-scrollbar {
    display: none;
  }
  .om-moderation-dl {
    grid-template-columns: 1fr !important;
    gap: 4px;
  }
  .om-moderation-dl dt {
    margin-top: 12px;
  }
  .om-quote-offer__hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .om-quote-offer__stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .om-quote-offer__stats {
    grid-template-columns: 1fr;
  }
}

/* ——— Модалки ——— */
@media (max-width: 768px) {
  .om-modal__box {
    width: calc(100% - 24px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
  .om-order-ratings__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .om-modal__box {
    width: calc(100% - 16px);
    padding: 16px;
  }
  .om-page-head {
    padding: 20px 0 16px;
  }
  .om-page-head__title {
    font-size: 24px;
  }
}

/* ——— Поставщик ——— */
@media (max-width: 768px) {
  .om-import-panel__grid {
    grid-template-columns: 1fr;
  }
  .om-moderation-bulk-bar,
  .om-products-bulk-bar {
    margin-left: 12px;
    margin-right: 12px;
  }
  .om-products-bulk-bar__field {
    min-width: 100%;
  }
  .om-pagination-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  .om-pagination {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .om-supplier-stats {
    grid-template-columns: 1fr !important;
  }
  .om-supplier-products .om-products__grid {
    grid-template-columns: 1fr !important;
  }
}

/* ——— Auth ——— */
@media (max-width: 768px) {
  .om-auth-tabs {
    flex-direction: column;
  }
  .om-auth-card {
    padding: 24px 20px;
  }
}
