/* ============================================================================
   DSH: мобильная адаптация plat-forma.com  (mobile.css)
   Подключается последним в <head> после unifit.css/styles.css, поэтому
   перекрывает правила темы. Все правки — только внутри @media (max-width:767px),
   десктопная вёрстка не затрагивается.

   Разделы:
     1. База и типографика
     2. Шапка и верхняя панель (тап-таргеты, компактность)
     3. cookie-баннер
     4. Фильтры в листинге (сворачивание, кнопка «Фильтры»)
     5. Карточки товаров в листинге
     6. Страница товара (цена, «В корзину», характеристики)
     7. Формы
     8. Текстовые страницы, футер, мелочи
   ========================================================================== */

@media (max-width: 767px) {

  /* ------------------------------------------------------------ 1. База --- */
  html { -webkit-text-size-adjust: 100%; }
  body { overflow-x: hidden; }
  img, video, svg, iframe { max-width: 100%; }
  /* длинные артикулы и ссылки не должны растягивать страницу */
  .editor, .editor p, .editor li, .product-card, .product-link, .breadcrumbs,
  .footer, .container, .row { overflow-wrap: break-word; word-break: break-word; }

  h1, .main__title { font-size: 22px !important; line-height: 1.28 !important; }
  h2 { font-size: 19px !important; line-height: 1.3 !important; }
  h3 { font-size: 17px !important; line-height: 1.32 !important; }
  h4, h5 { font-size: 15px !important; }

  /* хлебные крошки: компактнее и с переносом, с площадкой для пальца */
  .breadcrumbs, .breadcrumb-item {
    font-size: 12.5px !important; line-height: 1.35 !important;
  }
  .breadcrumb-link { display: inline-block; padding: 9px 0; font-size: 12.5px !important; }
  /* «мелкий» текст темы (small = 0.8em) поднимаем до читаемых 12px */
  small { font-size: 12px !important; }

  /* ---------------------------------------------------- 2. Шапка сайта --- */
  /* верхняя мобильная панель: меньше отступов, крупные иконки-кнопки */
  .top_header__select { padding: 6px 10px 0 !important; }
  .mobile_top_wrap {
    height: auto !important;
    gap: 10px !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    padding-bottom: 6px !important;
  }
  .mobile_top_wrap .phone.phone_mobile { font-size: 16px; }
  .mobile_top_wrap .phone.phone_mobile .contact-link.tel { font-size: 17px !important; }
  .mobile_top_wrap .search_div_mobile { top: auto !important; height: auto !important; }
  .mobile_top_wrap .search_div_mobile img { width: 24px; height: 24px; }

  /* тап-таргеты не меньше 44x44 (Apple/Google HIG) */
  .tpl-link-favorite {
    width: 44px !important; height: 44px !important;
    min-width: 44px !important; min-height: 44px !important;
    padding: 0 !important;
  }
  .tpl-link-favorite .fa { font-size: 20px; }
  /* ВАЖНО: кнопкам-иконкам в шапке нельзя менять display — иконка-бургер
     отрисовывается через ::before { content: url(...) } и в flex-контейнере
     сжимается в 0px. Меняем только минимальные размеры. */
  .top-panel-open-sidebar, .top-panel-open-search, .top-panel-curt-sidebar {
    min-width: 44px; min-height: 44px;
  }
  .top-panel-open-sidebar::before, .top-panel-open-search::before { font-size: 1.5rem; }
  .search_div_mobile a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
  }
  .shopcart-widget-link { min-height: 44px; display: inline-flex; align-items: center; }

  /* блок быстрых действий: две компактные кнопки в ряд вместо трёх «полотенец» */
  .TopPanelDesctop { max-width: 100% !important; }
  .lower_header {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 6px !important;
    align-items: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .lower_header .new_button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 8px 6px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    /* ключевое: без этого nowrap-текст растягивает страницу на узких экранах */
    white-space: normal !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-align: center;
    box-sizing: border-box;
    min-height: 40px;
  }
  .lower_header .new_button:last-of-type { grid-column: 1 / -1; }
  /* телефон уже показан в мобильной строке выше — не дублируем */
  .lower_header .phone.phone_desktop { display: none !important; }
  .top-panel-wrapper > div { padding-bottom: 8px !important; }
  .new_header { padding: 4px 10px 0 !important; }

  /* ------------------------------------------------ 3. cookie-баннер --- */
  .cookie-popup {
    left: 8px !important;
    right: 8px !important;
    bottom: 8px !important;
    width: auto !important;
    max-width: none !important;
    padding: 12px 14px !important;
    border-width: 2px !important;
    border-radius: 12px !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    max-height: 55vh;
    overflow-y: auto;
  }
  .cookie-popup p { margin: 0 !important; font-size: 13px !important; line-height: 1.45 !important; }
  .cookie-buttons {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
    margin-top: 10px !important;
  }
  .cookie-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    padding: 10px 6px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
    min-height: 44px;
  }

  /* ------------------------------------------- 4. Фильтры в листинге --- */
  .pf-filter-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 46px;
    margin: 0 0 10px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #dcdbe2;
    border-radius: 8px;
    color: #26863c;
    font: 600 15px/1.2 Calibri, Arial, sans-serif;
    cursor: pointer;
  }
  .pf-filter-toggle .pf-filter-toggle__icon {
    transition: transform .15s ease-out;
    font-size: 12px;
  }
  .pf-filter-toggle.is-open .pf-filter-toggle__icon { transform: rotate(180deg); }
  .p53_filter-wrapper.pf-filter-collapsed:not(.pf-filter-open) .p53_filter-list { display: none !important; }
  .p53_filter-wrapper.pf-filter-collapsed.pf-filter-open {
    border-bottom: 1px solid #ececec;
    margin-bottom: 10px;
    padding-bottom: 6px;
  }
  .p53_filter-list h5 { margin: 12px 0 6px !important; font-size: 14px !important; }
  /* ссылки-фильтры: крупнее для пальца */
  .p53_filter-list .p53_filter-link, .p53_filter-list .cp_link, .p53_filter-list .bk {
    min-height: 40px !important;
    display: flex !important;
    align-items: center;
    font-size: 14px !important;
  }

  /* --------------------------------------- 5. Карточки товаров в списке --- */
  /* на мобильном карточка раньше была фиксированной высоты 150px и текст из неё вылезал */
  .product-card {
    height: auto !important;
    min-height: 0 !important;
    margin-bottom: 12px !important;
    padding: 10px !important;
  }
  .product-card-wrapper { max-width: 100% !important; padding: 0 !important; }
  .product-card .div_img,
  .product-card.p-first .div_img,
  .product-card.p-second .div_img {
    width: 96px !important;
    height: 96px !important;
    float: none !important;
  }
  .product-card img.product-card-image,
  .product-card .img_div_img {
    width: 100% !important;
    max-width: 96px !important;
    max-height: 96px !important;
    height: auto !important;
  }
  .product-card .variants { gap: 8px !important; align-items: flex-start; }
  /* font-size:80% из инлайнового стиля давал 11.2px — поднимаем до читаемых 13px */
  .product-card .ex_container-fluid {
    font-size: 13px !important;
    line-height: 1.45 !important;
    padding-left: 0 !important;
    min-width: 0;
    flex: 1 1 auto;
  }
  .product-card a.cp_link, .product-card .product-link { font-size: 14px !important; line-height: 1.3 !important; }
  .product-card .product-card-props p,
  .product-card .product-card-props div { font-size: 13px !important; line-height: 1.4 !important; }
  .product-card .product-card-props p { padding-right: 0 !important; }
  .product-card .Price, .product-card .price { font-size: 15px !important; font-weight: 700; }
  .product-card .AddToCart button, .product-card .varToCart {
    min-height: 40px; font-size: 13px; padding: 6px 10px;
  }
  /* В шаблоне у ссылки-картинки стоит height:0!important — картинка вылезает из
     нулевой ссылки. Возвращаем нормальную кликабельную площадку. */
  .product-card a.image-container { height: auto !important; min-height: 96px; }

  /* --------------------------------------------- 6. Страница товара --- */
  .side_links_container { max-width: 100% !important; padding: 0 12px 20px !important; }
  .side_links_container > div { max-width: 100% !important; flex-wrap: wrap; }
  .slick-list { overflow: hidden; }
  .orange.vopros, .orange.radprodaza { font-size: 22px !important; }
  .price, .Price { font-size: 20px !important; }
  /* блок «В корзину»: инлайновый left:-28px ломал положение кнопки */
  .quantity-input {
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: wrap;
  }
  .quantity-field {
    width: 76px !important;
    min-height: 44px;
    font-size: 16px !important;
  }
  .new_AddToCart, #new_AddToCart {
    left: 0 !important;
    margin: 0 !important;
    min-height: 46px;
    padding: 0 18px !important;
    font-size: 14px !important;
    line-height: 46px !important;
    flex: 1 1 auto;
  }
  /* характеристики товара: читаемый размер */
  .product-content, .product-content p, .product-content div, .Property, .property {
    font-size: 14px !important;
    line-height: 1.5 !important;
  }
  .product-table, table.product-table { width: 100% !important; }
  table.product-table th, table.product-table td { font-size: 13px !important; padding: 6px 4px !important; }

  /* ------------------------------------------------------ 7. Формы --- */
  input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
  input[type="number"], input[type="search"], select, textarea {
    font-size: 16px !important; /* iOS не зумит страницу при фокусе */
    max-width: 100%;
  }
  input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
  input[type="number"], input[type="search"], select {
    min-height: 44px;
  }
  textarea { min-height: 96px; }
  input[type="submit"], button[type="submit"], .button {
    min-height: 46px;
  }
  label, .custom-checkbox, .checkbox { line-height: 1.4; }
  /* чекбоксы/радио — удобный размер для пальца */
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }

  /* ------------------------------- 8. Текстовые страницы и футер --- */
  .editor > p, .editor > ul, .editor > ol, .editor > div > p { font-size: 15px !important; line-height: 1.6 !important; }
  .footer { padding-top: 16px; }
  .footer-menu-item, .footer-menu-link { font-size: 14px !important; line-height: 1.4; }
  .footer-menu-link {
    display: flex !important; align-items: center;
    min-height: 40px; padding: 6px 0 !important;
  }
  /* телефон в мобильной строке — площадка для пальца */
  .phone_mobile .contact-link.tel {
    display: inline-flex !important; align-items: center; min-height: 40px;
  }
  /* «Развернуть фильтр» на карте магазинов */
  .filter-toggle-link {
    display: inline-flex !important; align-items: center;
    min-height: 44px; padding: 10px 0 !important;
  }
  /* чекбоксы форм: маркер под размер отпечатка */
  .form-toggle-marker { width: 20px !important; height: 20px !important; }
  .zchbLogoText { font-size: 11px !important; }

  /* ------------------- 9. Ссылки-строки: плитки, справочник, пагинация --- */
  /* название бренда/раздела внутри плитки — свой tap-target */
  .category-subcollection .tab_brend a,
  .category-subcollection .category-caption a {
    display: inline-flex !important; align-items: center; min-height: 40px;
  }
  .pagination-item {
    display: inline-flex !important; align-items: center; justify-content: center;
    min-width: 40px; min-height: 40px; padding: 0 8px !important;
  }
  /* чекбоксы-фильтры и табы в карточке товара */
  .custom-checkbox.bk.cp_link, .tab-toggle {
    display: inline-flex !important; align-items: center; min-height: 40px;
  }
  /* телефон в подвале и карточках */
  .contact-link.tel { display: inline-flex !important; align-items: center; min-height: 36px; }
}

/* ------------------------------- очень узкие экраны (320–400px) --- */
@media (max-width: 400px) {
  .lower_header .new_button { font-size: 12px !important; padding: 7px 4px !important; }
  .mobile_top_wrap .phone.phone_mobile .contact-link.tel { font-size: 15px !important; }
  h1, .main__title { font-size: 20px !important; }
  .product-card .div_img,
  .product-card.p-first .div_img,
  .product-card.p-second .div_img { width: 84px !important; height: 84px !important; }
  .product-card img.product-card-image, .product-card .img_div_img { max-width: 84px !important; max-height: 84px !important; }
  .product-card .ex_container-fluid { font-size: 12.5px !important; }
}
