/* === FUTURE MOM HEADER PRO — обновленная версия === */

/* Общие стили */
.fm-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 99999;
  font-family: 'Poppins', sans-serif;
  color: #fff;
  transition: background 0.35s ease, transform 0.35s ease, box-shadow 0.3s ease;
}

/* Цвет и прозрачность фона */
.fm-header.fm-bg {
  background: rgba(125, 188, 163, 0.95) !important; /* #7dbca3 */
  backdrop-filter: blur(8px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(8px) saturate(140%) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* При скролле вверх — чуть прозрачнее */
.fm-header.scroll-up.fm-bg {
  background: rgba(125, 188, 163, 0.8) !important;
}

/* Контейнер */
.fm-header__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Логотип */
.fm-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.8rem;
}
.fm-logo img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0,0,0,0.4);
  transition: transform 0.25s ease;
}
.fm-logo:hover img { transform: scale(1.05); }

/* Меню десктоп */
.fm-menu ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 28px; }
.fm-menu a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  position: relative;
}
.fm-menu a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 0;
  height: 2px;
  background: #cb879e;
  transition: width 0.25s;
}
.fm-menu a:hover::after { width: 100%; }

/* Соцсети */
.fm-socials { display: flex; gap: 12px; }
.fm-socials img { width: 26px; height: 26px; transition: transform 0.25s; }
.fm-socials img:hover { transform: scale(1.15); }

/* Бургер */
.fm-burger {
  display: none;
  width: 36px;
  height: 26px;
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  z-index: 100002;
}
.fm-burger span {
  display: block;
  width: 100%;
  height: 4px;
  background: #fff;
  border-radius: 3px;
  transition: all 0.3s ease;
}
.fm-burger span:nth-child(2) { margin: 7px 0; }
.fm-burger.open span:nth-child(1) { transform: rotate(45deg) translateY(10px); }
.fm-burger.open span:nth-child(2) { opacity: 0; }
.fm-burger.open span:nth-child(3) { transform: rotate(-45deg) translateY(-10px); }

/* Подложка */
.fm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75) !important;
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 100000;
}
.fm-backdrop.is-active { opacity: 1; visibility: visible; }

/* Панель бургер-меню */
.fm-mobile-panel {
  position: fixed;
  top: 0;
  right: -100%;
  height: 100%;
  max-width: 520px;
  width: 80%;
  background: linear-gradient(
    180deg,
    rgba(125, 188, 163, 0.95) 0%,
    rgba(125, 188, 163, 0.92) 100%
  ) !important;
  backdrop-filter: blur(12px) saturate(160%) !important;
  -webkit-backdrop-filter: blur(12px) saturate(160%) !important;
  box-shadow: -4px 0 12px rgba(0,0,0,0.4);
  border-left: 1px solid rgba(255,255,255,0.12);
  z-index: 100001;
  transition: right 0.4s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.fm-mobile-panel.is-open { right: 0; }

/* Содержимое панели */
.fm-mobile-panel__inner {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 28px;
}

/* Логотип внутри меню */
.fm-mobile-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.45rem;
}
.fm-mobile-logo img {
  width: 58px;
  height: 58px;
  border-radius: 50%;
}

/* Языки */
.fm-lang { display: flex; gap: 12px; margin-top: 10px; }
.fm-lang__item {
  background: #cb879e !important;
  color: #fff !important;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.fm-lang__item:hover { background: #d28aa8 !important; }

/* Меню мобильное */
.fm-mobile-menu ul { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 22px; }
.fm-mobile-menu a {
  color: #fff !important;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: color 0.2s ease;
}
.fm-mobile-menu a:hover { color: #22493a !important; }

/* Соцсети */
.fm-mobile-socials {
  margin-top: auto;
  display: flex;
  gap: 14px;
}
.fm-mobile-socials img {
  width: 32px;
  height: 32px;
  transition: transform 0.2s ease;
}
.fm-mobile-socials img:hover { transform: scale(1.1); }

/* Эффект скрытия хедера при скролле вниз */
.fm-header.is-hidden { transform: translateY(-110%); }

/* При открытом меню фиксируем хедер */
.fm-menu-open .fm-header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  transform: none !important;
  z-index: 99999;
}

/* Адаптив */
@media (max-width:1024px){
  .fm-menu, .fm-socials { display: none; }
  .fm-burger { display: block; }
}
@media (max-width:600px){
  .fm-logo img { width: 88px; height: 88px; }
  .fm-logo span { font-size: 2rem; }
  .fm-mobile-menu a { font-size: 1.6rem; }
}
/* === FIX: панель бургера занимает весь экран === */
.fm-mobile-panel {
  position: fixed !important;
  top: 0 !important;
  right: -100%;
  bottom: 0 !important;
  height: 100vh !important;
  max-height: 100vh !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  z-index: 100001;
}

/* Когда меню открыто — хедер не ограничивает высоту */
.fm-menu-open .fm-header {
  height: auto !important;
  overflow: visible !important;
}
/* === Центрирование кнопки TranslatePress в хедере === */

.fm-lang-switcher--header {
  display: flex;
  align-items: center;       /* выравнивание по вертикали */
  justify-content: center;   /* центрируем содержимое */
  margin: 0 6px;             /* небольшой отступ с обеих сторон */
  height: 100%;              /* подгоняем по высоте хедера */
}

.fm-header__container {
  display: flex;
  align-items: center;       /* все элементы по центру */
  justify-content: space-between;
}

/* На мобильных — немного уменьшаем */
@media (max-width: 768px) {
  .fm-lang-switcher--header {
    margin-left: 4px;
    transform: translateY(1px); /* подгоняем выравнивание */
  }
}
/* === Исправление положения и фона TranslatePress switcher в header === */
@media (min-width: 1025px) {
  .fm-lang-switcher--header {
    position: absolute;
    top: 5px;          /* выравнивание по вертикали (можно ±2px подогнать) */
    right: 165px;       /* сдвиг левее от иконки Telegram */
    transform: none;
    background: none !important;  /* убираем полупрозрачный фон */
    box-shadow: none !important;
    padding: 0 !important;
    border: none !important;
    z-index: 1000;
  }

  /* Убираем круг/фон TranslatePress обёртки */
  .trp-language-switcher,
  .trp-language-switcher * {
    box-shadow: none !important;
  }

  /* Немного уменьшаем флаг и выравниваем текст */
  .fm-lang-switcher--header img {
    width: 22px !important;
    height: 22px !important;
    vertical-align: middle;
  }
/* === Исправление TranslatePress switcher для PWA / WebView === */
@supports (-webkit-touch-callout: none) {
  /* iOS Safari / WebView detection */
  .fm-lang-switcher--header {
    top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
  }
}

/* Для Android WebView (там safe-area не работает) — чуть выше вручную */
@media (display-mode: standalone) {
  .fm-lang-switcher--header {
    top: 10px !important;
  }
}

/* Также фиксим на случай, если PWA идёт в fullscreen */
html[manifest], body.pwa-active .fm-lang-switcher--header {
  top: 10px !important;
}
