/* ============================================================
   medgate.ru — адаптивные стили
   ============================================================ */

/* --- Reset & base ------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(136, 170, 62, 0.25);
}

body {
  margin: 0;
  padding: 0;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #000;
}

a {
  color: #88aa3e;
}

a:hover {
  color: #6b8a2e;
}

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

hr {
  border: none;
  border-top: 1px solid #ebebeb;
  margin: 16px 0;
}

h1 {
  color: #333;
  font-size: 20px;
  font-family: Tahoma, Arial, sans-serif;
  margin: 0 0 8px;
}

h2 {
  font-size: 18px;
  margin: 0 0 6px;
}

select {
  font-family: Tahoma, Arial, sans-serif;
  font-size: 14px;
}

ol {
  padding-left: 20px;
  margin-left: 10px;
}

/* --- Yadro counter (hidden) -------------------------------- */
.yadro-counter {
  height: 0;
  overflow: hidden;
}

/* --- Site wrapper ------------------------------------------ */
.site-wrapper {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 12px;
}

/* --- Header ------------------------------------------------ */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 20px;
  padding: 12px 0;
}

.site-logo {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.site-logo img {
  width: 140px;
  height: auto;
}

.site-logo-text {
  font-size: 12px;
  margin-top: 4px;
}

.site-search {
  flex: 1;
  min-width: 220px;
  background: #b7dd65;
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
}

/* Fallback-форма и её враппер */
.site-search form,
.ya-site-form_inited_no {
  display: flex !important;
  gap: 8px !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Инициализированный Яндекс-виджет — растягиваем как flex-item */
.ya-site-form_inited_yes {
  flex: 1 1 0% !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

/* Таблица виджета — на всю ширину, без лишних отступов */
.ya-site-form__wrap,
.ya-site-form__search {
  width: 100% !important;
  border-spacing: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Ячейки таблицы — убираем все padding что вызывали скачок */
.ya-site-form__search-input,
.ya-site-form__search-wrap,
.ya-site-form__search-precise,
.ya-site-form__search td {
  padding: 0 !important;
  margin: 0 !important;
}

.ya-site-form__search-wrap {
  width: 1px !important;
  white-space: nowrap !important;
}

/* Цвет рамки инпута — одинаковый для JS и fallback */
.ya-site-form__field {
  border-color: #aac654 !important;
}

.site-search input[type="search"],
.site-search .ya-site-form__field {
  flex: 1;
  min-width: 0;
  height: 36px;
  font-size: 15px;
  font-family: Tahoma, Arial, sans-serif;
  color: #333;
  padding: 0 10px;
  background: #fff;
  border: 1px solid #aac654 !important;
  border-radius: 6px !important;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.site-search input[type="search"]:focus,
.site-search .ya-site-form__field:focus {
  border-color: #88aa3e !important;
  box-shadow: 0 0 0 2px rgba(136, 170, 62, 0.2) !important;
}

.site-search input[type="search"]:hover,
.site-search .ya-site-form__field:hover {
  border-color: #88aa3e !important;
}

/* Подсказки Яндекс-виджета — цвет выделения */
.ya-site-suggest-elem:hover,
.ya-site-suggest-elem_selected,
.ya-site-suggest-elem_selected .ya-site-suggest-elem-link,
.ya-site-suggest-elem:hover .ya-site-suggest-elem-link,
.ya-site-suggest__item_selected,
.ya-site-suggest__item_selected_yes,
.ya-site-suggest2__item_selected,
.ya-site-suggest2__item:hover,
.ya-site-suggest__item:hover,
.b-suggest__item_hover_yes,
.b-suggest__item_hover {
  background-color: #b7dd65 !important;
  color: #000 !important;
}

/* Кнопка очистки поля поиска — в цвет кнопки "Найти" */
.site-search input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%2388aa3e'/%3E%3Cpath d='M5 5l6 6M11 5l-6 6' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  flex-shrink: 0;
}

.site-search input[type="submit"],
.site-search button[type="submit"] {
  margin-left: 0;
}

.site-search .ya-site-form__submit {
  margin-left: 8px !important;
}

.site-search input[type="submit"],
.site-search .ya-site-form__submit,
.site-search button[type="submit"] {
  -webkit-appearance: none !important;
  appearance: none !important;
  flex: 0 0 auto;
  height: 36px;
  font-size: 14px;
  font-family: Tahoma, Arial, sans-serif;
  font-weight: bold;
  padding: 0 18px !important;
  background: #88aa3e !important;
  color: #fff !important;
  border: none !important;
  border-radius: 6px !important;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(136, 170, 62, 0.35) !important;
  transition: background 0.15s, box-shadow 0.15s !important;
  white-space: nowrap;
  vertical-align: middle;
}

.site-search input[type="submit"]:hover,
.site-search .ya-site-form__submit:hover,
.site-search button[type="submit"]:hover {
  background: #6b8a2e !important;
  box-shadow: 0 3px 8px rgba(136, 170, 62, 0.5) !important;
}

.site-search input[type="submit"]:active,
.site-search .ya-site-form__submit:active,
.site-search button[type="submit"]:active {
  background: #5a7526 !important;
  box-shadow: none !important;
  transform: translateY(1px);
}

/* --- Main -------------------------------------------------- */
.site-main {
  padding: 8px 0;
}

.page-title {
  margin-bottom: 10px;
}

.page-content {
  margin-bottom: 16px;
}

.page-ads-footer {
  margin-bottom: 8px;
}

/* --- Footer ------------------------------------------------ */
.site-footer {
  padding-bottom: 20px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.footer-copy {
  font-size: 12px;
  color: #000;
}

.footer-copy a {
  color: #88aa3e;
  font-size: 12px;
}

.bot-info {
  color: #7f7f7f;
}

.bot-info a {
  color: #7f7f7f;
  text-decoration: none;
}

.footer-counter {
  flex-shrink: 0;
}

/* ============================================================
   Типографика и утилиты (перенесены из старых стилей)
   ============================================================ */

/* --- Навигация / меню -------------------------------------- */
.menu {
  font-size: 14px;
  font-weight: bold;
  padding: 10px;
}

.menu a {
  color: #88aa3e;
  font-size: 14px;
  font-weight: bold;
  padding-left: 10px;
  line-height: 22px;
}

.nav1 {
  padding-bottom: 5px;
}

.nav2 {
  padding-top: 5px;
  font-size: 17px;
}

.bread {
  font-size: 20px;
  font-weight: normal;
  color: #000;
  display: inline;
}

/* --- Заголовки разделов ------------------------------------ */
.p2bold {
  font-size: 22px;
  color: #000;
  font-weight: bold;
}

.p2text {
  font-size: 18px;
  color: #000;
}

.p2r {
  font-size: 18px;
  color: #88aa3e;
}

.p2r a {
  font-size: 18px;
  color: #88aa3e;
}

.p2letters {
  color: #88aa3e;
  font-size: 16px;
  margin-top: 5px;
}

.p2letters a {
  color: #88aa3e;
  font-size: 16px;
}

/* --- Блок контента ----------------------------------------- */
.sec_list {
  font-size: 15px;
  color: #000;
  font-weight: normal;
}

.sec_links {
  font-size: 14px;
  color: #88aa3e;
  font-weight: normal;
}

.sec_links a {
  font-size: 14px;
  color: #88aa3e;
}

/* --- Список ссылок ----------------------------------------- */
.link_list {
  color: #88aa3e;
  font-size: 15px;
  font-weight: bold;
}

.link_list a {
  color: #88aa3e;
  font-size: 15px;
  font-weight: bold;
  line-height: 24px;
}

.link_list img {
  margin-bottom: 1px;
  margin-right: 3px;
}

.link_sublist {
  color: #88aa3e;
  font-size: 14px;
}

.link_sublist a {
  color: #88aa3e;
  font-size: 14px;
  line-height: 24px;
}

.link_sublist img {
  margin-bottom: 1px;
  margin-right: 3px;
}

/* --- Карточки на главной ----------------------------------- */
.main_block {
  color: #7f7f7f;
  font-size: 13px;
  padding-right: 10px;
}

.main_block a {
  color: #88aa3e;
  font-size: 15px;
  font-weight: bold;
}

/* --- Рубрики ----------------------------------------------- */
.rubriks {
  color: #000;
  font-size: 20px;
}

.rubriks a {
  color: #7f7f7f;
  font-size: 13px;
  margin-bottom: 4px;
}

.rubriks h2 {
  font-size: 20px;
  margin: 0 0 4px;
  color: #000;
}

/* При совмещении с grid-5 (список болезней) сбрасываем font-size контейнера,
   чтобы line-height <br> считался от 13px, а не от 20px */
.rubriks.grid-5 {
  font-size: 13px;
}

/* --- Таблицы данных (каталоги, списки) --------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  color: #3f3f3f;
}

.data-table th {
  color: #fff;
  font-weight: bold;
  background: #88aa3e;
  font-size: 13px;
  padding: 6px 8px;
  text-align: left;
}

.data-table td {
  padding: 6px 8px;
  font-size: 14px;
}

.data-table a {
  color: #88aa3e;
}

.data-table tr:nth-child(even) td {
  background: #e8f4cf;
}

.data-table tr:nth-child(odd) td {
  background: #fff;
}

/* Обертка для горизонтальной прокрутки на мобилках */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Старые классы для обратной совместимости */
.table_title {
  color: #fff;
  font-weight: bold;
  background: #88aa3e;
  font-size: 12px;
  padding: 6px 8px;
}

.row1 {
  color: #000;
  font-size: 12px;
  background: #fff;
}

.row1 a {
  color: #88aa3e;
}

.row2 {
  color: #000;
  font-size: 12px;
  background: #e8f4cf;
}

.row2 a {
  color: #88aa3e;
}

/* --- Таблица «ключ-значение» (детальные страницы) ---------- */
.tt {
  font-size: 14px;
  color: #3f3f3f;
}

.tt a {
  font-size: 14px;
  color: #88aa3e;
}

.tt_fact {
  font-size: 13px;
  color: #3f3f3f;
}

.tt_fact a {
  font-size: 13px;
  color: #88aa3e;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table th {
  text-align: left;
  color: #fff;
  font-weight: bold;
  background: #88aa3e;
  font-size: 12px;
  padding: 6px 10px;
  white-space: nowrap;
  width: 1%;
}

.detail-table td {
  padding: 6px 10px;
  font-size: 13px;
}

/* --- Поиск ------------------------------------------------- */
.search_form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.search_form select {
  flex: 1 1 180px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 14px;
  color: #333;
  background: #fff;
  border: 1px solid #aac654;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2388aa3e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search_form select:focus {
  border-color: #88aa3e;
  box-shadow: 0 0 0 2px rgba(136, 170, 62, 0.2);
}

.search_form select:hover {
  border-color: #88aa3e;
}

.search_form input[type="submit"] {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 20px;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  background: #88aa3e;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 5px rgba(136, 170, 62, 0.35);
}

.search_form input[type="submit"]:hover {
  background: #6b8a2e;
  box-shadow: 0 3px 8px rgba(136, 170, 62, 0.5);
}

.search_form input[type="submit"]:active {
  background: #5a7526;
  box-shadow: none;
  transform: translateY(1px);
}

.search_bg {
  background: #b7dd65;
  padding: 0;
}

.search_input {
  border: 2px solid #999;
  width: 100%;
  height: 34px;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}

.search_button {
  height: 34px;
  font-size: 16px;
  padding: 4px 16px;
}

.search_opts {
  font-size: 12px;
  color: #000;
}

#under_search_str {
  color: #7f7f7f;
  font-size: 12px;
}

#under_search_str a {
  color: #ee0000;
  font-size: 12px;
}

/* --- Пагинация --------------------------------------------- */
#result {
  font-size: 14px;
  font-weight: bold;
  color: #000;
}

#pages_links {
  color: #000;
  font-size: 12px;
  font-weight: bold;
}

#pages_links a {
  color: #88aa3e;
  font-size: 12px;
  font-weight: bold;
}

#pages_stat {
  color: #7f7f7f;
  font-size: 12px;
  font-weight: normal;
}

/* --- Разное ------------------------------------------------ */
.ttt {
  font-size: 11px;
  color: #7f7f7f;
}

.ttt a {
  font-size: 11px;
  color: #7f7f7f;
  text-decoration: none;
}

.ucc {
  font-weight: bold;
}

.pic {
  margin-right: 10px;
  float: left;
}

.str5 {
  margin-left: 7px;
  margin-right: 7px;
}

#logo {
  font-family: Tahoma, Arial, sans-serif;
  color: #000;
}

#consultant {
  color: #01cda2;
  font-size: 13px;
  font-weight: bold;
}

#onlinehelp {
  color: #000;
  font-size: 12px;
}

#onlinehelp a {
  color: #01cda2;
  font-size: 15px;
  font-weight: bold;
}

#quest_list a {
  color: #88aa3e;
  font-size: 13px;
  font-weight: bold;
}

.top_quest {
  padding: 10px;
}

.top_quest a {
  font-size: 12px;
  color: #7f7f7f;
}

/* --- Адаптивные сетки (auto-fit, от 1 до N колонок) -------- */
/* minmax подобран так чтобы в контейнере 980px давать нужный максимум колонок */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.grid-5 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.grid-5 > * {
  min-width: 0;
  overflow-wrap: break-word;
}

/* --- CSS-columns для фиксированных N колонок внутри узких контейнеров --- */
.cols-2 {
  columns: 2;
  column-gap: 16px;
}

.cols-3 {
  columns: 3;
  column-gap: 12px;
}

@media (max-width: 480px) {
  .cols-2, .cols-3 {
    columns: 1;
  }
}

/* --- Список элементов с буллетами -------------------------- */
.bullet-list a::before {
  content: "▸ ";
  color: #88aa3e;
}

/* --- Форма обратной связи ---------------------------------- */
.feedback-form label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
  font-size: 13px;
}

.feedback-form input[type="text"],
.feedback-form input[type="email"],
.feedback-form textarea {
  width: 100%;
  max-width: 400px;
  height: 36px;
  padding: 0 10px;
  font-size: 14px;
  font-family: Tahoma, Arial, sans-serif;
  color: #333;
  background: #fff;
  border: 1px solid #aac654;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.feedback-form input[type="text"]:focus,
.feedback-form input[type="email"]:focus,
.feedback-form textarea:focus {
  border-color: #88aa3e;
  box-shadow: 0 0 0 2px rgba(136, 170, 62, 0.2);
}

.feedback-form input[type="text"]:hover,
.feedback-form input[type="email"]:hover,
.feedback-form textarea:hover {
  border-color: #88aa3e;
}

.feedback-form textarea {
  height: auto;
  max-width: 100%;
  min-height: 120px;
  padding: 8px 10px;
  resize: vertical;
}

.feedback-form .form-group {
  margin-bottom: 12px;
}

.feedback-form .error {
  color: #c00;
  font-size: 12px;
}

.btn-submit {
  display: inline-block;
  padding: 10px 32px;
  background: #88aa3e;
  color: #fff;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(136, 170, 62, 0.35);
}

.btn-submit:hover {
  background: #6b8a2e;
  box-shadow: 0 3px 10px rgba(136, 170, 62, 0.5);
}

.btn-submit:active {
  background: #5a7526;
  box-shadow: none;
  transform: translateY(1px);
}

/* --- Детальная страница контента --------------------------- */
.content-body {
  font-size: 14px;
  line-height: 1.6;
  color: #3f3f3f;
}

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

/* --- Связанные элементы (статьи, травы, диеты) ------------- */
.related-list a {
  display: block;
  padding: 2px 0;
  font-size: 13px;
  color: #88aa3e;
}

/* ============================================================
   MEDIA QUERIES — адаптивность
   ============================================================ */

/* --- Планшет (до 768px) ------------------------------------ */
@media (max-width: 768px) {
  .p2bold {
    font-size: 18px;
  }

  .rubriks {
    font-size: 17px;
  }

  .footer-inner {
    flex-direction: row;
    align-items: flex-start;
    flex-wrap: nowrap;
  }

  .footer-copy {
    flex: 1 1 auto;
    min-width: 0;
  }

  .footer-counter {
    flex: 0 0 auto;
    margin-left: 12px;
  }

  .search_form select {
    flex: 1 1 160px;
    height: 38px;
    font-size: 14px;
  }

  .search_form input[type="submit"] {
    height: 38px;
    font-size: 14px;
  }
}

/* --- Телефон (до 480px) ------------------------------------ */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .site-wrapper {
    padding: 0 8px;
  }

  .site-logo {
    width: 100%;
    justify-content: center;
  }

  .site-logo img {
    width: 80px;
  }

  .site-logo-text {
    font-size: 11px;
  }

  .site-search {
    padding: 8px 10px;
    border-radius: 6px;
  }

  .site-search input[type="search"],
  .site-search .ya-site-form__field {
    font-size: 14px;
    height: 34px;
  }

  .site-search input[type="submit"],
  .site-search .ya-site-form__submit,
  .site-search button[type="submit"] {
    padding: 0 12px !important;
    height: 34px;
    min-width: 64px !important;
    width: 64px !important;
  }

  .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .search_form {
    gap: 6px;
  }

  .search_form select {
    flex: 1 1 100%;
    height: 40px;
    font-size: 13px;
  }

  .search_form input[type="submit"] {
    flex: 1 1 100%;
    height: 40px;
    font-size: 13px;
  }

  h1 {
    font-size: 16px;
  }

  .p2bold {
    font-size: 16px;
  }

  .p2text {
    font-size: 16px;
    color: #000;
  }

  .p2r, .p2r a {
    font-size: 15px;
  }

  .sec_list {
    font-size: 14px;
  }

  /* Таблицы данных: стек-вёрстка для узких экранов */
  .data-table thead {
    display: none;
  }

  .data-table tr {
    display: block;
    margin-bottom: 10px;
    border: 1px solid #e8f4cf;
    border-radius: 4px;
    padding: 6px;
  }

  .data-table td {
    display: block;
    padding: 3px 6px;
    text-align: left;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: bold;
    color: #88aa3e;
    display: inline;
    margin-right: 6px;
  }
}
