/* ================================
   АДАПТИВНЫЙ CSS ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ
   ================================ */

/* Основные стили для мобильных */
@media (max-width: 768px) {
  /* Резиновый контейнер */
  #container {
    width: 100% !important;
    max-width: 100%;
    min-width: auto;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 5px;
  }

  /* Адаптация таблиц */
  .table-wrapper {
    overflow-x: auto;
    width: 100%;
    margin: 10px 0;
  }

  table.w1000,
  table.w920 {
    width: 100% !important;
    min-width: auto;
  }

  td.w850,
  td.w150,
  td.w190,
  td.w70 {
    width: 100% !important;
    display: block;
    text-align: center;
  }

  /* Адаптация w500 */
  .w500 {
    width: 50% !important;
  }

  /* Скрытие элементов */
  .w150.h-38.ta_r.va_m.bb {
    display: none !important;
  }

  .cat_rekl {
    display: none !important;
  }

  /* Адаптация галереи - 2 элемента в ряд, но не для ta_c va_m pt10 */
  .ta_c.va_m.pt5.pb20 .w145h130b0 {
    width: calc(50% - 10px) !important;
    height: auto;
    margin: 5px;
    box-sizing: border-box;
    display: inline-block;
    vertical-align: top;
  }

  .ta_c.va_m.pt5.pb20 .w145h130b0 img {
    width: 100%;
    height: auto;
  }

  /* Исключаем ta_c va_m pt10 из изменений */
  .ta_c.va_m.pt10 .w145h130b0,
  .ta_c.va_m.pt5.pb20 .w145h130b0 {
    width: 100% !important;
    height: auto !important;
    margin: 5px;
    display: inline-block;
  }

  .ta_c.va_m.pt10,
  .ta_c.va_m.pt5.pb20 {
    display: flex;
    flex-wrap: wrap;
  }

  .ta_c.va_m.pt10 .gallery,
  .ta_c.va_m.pt5.pb20 .gallery {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 5px;
    box-sizing: border-box;
  }

  .ya-share2__container {
    text-align: center !important;
  }

  /* Адаптивное меню в Header - последняя таблица */
  #Header > table.w1000:last-child {
    width: 100% !important;
    background: #f1f1f1;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  }

  #Header > table.w1000:last-child tr:nth-child(2) {
    display: block;
    width: 100%;
    position: absolute;
    top: 150px;
  }

  #Header > table.w1000:last-child tr:nth-child(2) td {
    display: block;
    width: 100% !important;
    text-align: center;
    padding: 5px 0;
  }

  /* Адаптация меню coolMenu */
  #coolMenu {
    display: block;
    width: 100%;
    float: none;
    background: #f1f1f1;
    border-radius: 5px;
    padding: 5px 0;
    text-align: left;
  }

  #coolMenu > li {
    float: none;
    display: block;
    margin: 0;
    width: 100%;
  }

  #coolMenu li a,
  #coolMenu li span {
    display: block;
    padding: 12px 15px;
    border-right: none;
    border-bottom: 1px solid #ddd;
    text-align: left;
    background: none;
    color: #069;
    font-size: 14px;
    text-decoration: none;
  }

  #coolMenu li:last-child a {
    border-bottom: none;
  }

  #coolMenu > li:hover > a,
  #coolMenu > li:hover > span {
    background: #e0e0e0;
    color: #da251d;
  }

  #coolMenu ul {
    position: static;
    display: none;
    width: 100%;
  }

  #coolMenu li:hover ul.noJS {
    display: block;
  }

  /* Адаптация заголовков */
  h1 {
    font-size: 20px;
    line-height: 1.3;
    padding: 10px 0;
  }

  h2 {
    font-size: 18px;
    line-height: 1.3;
  }

  /* Адаптация текста */
  body {
    font-size: 12px;
    line-height: 1.5;
  }

  .kl,
  .nav1,
  td.nav {
    font-size: 11px;
  }

  .body,
  .body_nodecor,
  td.body {
    font-size: 12px;
    text-align: justify;
  }

  /* Адаптация отступов */
  .pt10 { padding-top: 5px !important; }
  .pb10 { padding-bottom: 5px !important; }
  .pt20 { padding-top: 10px !important; }
  .pb20 { padding-bottom: 10px !important; }
  .pl30 { padding-left: 15px !important; }
  .ti30 { text-indent: 15px !important; }

  /* Адаптация изображений */
  img {
    max-width: 100%;
    height: auto;
  }

  .header-img-logo,
  .header-img-tel,
  .header-img-metronic,
  .header-img-znak {
    max-width: 100%;
    height: auto;
    margin: 5px auto;
    display: block;
  }

  /* Адаптация карточек товаров */
  .cat_blue,
  .cat_brown {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .cat_blue a,
  .cat_brown a {
    width: calc(50% - 20px) !important;
    height: auto !important;
    min-height: 120px;
    margin: 5px !important;
    padding: 10px !important;
    box-sizing: border-box;
    font-size: 11px;
  }

  .cat2_brown {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .cat2_brown a {
    width: calc(50% - 20px) !important;
    height: auto !important;
    min-height: 110px;
    margin: 5px !important;
    padding: 10px !important;
    box-sizing: border-box;
    font-size: 11px;
  }

  /* Адаптация аккордеона */
  .accordion {
    width: 100%;
    margin: 10px 0 !important;
  }

  .accordion h6 {
    font-size: 14px;
    padding: 10px 15px;
    height: auto;
    line-height: 1.4;
  }

  /* Адаптация футера */
  #Footer table.w1000 td {
    display: block;
    width: 100% !important;
    text-align: center;
    padding: 10px 0;
  }

  .ya-share2 {
    text-align: center;
    margin: 10px 0;
  }

  /* Скрытие декоративных элементов */
  .desktop-only {
    display: none !important;
  }

  /* Адаптация галереи - 2 элемента в ряд только для pt5.pb20 */
  .ta_c.va_m.pt5.pb20 {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Адаптация футера */
  #Footer table.w1000 td {
    display: block;
    width: 100% !important;
    text-align: center;
    padding: 10px 0;
  }

  .ya-share2 {
    text-align: center;
    margin: 10px 0;
  }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
  .cat_blue a,
  .cat_brown a,
  .cat2_brown a {
    width: calc(100% - 20px) !important;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 16px;
  }

  /* Упрощение навигации */
  #coolMenu li a,
  #coolMenu li span {
    padding: 15px;
    font-size: 13px;
  }

  /* Адаптация контактной информации */
  .vcard {
    font-size: 11px;
  }

  .adr span {
    display: block;
    margin: 2px 0;
  }
}

/* Для планшетов в альбомной ориентации */
@media (min-width: 769px) and (max-width: 1024px) {
  #container {
    width: 95% !important;
    margin: 10px auto;
  }

  .cat_blue a,
  .cat_brown a {
    width: calc(33.333% - 20px) !important;
  }

  .cat2_brown a {
    width: calc(33.333% - 20px) !important;
  }
}

/* Общие улучшения для всех устройств */
img {
  max-width: 100%;
  height: auto;
}

a {
  word-wrap: break-word;
}

/* Улучшение читаемости на мобильных */
@media (max-width: 768px) {
  p, div {
    text-align: left !important;
  }

  .ti15, .ti30, .ti45 {
    text-indent: 10px !important;
  }

  /* Адаптация кнопок */
  input[type=button],
  input[type=submit],
  button {
    width: 100%;
    margin: 5px 0;
    padding: 12px;
    font-size: 14px;
  }

  /* Адаптация форм */
  input[type=date],
  input[type=number],
  input[type=password],
  input[type=text],
  select,
  textarea {
    width: 100%;
    margin: 5px 0;
    padding: 10px;
    font-size: 14px;
    box-sizing: border-box;
  }
}

/* Фикс для старых браузеров */
* {
  box-sizing: border-box;
}

/* Улучшение сенсорных целей */
@media (max-width: 768px) {
  a,
  button,
  input[type=button],
  input[type=submit] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Адаптация для печати */
@media print {
  #container {
    width: 100% !important;
    max-width: 100%;
    border: none;
    box-shadow: none;
  }

  #coolMenu,
  #toTop,
  .banners {
    display: none !important;
  }
  
  #Header > table.w1000:last-child {
    position: static !important;
  }
}
