/* =========================================================
   ivEng — избранное, поиск по статьям, закладки браузера
========================================================= */

:root {
  --iv-green: #16a34a;
  --iv-green-dark: #15803d;
  --iv-green-soft: #f0fdf4;
  --iv-border: #e2eee6;
  --iv-heart: #e11d48;
}

/* =========================================================
   Кнопка «В избранное»
========================================================= */

.fav-form { display: inline; margin: 0; }

.fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--iv-border);
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, transform .15s ease;
}

.fav-btn:hover { border-color: #fecdd3; background: #fff1f2; color: var(--iv-heart); }
.fav-btn:active { transform: scale(.96); }
.fav-btn:focus-visible { outline: 2px solid var(--iv-green); outline-offset: 2px; }
.fav-btn:disabled { opacity: .7; cursor: wait; }

.fav-btn i { font-size: 15px; line-height: 1; }
.fav-btn .fav-icon-on,
.fav-btn .fav-label-on { display: none; }

.fav-btn.is-saved { border-color: #fecdd3; background: #fff1f2; color: var(--iv-heart); }
.fav-btn.is-saved .fav-icon-on,
.fav-btn.is-saved .fav-label-on { display: inline; }
.fav-btn.is-saved .fav-icon-off,
.fav-btn.is-saved .fav-label-off { display: none; }
.fav-btn.is-saved .fav-icon-on { animation: fav-pop .3s ease; }

@keyframes fav-pop {
  0% { transform: scale(.6); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Крупная кнопка внизу статьи */
.fav-btn--big {
  padding: 10px 20px;
  font-size: 15px;
  background: var(--iv-green);
  border-color: var(--iv-green);
  color: #fff;
}
.fav-btn--big:hover { background: var(--iv-green-dark); border-color: var(--iv-green-dark); color: #fff; }
.fav-btn--big i { font-size: 17px; }

/* Кнопка в строке с датой статьи */
.article-detail-meta .article-detail-actions { margin-left: auto; }
.article-detail-meta .fav-btn i { color: inherit; margin: 0; font-size: 15px; }

/* Блок «Пригодится ещё раз?» после статьи */
.article-save-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 40px 0 8px;
  padding: 20px 24px;
  border: 1px solid var(--iv-border);
  border-radius: 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 70%);
}
.article-save-text { display: flex; flex-direction: column; gap: 2px; }
.article-save-text strong { font-size: 17px; color: #0f172a; }
.article-save-text span { color: #64748b; font-size: 14px; }

/* =========================================================
   Карточки в избранном: кнопка «убрать»
========================================================= */

.article-card-wrap { position: relative; height: 100%; }

.fav-remove-form { margin: 0; }

.fav-remove {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fecdd3;
  border-radius: 50%;
  background: #fff1f2;
  color: var(--iv-heart);
  font-size: 16px;
  cursor: pointer;
  transition: transform .15s ease, background-color .2s ease;
}
.fav-remove:hover { transform: scale(1.08); background: #ffe4e6; }
.fav-remove:focus-visible { outline: 2px solid var(--iv-heart); outline-offset: 2px; }

/* бейдж «English» не должен прятаться под сердечком */
.article-card-wrap:has(.fav-remove) .article-badge { margin-right: 44px; }

.text-danger-soft { color: var(--iv-heart); }

.fav-login-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 24px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font-size: 14px;
  line-height: 1.55;
}
.fav-login-hint i { color: var(--iv-green); font-size: 18px; line-height: 1.3; }
.fav-login-hint a { color: var(--iv-green-dark); font-weight: 600; }

/* =========================================================
   Пустое состояние (избранное / поиск)
========================================================= */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  border: 1px dashed #cfe3d6;
  border-radius: 16px;
  background: #fbfefc;
}
.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--iv-green-soft);
  color: var(--iv-green);
  font-size: 28px;
}

/* =========================================================
   Поле поиска
========================================================= */

.search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 520px;
}

.search-form-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 15px;
  pointer-events: none;
}

.search-form-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 92px 0 40px;
  border: 1px solid #d5e6da;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 15px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.search-form-input::placeholder { color: #94a3b8; }
.search-form-input:focus {
  outline: none;
  border-color: var(--iv-green);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, .12);
}
/* убираем стандартный «крестик» в Chrome/Safari — он налезает на кнопку */
.search-form-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.search-form-btn {
  position: absolute;
  right: 4px;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--iv-green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  transition: background-color .2s ease;
}
.search-form-btn:hover { background: var(--iv-green-dark); }

.search-form--lg { max-width: 680px; }
.search-form--lg .search-form-input { height: 50px; font-size: 16px; padding-right: 104px; }
.search-form--lg .search-form-btn { height: 40px; padding: 0 20px; right: 5px; }

/* На странице «Статьи»: поиск + ссылка на избранное */
.articles-tools {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.articles-fav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--iv-green-dark);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.articles-fav-link i { color: var(--iv-heart); }
.articles-fav-link:hover { text-decoration: underline; }

/* =========================================================
   Шапка: значки поиска и избранного
========================================================= */

.main-header .header-icon-link { gap: 8px; }
.main-header .header-icon-link .bi { font-size: 18px; }

.header-fav-icon { position: relative; display: inline-flex; }
.header-fav-count {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--iv-heart);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.main-header .header-search-dropdown {
  width: 360px;
  padding: 12px;
}
.main-header .header-search-dropdown .search-form { max-width: none; }

@media (max-width: 991.98px) {
  .header-search-mobile { padding: 4px 0 8px; }
  .header-search-mobile .search-form { max-width: none; }
  .main-header .header-icon-link { justify-content: flex-start !important; }
}

/* =========================================================
   Страница результатов поиска
========================================================= */

.search-summary { color: #475569; margin-bottom: 18px; }

.search-results { display: flex; flex-direction: column; gap: 12px; }

.search-result {
  display: block;
  padding: 18px 22px;
  border: 1px solid var(--iv-border);
  border-radius: 14px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.search-result:hover {
  transform: translateY(-2px);
  border-color: #bbf7d0;
  box-shadow: 0 10px 28px rgba(6, 78, 59, .08);
  color: inherit;
}
.search-result-title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
}
.search-result-snippet {
  margin: 0 0 10px;
  color: #475569;
  font-size: 15px;
  line-height: 1.6;
}
.search-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #94a3b8;
  font-size: 13px;
}
.search-result mark,
.search-results mark {
  padding: 0 2px;
  border-radius: 3px;
  background: #fef08a;
  color: inherit;
}

/* =========================================================
   Закладки браузера
========================================================= */

.footer-bookmark-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: var(--iv-green-soft);
  color: var(--iv-green-dark);
  font-size: 14px;
  font-weight: 600;
  transition: background-color .2s ease, border-color .2s ease;
}
.footer-bookmark-btn:hover { background: #dcfce7; border-color: #86efac; }
.footer-bookmark-btn i { font-size: 16px; }

.bookmark-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding: 18px 22px;
  border: 1px solid var(--iv-border);
  border-radius: 16px;
  background: #fff;
}
.bookmark-cta-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--iv-green-soft);
  color: var(--iv-green);
  font-size: 22px;
}
.bookmark-cta-text { flex: 1 1 220px; display: flex; flex-direction: column; }
.bookmark-cta-text span { color: #64748b; font-size: 14px; }

.bookmark-modal .modal-content { border: 0; border-radius: 18px; }
.bookmark-modal .modal-title i { margin-right: 4px; }

.bookmark-keys {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 4px 0 18px;
  font-size: 22px;
  color: #94a3b8;
}
.bookmark-keys kbd {
  min-width: 64px;
  padding: 10px 16px;
  border: 1px solid #d5e6da;
  border-bottom-width: 4px;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  box-shadow: none;
}

.bookmark-steps { padding-left: 1.2rem; margin-bottom: 0; }
.bookmark-steps li { margin-bottom: 10px; line-height: 1.55; }
.bookmark-steps i { color: var(--iv-green); }

.bookmark-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--iv-border);
}
.bookmark-copy-url { color: #475569; font-weight: 600; }

/* =========================================================
   Всплывающее уведомление
========================================================= */

.site-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1080;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .25s ease, transform .25s ease;
}
.site-toast.is-visible { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.site-toast a { color: #86efac; font-weight: 600; margin-left: 6px; }

/* =========================================================
   Телефон
========================================================= */

@media (max-width: 575.98px) {
  .article-detail-meta { flex-wrap: wrap; }
  .article-save-box { padding: 18px; }
  .article-save-box .fav-form,
  .article-save-box .fav-btn--big { width: 100%; justify-content: center; }
  .search-result { padding: 16px; }
  .search-result-title { font-size: 17px; }
  .bookmark-keys kbd { min-width: 56px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .fav-btn, .fav-remove, .search-result, .site-toast { transition: none; }
  .fav-btn.is-saved .fav-icon-on { animation: none; }
}
