/* Mobile styles for legacy table-based pages (blocks/header.php layout) */

.clearfix:before,
.clearfix:after {
  content: "";
  display: table;
}

.clearfix:after {
  clear: both;
}

/* Navigation styles: mobile_all.css + media.css (same as homepage) */

/* Video pages: watch button (desktop + mobile) */
body.legacy-video-page a.smotreti {
  display: inline-block;
  margin: 8px 0 4px;
  padding: 8px 18px;
  background: #8e4147;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 4px;
  font-size: 14px !important;
  font-family: Arial, Helvetica, sans-serif;
  cursor: pointer;
}

body.legacy-video-page a.smotreti:hover,
body.legacy-video-page a.smotreti:active,
body.legacy-video-page a.smotreti:focus {
  background: #8e213d;
  color: #fff !important;
  text-decoration: none !important;
}

@media screen and (max-width: 990px) {
  body {
    min-width: 0 !important;
    overflow-x: hidden;
  }

  table {
    max-width: 100% !important;
  }

  table[width="990"],
  table[width="1005"],
  table[width="668"],
  table[width="501"],
  table[width="319"],
  table[width="334"],
  table[width="169"] {
    width: 100% !important;
    max-width: 100% !important;
  }

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

  td[width="319"],
  th[width="319"],
  td[width="334"] {
    display: none !important;
  }

  td[width="668"],
  td[width="977"],
  td[width="501"],
  td[width="504"],
  td[width="455"],
  td[width="426"],
  td[width="427"],
  td[width="428"],
  td[width="242"],
  td[width="145"],
  td[width="276"],
  td[width="167"],
  td[width="164"],
  td[width="77"] {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box;
    height: auto !important;
  }

  th[width="379"],
  th[width="122"] {
    width: 100% !important;
    display: block !important;
    height: auto !important;
  }

  th[width="787"] {
    width: 100% !important;
    display: block !important;
    height: 60px !important;
    background-size: cover !important;
    background-position: center !important;
  }

  th[width="179"],
  th[width="24"] {
    display: none !important;
  }

  td[width="1"][background],
  td[width="1"][bgcolor] {
    display: none !important;
  }

  td[rowspan="2"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    min-height: 108px;
    padding: 12px 16px !important;
    box-sizing: border-box;
    text-align: center;
    background: #fff;
    border-bottom: 1px solid #e4e4e2;
  }

  td[rowspan="2"] a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  td[rowspan="2"] img {
    display: block;
    margin: 0 auto;
    max-width: 164px;
    width: 78%;
    height: auto;
    border-radius: 0;
    box-shadow: none;
  }

  td.c7,
  td[width="77"] {
    text-align: left !important;
    padding: 4px 0 !important;
  }

  object,
  embed {
    display: none !important;
  }

  h1 {
    font-size: 15px !important;
    line-height: 1.3;
  }

  .text100,
  .text1,
  .text11 {
    font-size: 13px !important;
    line-height: 1.4 !important;
    white-space: normal !important;
  }

  td[valign="top"] {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  table[align="center"] {
    width: 100% !important;
  }

  .footer {
    height: auto !important;
    padding: 10px 0;
  }

  .footer ul li {
    display: block;
    padding: 4px 10px;
    white-space: normal;
  }

  .text_pad_2,
  .article2 {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Video pages: *_vid.php */
  body.legacy-video-page .text2 {
    font-size: 15px !important;
    font-weight: bold;
    line-height: 1.35;
    padding: 6px 10px 2px !important;
  }

  body.legacy-video-page .text1 {
    padding: 0 10px 10px !important;
    line-height: 1.45 !important;
  }

  body.legacy-video-page td[rowspan="2"] img[width="164"],
  body.legacy-video-page td[rowspan="2"] img[width="164"][height="109"] {
    max-width: 164px !important;
    width: 78% !important;
    height: auto !important;
    margin: 0 auto;
  }

  body.legacy-video-page img[src*="lain1"],
  body.legacy-video-page img[src*="lain10"],
  body.legacy-video-page img[src*="lain11"],
  body.legacy-video-page img[src*="lain12"] {
    width: 100% !important;
    height: 4px !important;
    object-fit: cover;
  }

  body.legacy-video-page tr td.gradient2,
  body.legacy-video-page tr td[class*="gradient2"] {
    height: 6px !important;
    min-height: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
  }

  body.legacy-video-page [id^="tooltip"],
  body.legacy-video-page .video-tooltip {
    padding: 10px !important;
    background: #fff !important;
    box-sizing: border-box;
  }

  body.legacy-video-page .video-tooltip-inner {
    max-width: 640px;
    margin: 0 auto;
  }

  body.legacy-video-page .video-embed {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto 12px;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #000;
  }

  body.legacy-video-page .video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    border: 0;
  }

  body.legacy-video-page [id^="tooltip"] iframe {
    display: block;
    width: 100% !important;
    max-width: 640px !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    margin: 0 auto 12px;
    border: 0;
  }

  /* Section hub pages: platypodia_nav, methods_nav, plastic_nav, *_vid.php */
  body.legacy-section-page td[width="668"],
  body.legacy-video-page td[width="668"] {
    background: #f4f4f2;
    padding-bottom: 8px !important;
  }

  body.legacy-section-page td[width="15"],
  body.legacy-section-page td[width="10"] {
    display: none !important;
  }

  body.legacy-section-page td.section-heading,
  body.legacy-section-page td.gradient2.section-heading {
    height: auto !important;
    min-height: 0 !important;
    padding: 12px 10px !important;
    font-size: inherit !important;
    line-height: 1.3 !important;
    background: #dfe0db !important;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
  }

  body.legacy-section-page td.section-heading h2 {
    font-size: 16px !important;
    margin: 0;
    padding: 0;
    color: #333;
  }

  body.legacy-section-page td.section-heading strong.c6 {
    font-size: 15px !important;
    font-weight: bold;
    color: #333;
  }

  body.legacy-section-page .legacy-test-block {
    margin: 10px 8px !important;
    width: calc(100% - 16px) !important;
    background: #fff;
    border: 1px solid #d5d5d3;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }

  body.legacy-section-page .legacy-test-block td[width="242"] {
    padding: 14px 12px !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
    color: #333;
  }

  body.legacy-section-page .legacy-test-block td[width="145"],
  body.legacy-section-page .legacy-test-block td[width="276"] {
    display: inline-block !important;
    width: 49% !important;
    vertical-align: top;
    padding: 0 4px 12px !important;
    box-sizing: border-box;
    text-align: center;
  }

  body.legacy-section-page .legacy-test-block td[width="145"] img,
  body.legacy-section-page .legacy-test-block td[width="276"] img {
    border-radius: 6px;
    max-width: 100% !important;
  }

  body.legacy-section-page table[width="668"] table[width="668"],
  body.legacy-video-page td > table[width="668"]:has(td[rowspan] img[width="164"]) {
    margin: 0 8px 12px !important;
    width: calc(100% - 16px) !important;
    background: #ececea;
    border: 1px solid #d5d5d3;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
  }

  body.legacy-section-page table[width="668"] table[width="668"] td:not([rowspan]),
  body.legacy-video-page td > table[width="668"]:has(td[rowspan] img[width="164"]) td:not([rowspan]):not([colspan="3"]) {
    background: #ececea !important;
  }

  body.legacy-section-page td[rowspan="2"],
  body.legacy-video-page td > table[width="668"]:has(td[rowspan] img[width="164"]) td[rowspan] {
    border-radius: 8px 8px 0 0;
    background: #fff !important;
  }

  body.legacy-section-page td[rowspan="2"] img[width="164"],
  body.legacy-section-page td[rowspan="2"] img[width="164"][height="110"],
  body.legacy-video-page td[rowspan] img[width="164"],
  body.legacy-video-page td[rowspan] img[width="164"][height="109"] {
    max-width: 164px !important;
    width: 78% !important;
    height: auto !important;
    box-shadow: none !important;
  }

  body.legacy-section-page td[rowspan="2"] a img {
    border-radius: 0;
  }

  body.legacy-video-page td > table[width="668"]:has(td[rowspan] img[width="164"]) .text2 {
    font-size: 16px !important;
    line-height: 1.35;
    padding: 10px 12px 4px !important;
    margin: 0 !important;
    background: #ececea !important;
  }

  body.legacy-video-page td > table[width="668"]:has(td[rowspan] img[width="164"]) .text1 {
    padding: 0 12px 12px !important;
    line-height: 1.45 !important;
    font-size: 13px !important;
    background: #ececea !important;
  }

  body.legacy-section-page h1 {
    font-size: 16px !important;
    line-height: 1.35;
    padding: 10px 12px 4px !important;
    margin: 0 !important;
  }

  body.legacy-section-page h1 a {
    color: #333 !important;
    text-decoration: none !important;
  }

  body.legacy-section-page .text1,
  body.legacy-section-page .text11,
  body.legacy-section-page td[colspan="2"]:not([class]) {
    padding: 0 12px 12px !important;
    line-height: 1.45 !important;
    font-size: 13px !important;
  }

  body.legacy-section-page td[width="428"] + td[width="77"],
  body.legacy-section-page td[width="77"] {
    padding: 0 12px 10px !important;
    text-align: left !important;
  }

  body.legacy-section-page td[width="77"] img {
    display: none !important;
  }

  body.legacy-section-page td[width="77"] a:empty {
    display: none !important;
  }

  body.legacy-section-page td[width="77"] a:has(img),
  body.legacy-section-page td[width="77"] a:first-of-type:not(:empty) {
    display: inline-block;
    padding: 7px 14px;
    background: #8e4147;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 13px !important;
  }

  body.legacy-section-page td[width="77"] a:has(img)::after,
  body.legacy-section-page td[width="77"] a:first-of-type:not(:empty)::after {
    content: "Перейти →";
  }

  body.legacy-section-page td[width="77"] a.legacy-nav-back::after {
    content: "← Назад";
  }

  body.legacy-section-page img[src*="lain1"],
  body.legacy-section-page img[src*="lain10"],
  body.legacy-section-page img[src*="lain12"],
  body.legacy-section-page img[src*="anatomia/lain"] {
    display: none !important;
  }

  body.legacy-section-page tr td.gradient2:not(.section-heading) {
    height: 4px !important;
    min-height: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    background: #e8e8e6 !important;
  }

  body.legacy-section-page > table td > table td > table td[width="668"] > table > tr:first-child td[colspan="2"] {
    padding: 0 12px 12px !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
  }

  /* Fat zones diagram + list (plastic_nav, liposuction) */
  .legacy-fat-zones tr {
    display: flex;
    flex-direction: column;
  }

  .legacy-fat-zones td[width="258"],
  .legacy-fat-zones td[width="381"] {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
  }

  .legacy-fat-zones td[width="381"] {
    order: -1;
    padding: 12px 12px 8px !important;
    text-align: center;
  }

  .legacy-fat-zones td[width="381"] img {
    display: block;
    width: 100% !important;
    max-width: 320px !important;
    height: auto !important;
    margin: 0 auto;
    border-radius: 6px;
  }

  .legacy-fat-zones td[width="258"] {
    padding: 4px 14px 14px !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
    color: #333;
  }

  .legacy-fat-zones td[width="12"] {
    display: none !important;
  }

  /* methods.php — block layout (see css/methods_article.css) */
  body.methods-page .content,
  body.legacy-article-page .content {
    background: #f4f4f2;
    padding-bottom: 8px !important;
  }

  body.methods-page .legacy-article-hub__icon img,
  body.legacy-article-page .legacy-article-hub__icon img {
    max-width: 164px !important;
    width: 78% !important;
    height: auto !important;
  }

  body.legacy-article-page .legacy-article .text_pad,
  body.legacy-article-page .legacy-article .text_pad p {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  body.legacy-article-page .legacy-article-sprite {
    display: block !important;
    max-width: 110px !important;
    width: 110px !important;
    height: auto !important;
    margin: 0 auto !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
  }

  body.legacy-article-page .legacy-article-sprite[height="223"] {
    min-height: 180px;
  }

  @media screen and (max-width: 520px) {
    body.legacy-section-page .legacy-test-block td[width="145"],
    body.legacy-section-page .legacy-test-block td[width="276"] {
      display: block !important;
      width: 100% !important;
      padding: 0 12px 10px !important;
    }
  }
}

/* Legacy gallery: gallerey.php + patients/*.php (1005px table layout) */
@media screen and (max-width: 990px) {
  body.legacy-gallery {
    min-width: 0;
    overflow-x: hidden;
  }

  body.legacy-gallery table[width="1005"],
  body.legacy-gallery table[width="668"],
  body.legacy-gallery table[width="334"] {
    width: 100% !important;
    max-width: 100%;
  }

  body.legacy-gallery img {
    max-width: 100%;
    height: auto;
  }

  body.legacy-gallery td[width="334"],
  body.legacy-gallery td[width="1"][background] {
    display: none !important;
  }

  body.legacy-gallery td[width="668"] {
    width: 100% !important;
    display: block;
    box-sizing: border-box;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.legacy-gallery .legacy-gallery-nav td {
    display: inline-block;
    width: 33.333% !important;
    box-sizing: border-box;
    vertical-align: top;
  }

  body.legacy-gallery .legacy-gallery-nav td a img {
    width: 100% !important;
    max-width: 110px;
    height: auto !important;
  }

  body.legacy-gallery .style2,
  body.legacy-gallery .style5 {
    font-size: 13px;
    line-height: 1.35;
  }

  body.legacy-gallery td[bgcolor="#DDDDDB"] .style5 {
    white-space: normal;
    word-wrap: break-word;
  }
}

@media only screen and (max-width: 680px) {
  body,
  td,
  th {
    font-size: 14px;
  }
}
