/* Калькулятор [credit_calc_form] — горизонтальный бар в герое страницы кредитов. */

.wf-cc2 {
  --cc-dark: #0B2F25;
  --cc-green: #00C677;
  --cc-green-ink: #77F2A8;
  --cc-muted: #8FB3A5;
  --cc-line: rgba(255, 255, 255, .12);

  box-sizing: border-box;
  width: 100%;
  padding: 22px 28px;
  border-radius: 20px;
  background: var(--cc-dark);
  color: #fff;
  font-size: 16px;
  line-height: 1.4;
}

.wf-cc2 *,
.wf-cc2 *::before,
.wf-cc2 *::after { box-sizing: border-box; }

/* [hidden] должен реально прятать, даже если у элемента задан display (inline-flex/flex). */
.wf-cc2 [hidden] { display: none !important; }

/* Стартовое состояние: пока ничего не подобрано — прячем футер (кнопка «ще» + дисклеймер). */
.wf-cc2.is-start .wf-cc2__foot { display: none; }

.wf-cc2--empty { color: var(--cc-muted); font-size: 14px; }

/* ---------- шапка ---------- */

.wf-cc2__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.wf-cc2__head-main { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

.wf-cc2__title { margin: 0; font-size: 26px; font-weight: 700; color: #fff; }

.wf-cc2__kicker {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cc-green);
}

/* ---------- контролы + выводы в одну строку ---------- */

.wf-cc2__controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  align-items: center;
  gap: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--cc-line);
}

.wf-cc2__control { min-width: 0; }

.wf-cc2__control-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.wf-cc2__control-lbl {
  color: var(--cc-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.wf-cc2__control-val { font-size: 20px; font-weight: 700; color: var(--cc-green-ink); }

.wf-cc2__slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  /* Заливка слева от бегунка — зелёная (прогресс); --fill выставляет JS. */
  background:
    linear-gradient(to right, var(--cc-green) 0%, var(--cc-green) var(--fill, 0%),
      rgba(255, 255, 255, .16) var(--fill, 0%), rgba(255, 255, 255, .16) 100%);
  outline: none;
}

/* Firefox — нативная «пройденная» часть на случай, если JS ещё не отработал. */
.wf-cc2__slider::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--cc-green); }

.wf-cc2__slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--cc-green);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.wf-cc2__slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 4px solid var(--cc-green); cursor: pointer;
}

.wf-cc2__out { text-align: left; white-space: nowrap; }

.wf-cc2__out-lbl {
  display: block;
  margin-bottom: 4px;
  color: var(--cc-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.wf-cc2__out-val { font-size: 26px; font-weight: 700; color: var(--cc-green-ink); }

/* ---------- подпись ---------- */

.wf-cc2__caption {
  margin: 12px 0 10px;
  color: var(--cc-muted);
  font-size: 13px;
}

/* ---------- карточка оффера ---------- */

.wf-cc2__best { position: relative; z-index: 0; margin-bottom: 12px; }

/* «Стопка»: когда есть ещё оферы (и список свёрнут) — под карточкой-победителем
   выглядывают два слоя, как колода карт. Класс has-more вешает JS. */
.wf-cc2__best.has-more { margin-bottom: 24px; }
.wf-cc2__best.has-more::before,
.wf-cc2__best.has-more::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  z-index: -1;
  transition: transform .2s ease;
}
/* Сплошные светлые оттенки — как рёбра колоды, без «грязной» полупрозрачности. */
.wf-cc2__best.has-more::after {
  transform: translateY(7px) scaleX(0.955);
  background: #E7ECE9;
  box-shadow: 0 8px 16px rgba(0, 0, 0, .14);
}
.wf-cc2__best.has-more::before {
  transform: translateY(14px) scaleX(0.905);
  background: #CFD8D4;
}

.wf-cc2__more { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }

.wf-cc2-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  padding: 16px 20px;
  border-radius: 16px;
  background: #fff;
  color: #10231C;
}


/* Напис-«прапорець» усередині картки-переможця (на всіх екранах) — фірмовий зелений. */
.wf-cc2-card__flag {
  flex: 0 0 100%;
  order: -1;
  color: var(--cc-green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.wf-cc2-card__logo {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #DFE5E2;
  overflow: hidden;
}

.wf-cc2-card__logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 6px;
  object-fit: contain;
  background: #fff;
}

/* Инициалы — запас: видны, только если картинки нет или она не загрузилась. */
.wf-cc2-card__ini {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #085C44;
  font-size: 13px;
  font-weight: 700;
}

.wf-cc2-card__logo.is-broken .wf-cc2-card__ini { display: flex; }

.wf-cc2-card__head { flex: 1 1 auto; min-width: 0; }

.wf-cc2-card__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  font-size: 17px;
  font-weight: 700;
}

.wf-cc2-card__sub {
  display: block;
  margin-top: 3px;
  color: #6B7C75;
  font-size: 13px;
  font-weight: 600;
}

.wf-cc2-card__num { flex: 0 0 auto; text-align: left; white-space: nowrap; }

/* Лінія-роздільник між «До сплати» і «Переплата». */
.wf-cc2-card__num + .wf-cc2-card__num { border-left: 1px solid #E4EAE7; padding-left: 16px; }

.wf-cc2-card__num-lbl {
  display: block;
  color: #8A9A93;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.wf-cc2-card__num-val { font-size: 18px; font-weight: 700; }

.wf-cc2-card__docs {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 13px;
}

.wf-cc2-card__docs a { color: #6B7C75; text-decoration: none; }
.wf-cc2-card__docs a:hover { text-decoration: underline; }

/* Лого и название — ссылки на обзор оффера. */
a.wf-cc2-card__logo { text-decoration: none; }
a.wf-cc2-card__name { color: inherit; text-decoration: none; cursor: pointer; }
a.wf-cc2-card__name:hover { text-decoration: underline; }

.wf-cc2-card__actions { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }

.wf-cc2-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.wf-cc2-btn--ghost { background: #fff; color: #085C44; border: 1px solid #DFE5E2; }
.wf-cc2-btn--ghost:hover { background: #F5F8F3; }
.wf-cc2-btn--primary { background: #085C44; color: #D0F9C8; }
.wf-cc2-btn--primary:hover { background: #01311c; color: #77DF8E; }

/* ---------- пустое состояние (нет оферов под текущие сумму/срок) ---------- */

.wf-cc2__none {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 28px 24px;
  border-radius: 16px;
  background: #fff;
  color: #10231C;
}

.wf-cc2__none-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: #EFF5F1;
  color: #085C44;
}

.wf-cc2__none-title { font-size: 16px; font-weight: 700; }

.wf-cc2__none-hint {
  max-width: 340px;
  color: #6B7C75;
  font-size: 13px;
  line-height: 1.45;
}

/* Стартовый вариант — компактный, полупрозрачный, с пунктиром, без иконки. */
.wf-cc2__none--start {
  gap: 3px;
  padding: 12px 16px;
  border: 1px dashed rgba(255, 255, 255, .28);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  color: #fff;
}

.wf-cc2__none--start .wf-cc2__none-ico { display: none; }
.wf-cc2__none--start .wf-cc2__none-title { font-size: 15px; color: #fff; }
.wf-cc2__none--start .wf-cc2__none-hint { color: var(--cc-muted); font-size: 12px; }

/* ---------- футер ---------- */

.wf-cc2__foot {
  display: flex;
  align-items: center;
  gap: 20px 32px;
  flex-wrap: wrap;
}

.wf-cc2__showmore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.wf-cc2__showmore:hover { background: rgba(255, 255, 255, .12); }

.wf-cc2__showmore-arrow { transition: transform .2s ease; color: var(--cc-muted); }
.wf-cc2__showmore.is-open .wf-cc2__showmore-arrow { transform: rotate(180deg); }

.wf-cc2__note {
  flex: 1 1 240px;
  color: var(--cc-muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

/* ---------- адаптив ---------- */

@media (max-width: 900px) {
  .wf-cc2__controls {
    grid-template-columns: 1fr 1fr;
    gap: 18px 24px;
  }
  .wf-cc2__note { text-align: left; }

  /* Компактна розкладка картки-переможця:
     ряд 1 — лого + назва; ряд 2 — «До сплати | Переплата»;
     ряд 3 — док-лінки (стовпчиком, ліворуч) 50% і кнопка (праворуч) 50%. */
  .wf-cc2-card { flex-wrap: wrap; row-gap: 14px; }
  .wf-cc2-card__head { flex: 1 1 calc(100% - 64px); }
  .wf-cc2-card__num { flex: 1 1 40%; }
  .wf-cc2-card__docs { flex: 1 1 auto; order: 1; }
  .wf-cc2-card__actions { flex: 0 0 auto; order: 1; justify-content: flex-end; align-self: flex-end; }
  .wf-cc2__caption { display: none; }
}

@media (max-width: 600px) {
  .wf-cc2 { padding: 16px; border-radius: 16px; }
  .wf-cc2__head { flex-direction: column; align-items: flex-start; gap: 2px; margin-bottom: 12px; }
  .wf-cc2__title { font-size: 20px; }
  .wf-cc2__controls { grid-template-columns: 1fr; gap: 12px; border-bottom: none; padding-bottom: 0; }
  .wf-cc2__control-row { margin-bottom: 6px; }
  /* «До сплати/Переплата» зверху дублюються в картці нижче — ховаємо. */
  .wf-cc2__out { display: none; }
  .wf-cc2__best { margin-top: 14px; }
  .wf-cc2__foot { gap: 10px; flex-direction: column; align-items: stretch; }
  /* У колонковому футері flex-basis трактується як висота — скидаємо,
     інакше під коротким текстом лишається ~240px порожнечі. */
  .wf-cc2__note { flex: 0 0 auto; font-size: 11px; }
  .wf-cc2-card { gap: 12px; padding: 14px; }
  .wf-cc2-card__logo { width: 40px; height: 40px; }
  /* Вузькі екрани (≈360): стискаємо, щоб «лінки + кнопка» лишались в одному рядку. */
  .wf-cc2-card__docs { font-size: 12px; min-width: 0; }
  .wf-cc2-card__actions { flex-shrink: 1; min-width: 0; }
  .wf-cc2-btn { height: 40px; padding: 0 14px; font-size: 14px; }
  .wf-cc2-card__num + .wf-cc2-card__num { padding-left: 12px; }
  .wf-cc2__showmore { justify-content: center; }
}

/* Скелетон під час серверного розрахунку.
   Розрахунок іде на сервер, тож між рухом повзунка й новими цифрами є пауза.
   Цифри й картки не ховаємо — підмінюємо їх мерехтінням на місці, щоб висота
   блока не стрибала і сторінка не смикалась. */
.wf-cc2.is-busy [data-cc-total],
.wf-cc2.is-busy [data-cc-best],
.wf-cc2.is-busy [data-cc-more] {
  position: relative;
  color: transparent;
}

.wf-cc2.is-busy [data-cc-best] *,
.wf-cc2.is-busy [data-cc-more] * {
  visibility: hidden;
}

.wf-cc2.is-busy [data-cc-total]::after,
.wf-cc2.is-busy [data-cc-best]::after,
.wf-cc2.is-busy [data-cc-more]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, .05) 0%,
    rgba(255, 255, 255, .13) 50%,
    rgba(255, 255, 255, .05) 100%
  );
  background-size: 200% 100%;
  animation: wf-cc2-shimmer 1.1s linear infinite;
}

@keyframes wf-cc2-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wf-cc2.is-busy [data-cc-total]::after,
  .wf-cc2.is-busy [data-cc-best]::after,
  .wf-cc2.is-busy [data-cc-more]::after {
    animation: none;
  }
}
