/*
 * credos.calculator — виджет калькулятора (2-колоночный, онлайн-расчёт)
 * DS-токены: --ds-accent #2e47d7, --ds-ink #0a225e, --ds-muted #5a6470,
 *             --ds-tint #f0f3fc, --ds-line #e3e3e3, --ds-cyan #1fa2c5, --ds-r 8px
 * Register: product (tool). Restrained color, familiar patterns, density.
 * Scoped под .cds-calc-widget.
 */

/* ──────────────────────── Контейнер + grid ──────────────────────── */
.cds-calc-widget {
  font-family: inherit;
  color: var(--ds-ink, #0a225e);
  width: 100%;
}

.cds-calc-widget__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 28px;
  align-items: start;
}

/* Левая колонка — вопросы */
.cds-calc-widget__form {
  background: #fff;
  border: 1px solid var(--ds-line, #e3e3e3);
  border-radius: var(--ds-r-md,8px);
  padding: 32px 34px 34px;
}

/* Правая колонка — sticky панель результата.
   top = высота фиксированной шапки сайта (~130px, как scroll-margin-top анкеров) + запас,
   иначе панель заезжает под навигацию. */
.cds-calc-widget__panel {
  position: sticky;
  top: 146px;
  background: var(--ds-tint,#e6f0f8);
  border: 1px solid rgba(46, 71, 215, .14);
  border-radius: var(--ds-r-md,8px);
  padding: 26px 24px;
  max-height: calc(100vh - 166px);
  overflow: auto;
}

/* ──────────────────────── Группы вопросов ──────────────────────── */
.cds-sv-group + .cds-sv-group {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid var(--ds-line, #e3e3e3);
}

.cds-sv-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ds-accent, #2e47d7);
  margin: 0 0 18px;
}

/* ──────────────────────── Пошаговый режим (steps) ──────────────────────── */
.cds-sv-prog { display: flex; align-items: center; margin-bottom: 28px; }
.cds-sv-step { display: flex; align-items: center; }
.cds-sv-step-num {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--ds-line, #e3e3e3); background: #f8f9fc;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--ds-muted, #5a6470);
  transition: background .2s, border-color .2s, color .2s; flex-shrink: 0;
}
.cds-sv-step.active .cds-sv-step-num { background: var(--ds-accent, #2e47d7); border-color: var(--ds-accent, #2e47d7); color: #fff; }
.cds-sv-step.done .cds-sv-step-num  { background: var(--ds-cyan,#00bef3); border-color: var(--ds-cyan,#00bef3); color: #fff; }
.cds-sv-step-line { flex: 1; height: 2px; min-width: 24px; background: var(--ds-line, #e3e3e3); transition: background .3s; }
.cds-sv-step-line.done { background: var(--ds-cyan,#00bef3); }
.cds-sv-step-title { font-size: 13px; font-weight: 600; color: var(--ds-muted, #5a6470); margin: 0 0 18px; }

.cds-sv-nav { display: flex; gap: 10px; margin-top: 26px; align-items: center; }
.cds-sv-next {
  margin-left: auto; padding: 0 30px; height: 46px;
  background: var(--ds-accent, #2e47d7); color: #fff;
  border: none; border-radius: var(--ds-r-md,8px);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity .15s ease-out;
}
.cds-sv-next:hover { opacity: .88; }
.cds-sv-next:focus-visible { outline: 2px solid var(--ds-accent, #2e47d7); outline-offset: 2px; box-shadow: 0 0 0 4px rgba(46,71,215,.18); }
.cds-sv-back {
  padding: 0 20px; height: 46px;
  background: transparent; border: 1.5px solid var(--ds-line, #e3e3e3);
  border-radius: var(--ds-r-md,8px); font-size: 15px; color: var(--ds-muted, #5a6470);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.cds-sv-back:hover { border-color: var(--ds-muted, #5a6470); color: var(--ds-text, #212529); }
.cds-sv-back:focus-visible { outline: 2px solid var(--ds-muted, #5a6470); outline-offset: 2px; }
.cds-sv-nav-hint { margin-left: auto; font-size: 13px; color: var(--ds-muted, #5a6470); }

/* Вопрос */
.cds-sv-q { margin-bottom: 24px; }
.cds-sv-q:last-child { margin-bottom: 0; }
.cds-sv-q-t {
  font-size: 16px; font-weight: 600;
  color: var(--ds-ink, #0a225e);
  margin-bottom: 12px; line-height: 1.4;
}

/* ──────────────────────── Опции (radio / checkbox) ──────────────────────── */
.cds-sv-opt {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 8px;
  border: 1.5px solid var(--ds-line, #e3e3e3); border-radius: var(--ds-r-md,8px);
  cursor: pointer; font-size: 15px; line-height: 1.4;
  color: var(--ds-text, #212529);
  transition: border-color .15s ease-out, background .15s ease-out, box-shadow .15s;
  min-height: 50px; user-select: none;
}
.cds-sv-opt:last-child { margin-bottom: 0; }
.cds-sv-opt:hover {
  border-color: #8fa3e8; background: #f5f7fd;
  box-shadow: 0 2px 8px rgba(46, 71, 215, .08);
}
.cds-sv-opt.selected {
  border: 2px solid var(--ds-accent, #2e47d7); background: #eef1fc;
  box-shadow: 0 0 0 3px rgba(46, 71, 215, .07);
}
.cds-sv-opt.selected .cds-sv-ind { border-color: var(--ds-accent, #2e47d7); background: var(--ds-accent, #2e47d7); }
.cds-sv-opt.selected .cds-sv-ind::after { opacity: 1; }
.cds-sv-opt.selected > span:last-child { color: var(--ds-ink, #0a225e); font-weight: 500; }
.cds-sv-opt:focus-within { outline: 2px solid var(--ds-accent, #2e47d7); outline-offset: 1px; }

/* Скрытый нативный input (доступно) */
.cds-sv-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Индикатор radio */
.cds-sv-ind {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #c5cbdb; background: #fff;
  flex-shrink: 0; position: relative; display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, background .15s;
}
.cds-sv-ind::after {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: #fff; opacity: 0; transition: opacity .1s;
}
/* Индикатор checkbox */
.cds-sv-opt--check .cds-sv-ind { border-radius: 4px; }
.cds-sv-opt--check .cds-sv-ind::after {
  width: 5px; height: 8px; border-radius: 0; background: transparent;
  border-right: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(40deg) translate(-1px, -1px);
}

/* ──────────────────────── Сегменты (срок контракта) ──────────────────────── */
.cds-sv-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.cds-sv-seg-opt {
  flex: 1 1 auto; min-width: 72px; text-align: center;
  padding: 11px 14px;
  border: 1.5px solid var(--ds-line, #e3e3e3); border-radius: var(--ds-r-md,8px);
  cursor: pointer; font-size: 14px; font-weight: 500; white-space: nowrap;
  color: var(--ds-text, #212529); background: #fff;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
  user-select: none;
}
.cds-sv-seg-opt:hover { border-color: #8fa3e8; background: #f5f7fd; }
.cds-sv-seg-opt.selected {
  border-color: var(--ds-accent, #2e47d7); background: var(--ds-accent, #2e47d7);
  color: #fff; box-shadow: 0 2px 8px rgba(46, 71, 215, .18);
}
.cds-sv-seg-opt:focus-within { outline: 2px solid var(--ds-accent, #2e47d7); outline-offset: 2px; }
.cds-sv-seg-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ──────────────────────── Панель: пустое состояние ──────────────────────── */
.cds-calc-widget__empty {
  text-align: left; color: var(--ds-muted, #5a6470);
}
.cds-calc-widget__empty-icon {
  width: 40px; height: 40px; margin-bottom: 14px;
  color: var(--ds-accent, #2e47d7); opacity: .55;
}
.cds-calc-widget__empty-title {
  font-size: 15px; font-weight: 600; color: var(--ds-ink, #0a225e);
  margin: 0 0 6px;
}
.cds-calc-widget__empty p { font-size: 13.5px; line-height: 1.5; margin: 0; }

/* ──────────────────────── Панель: результат ──────────────────────── */
@keyframes cds-price-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.cds-calc-widget__panel-head {
  font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ds-muted, #5a6470); margin: 0 0 14px;
}
.cds-calc-widget__result-label {
  font-size: 11px; color: var(--ds-muted, #5a6470); margin: 0 0 4px;
  text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
}
.cds-calc-widget__result-price {
  font-size: 34px; font-weight: 700; line-height: 1.05;
  color: var(--ds-accent, #2e47d7); margin: 0 0 6px; letter-spacing: -.01em;
  animation: cds-price-in .25s cubic-bezier(.16,1,.3,1);
}
.cds-calc-widget__result-price--custom { font-size: 20px; color: var(--ds-ink, #0a225e); }
.cds-calc-widget__period {
  font-size: 12.5px; color: var(--ds-muted, #5a6470); margin: 0 0 18px; line-height: 1.5;
}

.cds-calc-widget__breakdown {
  display: flex; flex-direction: column; gap: 0;
  margin-bottom: 20px;
  border: 1px solid rgba(46, 71, 215, .12); border-radius: 6px;
  overflow: hidden; background: #fff;
}
.cds-calc-widget__breakdown-item {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; color: var(--ds-ink, #0a225e);
  padding: 9px 13px; border-bottom: 1px solid rgba(46, 71, 215, .07);
}
.cds-calc-widget__breakdown-item:last-child { border-bottom: none; }
.cds-calc-widget__breakdown-item-cost { font-weight: 700; white-space: nowrap; padding-left: 14px; }

/* ──────────────────────── Форма КП ──────────────────────── */
.cds-calc-widget__lead { border-top: 1px solid rgba(46, 71, 215, .12); padding-top: 18px; }
.cds-calc-widget__lead-title {
  font-size: 14px; font-weight: 700; color: var(--ds-ink, #0a225e); margin: 0 0 12px;
}
.cds-calc-widget__field { margin-bottom: 10px; }
.cds-calc-widget__field-input {
  width: 100%; padding: 11px 14px; box-sizing: border-box;
  border: 1.5px solid var(--ds-line, #e3e3e3); border-radius: var(--ds-r-md,8px);
  font-size: 14px; color: var(--ds-ink, #0a225e); background: #fff;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.cds-calc-widget__field-input::placeholder { color: #9aa2b1; }
.cds-calc-widget__field-input:focus {
  border-color: var(--ds-accent, #2e47d7);
  box-shadow: 0 0 0 3px rgba(46, 71, 215, .12);
}
.cds-calc-widget__field-input--error {
  border-color: oklch(55% .19 25);
  box-shadow: 0 0 0 3px oklch(55% .19 25 / .14);
}
.cds-calc-widget__field-err {
  display: block; font-size: 12px; color: oklch(50% .19 25);
  margin-top: 4px; min-height: 0;
}

.cds-calc-widget__email-btn {
  display: block; width: 100%; min-height: 46px; margin-top: 4px;
  padding: 12px 20px;
  background: var(--ds-accent, #2e47d7); color: #fff;
  border: none; border-radius: var(--ds-r-md,8px);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: opacity .2s, box-shadow .2s;
}
.cds-calc-widget__email-btn:hover { opacity: .9; }
.cds-calc-widget__email-btn:disabled { opacity: .45; cursor: default; }
.cds-calc-widget__email-btn:focus-visible {
  outline: 2px solid var(--ds-accent, #2e47d7); outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(46, 71, 215, .15);
}
.cds-calc-widget__consent {
  font-size: 12px; color: var(--ds-muted, #5a6470); line-height: 1.5; margin: 10px 0 0;
}
.cds-calc-widget__consent a { color: var(--ds-accent, #2e47d7); }

.cds-calc-widget__sent {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13.5px; line-height: 1.5; color: oklch(45% .12 152);
  font-weight: 500;
}
.cds-calc-widget__sent svg { flex-shrink: 0; margin-top: 1px; }

/* CTA для индивидуального расчёта */
.cds-calc-widget__cta {
  font-size: 13.5px; line-height: 1.55; color: var(--ds-muted, #5a6470); margin-top: 14px;
}
.cds-calc-widget__cta a { color: var(--ds-accent, #2e47d7); font-weight: 600; }

/* ──────────────────────── reduced motion ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cds-calc-widget__result-price { animation: none; }
  .cds-sv-opt, .cds-sv-seg-opt, .cds-sv-ind,
  .cds-calc-widget__field-input, .cds-calc-widget__email-btn { transition: none; }
}

/* ──────────────────────── Адаптив ──────────────────────── */
@media (max-width: 960px) {
  .cds-calc-widget__grid { grid-template-columns: 1fr; gap: 20px; }
  .cds-calc-widget__panel { position: static; max-height: none; }
  .cds-calc-widget__form { padding: 24px 22px 26px; }
}
@media (max-width: 520px) {
  .cds-calc-widget__form { padding: 20px 16px 22px; }
  .cds-calc-widget__panel { padding: 20px 16px; }
  .cds-sv-opt { min-height: 48px; font-size: 14px; padding: 11px 14px; }
  .cds-calc-widget__result-price { font-size: 30px; }
}
