/* ==========================================
   Адаптивный дизайн для amadey.ru
   ========================================== */

/* ---------- Планшет (≤1024px) ---------- */
@media screen and (max-width: 1024px) {
  .centernav {
    margin-left: 10px !important;
  }

  .rightbase {
    margin-left: 20px !important;
  }

  #CenterCell {
    margin-left: 10px !important;
  }

  body > div > table[bgcolor="#6F2B16"] > tbody > tr > td {
    display: inline-block;
    width: 45%;
    vertical-align: top;
    padding: 10px;
  }

  div[style*="width:1000px"] {
    width: auto !important;
    right: 5px !important;
  }

  .divan {
    font-size: 11px;
  }

  .title {
    left: 10px !important;
    width: auto !important;
    max-width: 500px;
  }

  .tel {
    font-size: 18px !important;
  }

  .iFrame1 {
    width: 30% !important;
    margin: 1.5% !important;
  }

  .sortnav {
    margin-left: 10px !important;
  }

  #slider-range {
    width: 40% !important;
  }

  .mbigopis > table > tbody > tr > td {
    display: block;
    width: 100% !important;
    padding: 10px 0;
  }
}

/* ---------- Мобильный (≤767px) ---------- */
@media screen and (max-width: 767px) {

  body {
    min-width: 320px;
    overflow-x: hidden;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  /* Снимаем жёсткие размеры картинок, растягивающих макет */
  .iFrame2 img,
  #mycarousel img,
  .mopis2 img {
    max-width: 100%;
    width: auto !important;
    height: auto !important;
  }

  iframe {
    max-width: 100%;
  }

  /* Скрываем лишнее из шапки */
  #divan,
  #Layer1,
  #menuhead,
  #slova {
    display: none !important;
  }

  /* === ШАПКА === */
  body > div[style*="width:100%"] > table {
    display: block;
  }
  body > div[style*="width:100%"] > table > tbody,
  body > div[style*="width:100%"] > table > tbody > tr {
    display: block;
  }
  body > div[style*="width:100%"] > table td {
    display: block;
    width: 100% !important;
    text-align: center !important;
  }

  body > div[style*="width:100%"] > table td:first-child img {
    max-width: 180px;
    height: auto;
  }

  body > div[style*="width:100%"] > table td[background] {
    display: none;
  }
  body > div[style*="width:100%"] > table td img[src*="rez_"],
  body > div[style*="width:100%"] > table td img[src*="02.jpg"],
  body > div[style*="width:100%"] > table td img[src*="08.jpg"],
  body > div[style*="width:100%"] > table td img[src*="01.jpg"],
  img[src*="amad_akcii_ng2.gif"],
  img[src*="rassrochka.gif"] {
    display: none;
  }

  body > div[style*="width:100%"] > table tbody > tr:nth-child(4) {
    display: none;
  }

  .tel {
    position: static !important;
    text-align: center !important;
    font-size: 22px !important;
    padding: 10px 0 5px;
  }

  .time {
    position: static !important;
    text-align: center !important;
    padding: 0 0 10px;
    font-size: 12px !important;
  }

  .time1 {
    position: static !important;
    text-align: center !important;
    padding: 5px 0;
    font-size: 12px !important;
  }

  .title {
    position: static !important;
    width: auto !important;
    height: auto !important;
    left: auto !important;
    top: auto !important;
    text-align: center !important;
    padding: 15px 10px 10px;
  }
  .title h1 {
    font-size: 18px !important;
  }

  /* Разрешаем перенос заголовков и названий */
  .title nobr,
  .title h1,
  .rightbase nobr,
  .rightbase h3,
  .mopis nobr,
  .mtrans nobr {
    white-space: normal !important;
    word-break: break-word;
  }
  .title h1,
  .rightbase h3 {
    line-height: 1.25;
  }

  /* Картинка акции (05.jpg) — растягиваем на мобильном */
  td[valign="top"][bgcolor="#FAF7F0"] img[src*="05.jpg"] {
    max-width: 100%;
    width: 100%;
  }

  /* === ОСНОВНАЯ ТАБЛИЦА === */
  body > table[width="100%"] > tbody > tr {
    display: flex;
    flex-direction: column;
  }
  body > table[width="100%"] > tbody > tr > td[width="174"] {
    width: 100% !important;
    background: #fff !important;
  }
  body > table[width="100%"] > tbody > tr > td[align="center"],
  body > table[width="100%"] > tbody > tr > td[valign="top"]:not([width="174"]) {
    width: 100% !important;
  }

  /* Скрываем баннеры в сайдбаре */
  td[width="174"] img[src*="26.jpg"],
  td[width="174"] img[src*="patina.jpg"],
  td[width="174"] img[src*="portfol.jpg"] {
    display: none !important;
  }

  /* === МОБИЛЬНОЕ МЕНЮ === */
  .mobile-menu-toggle {
    display: block !important;
    background: #6F2B16;
    color: #fff;
    font: bold 16px 'Open Sans', Arial, sans-serif;
    padding: 12px 15px;
    cursor: pointer;
    text-align: center;
    margin: 0;
  }
  .mobile-menu-toggle span {
    float: right;
    font-size: 20px;
  }

  td[width="174"] .leftsearch,
  td[width="174"] > br,
  td[width="174"] > table[width="174"],
  td[width="174"] > #leftnavv {
    display: none;
  }

  td[width="174"].mobile-menu-open .leftsearch,
  td[width="174"].mobile-menu-open > table[width="174"],
  td[width="174"].mobile-menu-open > #leftnavv {
    display: block !important;
  }

  td[width="174"] .menu a {
    display: block;
    padding: 10px 12px 10px 24px;
    font-size: 15px;
    border-bottom: 1px solid #ddd;
    border-left: 4px solid #a97b52;
    color: #6F2B16;
    background: #fff;
  }
  td[width="174"] .menu a:hover {
    background: #f5f0e8;
  }
  td[width="174"] .menu {
    padding-left: 0 !important;
  }
  td[width="174"] > table[width="174"] {
    width: 100% !important;
  }

  .leftsearch {
    margin: 0 !important;
    width: 100% !important;
    padding: 10px !important;
    box-sizing: border-box;
  }
  .leftsearch-form {
    display: flex;
  }
  .leftsearch-q {
    flex: 1;
    width: auto !important;
    height: 36px !important;
    font-size: 14px !important;
    padding: 4px 10px !important;
  }
  .leftsearch-go {
    height: 36px !important;
    padding: 0 15px !important;
    font-size: 14px !important;
  }

  /* === ГЛАВНАЯ: КАТЕГОРИИ === */
  .centernav {
    margin-left: 0 !important;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 5px;
  }

  .iFrame7 {
    width: 44% !important;
    float: none !important;
    margin: 2% !important;
    box-sizing: border-box;
  }

  .centerindex img {
    width: 100%;
    height: auto;
  }

  .typeindex {
    font-size: 11px !important;
    text-align: center;
  }

  .priceindex {
    font-size: 13px !important;
    text-align: center;
  }

  /* === КАТАЛОГ type.php === */
  .sortnav {
    margin-left: 5px !important;
    margin-right: 5px !important;
  }

  #CenterCell {
    margin-left: 5px !important;
    margin-bottom: 10px !important;
  }
  #CenterCell ul.SitePath {
    font-size: 10px !important;
    padding: 5px;
  }

  .filters {
    padding: 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
  .filters li {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  .ui-buttonset .ui-button {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }

  .masonry > div {
    float: none !important;
    width: 100% !important;
    margin: 4px 0 !important;
  }
  .masonry > div[style*="width: 50px"] {
    text-align: center;
  }
  #slider-range {
    width: 100% !important;
    margin: 8px 0 !important;
  }
  .masonry > div[style*="margin-left"] {
    margin-left: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
  }
  #amount,
  #amount_1 {
    width: 80px !important;
    height: 28px !important;
    font-size: 13px !important;
  }
  .sorti form {
    margin-top: 0.5em !important;
  }

  /* Контейнер карточек каталога — flex для выравнивания высот */
  .sortnav[style*="overflow"] {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
  }

  .iFrame1 {
    width: 44% !important;
    float: none !important;
    margin: 2% !important;
    box-sizing: border-box;
    min-width: 0;
    display: flex;
    flex-direction: column;
  }
  .iFrame1 .type {
    font-size: 12px !important;
    white-space: normal !important;
    text-align: center;
  }
  .iFrame1 .material {
    font-size: 10px !important;
    text-align: center;
    padding: 5px 3px !important;
  }
  .iFrame1 .center {
    width: 90% !important;
  }
  .iFrame1 .pricetype {
    font-size: 13px !important;
  }
  .iFrame1 .pricecenter {
    margin-top: auto;
    padding-bottom: 12px;
  }

  .layerdp,
  .layerpo {
    right: auto !important;
    left: 5px !important;
    transform: scale(0.7);
    transform-origin: top left;
  }

  .dlyanav {
    margin: 20px 5px 0 5px !important;
    font-size: 11px;
  }
  .dlyanav a {
    font-size: 11px !important;
    margin-right: 5px !important;
  }

  /* === КАРТОЧКА ТОВАРА base.php === */
  .leftbase {
    float: none !important;
    margin: 15px auto !important;
    text-align: center;
  }
  .leftbase .mainpic img {
    max-width: 280px;
    height: auto;
  }

  #otherpic {
    margin: 10px auto;
    text-align: center;
  }
  #otherpic table {
    margin: 0 auto;
  }

  .rightbase {
    float: none !important;
    margin: 10px 10px !important;
    width: auto !important;
  }

  .minprice {
    font-size: 18px !important;
    text-align: center;
  }

  .rightbase > table > tbody > tr {
    display: block;
    margin-bottom: 6px;
  }
  .rightbase > table > tbody > tr > td {
    display: block;
  }
  .rightbase > table > tbody > tr > td:first-child {
    font-size: 12px;
  }
  .gabarit,
  .sidenie,
  .materialbase {
    margin-bottom: 0 !important;
    font-size: 12px !important;
  }

  .table-bordered {
    width: 100% !important;
    font-size: 11px;
  }
  .table-bordered td {
    padding: 4px !important;
    font-size: 11px !important;
    word-break: break-word;
  }
  .table-bordered .zakazbut {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  .mbigopis {
    margin-left: 5px !important;
    width: auto !important;
  }
  .mbigopis > table > tbody > tr {
    display: flex;
    flex-direction: column;
  }
  .mbigopis > table > tbody > tr > td {
    display: block;
    width: 100% !important;
    padding: 10px 5px !important;
  }
  .mbigopis iframe {
    width: 100% !important;
    height: auto !important;
    min-height: 400px;
  }

  .ya-share2 {
    text-align: center;
  }
  .socset {
    float: none;
    display: block;
    text-align: center;
    margin-bottom: 10px;
  }

  .mopis,
  .mopis2 {
    font-size: 13px;
    overflow: hidden;
  }

  #mycarousel {
    max-width: 100%;
    overflow: hidden;
  }

  .mtrans {
    font-size: 13px;
  }

  /* === ТЕКСТОВЫЙ БЛОК === */
  body > table[width="100%"] td[align="center"] > table[width="90%"] {
    width: 95% !important;
  }

  /* === ФУТЕР === */
  body > div > table[bgcolor="#6F2B16"] > tbody > tr {
    display: flex;
    flex-wrap: wrap;
  }
  body > div > table[bgcolor="#6F2B16"] > tbody > tr > td {
    display: block;
    width: 100% !important;
    padding: 15px 10px !important;
  }

  .h3foot {
    font-size: 15px !important;
  }
  .afoot {
    font-size: 13px !important;
  }
  .copy {
    font-size: 11px !important;
  }

  .scrollup {
    bottom: 20px;
    right: 10px;
    width: 35px;
    height: 35px;
  }

  .leftsearch-modal__content {
    max-width: 90% !important;
    margin: 40px auto !important;
  }

  .sort {
    margin: 5px !important;
    font-size: 12px !important;
  }
}

/* ---------- Маленькие экраны (≤480px) ---------- */
@media screen and (max-width: 480px) {
  .iFrame7,
  .iFrame1 {
    width: 90% !important;
    margin: 8px auto !important;
  }

  .title h1 {
    font-size: 16px !important;
  }

  .tel {
    font-size: 20px !important;
  }

  .mobile-menu-toggle {
    font-size: 15px;
  }

  .sortnav {
    font-size: 11px;
  }

  .minprice {
    font-size: 16px !important;
  }

  .leftbase .mainpic img {
    max-width: 240px;
  }
}