/* =========================================================
 * Модалка «Індекс прозорості Wizfinder»
 * Открывается кликом по бейджу .credit-rating-badge (.js-wf-rating-badge)
 * =======================================================*/

.wf-rmodal {
  --wf-c-cond: #085C44;
  --wf-c-transp: #00C677;
  --wf-c-access: #BEE5B7;

  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wf-rmodal[hidden] {
  display: none;
}

body.wf-rmodal-open {
  overflow: hidden;
}

.wf-rmodal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 24, 0.55);
  backdrop-filter: blur(2px);
  animation: wf-rmodal-fade 0.2s ease;
}

.wf-rmodal__dialog {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  padding: 32px;
  animation: wf-rmodal-pop 0.22s ease;
}

@keyframes wf-rmodal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes wf-rmodal-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.wf-rmodal__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 1px solid #e3e6e8;
  border-radius: 50%;
  background: #fff;
  font-size: 24px;
  line-height: 1;
  color: #4a4a4a;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.wf-rmodal__close:hover {
  background: #f2f4f5;
  transform: rotate(90deg);
}

.wf-rmodal__grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 36px;
}

/* ---------- Ліва колонка ---------- */
.wf-rmodal__title {
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  color: #16181d;
  margin: 0 0 24px;
}

.wf-rmodal__chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.wf-rmodal__donut {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  /* Веса: Умови 55% (0-198deg), Прозорість 27% (198-295.2deg), Доступність 18% */
  background: conic-gradient(
    var(--wf-c-cond) 0 55%,
    var(--wf-c-transp) 55% 82%,
    var(--wf-c-access) 82% 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
}

.wf-rmodal__donut::before {
  content: "";
  position: absolute;
  inset: 30px;
  background: #fff;
  border-radius: 50%;
}

.wf-rmodal__donut-hole {
  position: relative;
  z-index: 1;
  max-width: 90px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #5a6169;
  line-height: 1.25;
}

.wf-rmodal__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wf-rmodal__legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #2b2f36;
}

.wf-rmodal__legend-weight {
  margin-left: auto;
  font-weight: 700;
  color: #16181d;
}

.wf-rmodal__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.wf-rmodal__dot--cond { background: var(--wf-c-cond); }
.wf-rmodal__dot--transp { background: var(--wf-c-transp); }
.wf-rmodal__dot--access { background: var(--wf-c-access); }

.wf-rmodal__method-link {
  display: inline-block;
  margin-top: 24px;
  font-weight: 600;
  color: #0a6cff;
  text-decoration: underline;
}

/* ---------- Права колонка ---------- */
.wf-rmodal__provider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.wf-rmodal__logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
}

.wf-rmodal__provider-name {
  font-size: 20px;
  font-weight: 700;
  color: #16181d;
}

.wf-rmodal__score {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 44px;
  padding: 0 14px;
  border-radius: 22px 22px 22px 0;
  background: #00c677;
  color: #e6ffe0;
  font-weight: 700;
  font-size: 16px;
}

.wf-rmodal__score--green { background: #00c677; color: #e6ffe0; }
.wf-rmodal__score--yellow { background: #eab806; color: #1f1f1f; }
.wf-rmodal__score--orange { background: #ee742e; color: #fff; }
.wf-rmodal__score--red { background: #da3b3b; color: #fff; }

.wf-rmodal__subtitle {
  margin: 0 0 18px;
  font-size: 13px;
  color: #8a9098;
}

.wf-rmodal__breakdown {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.wf-rmodal__row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.wf-rmodal__row-label {
  font-weight: 600;
  color: #2b2f36;
}

.wf-rmodal__row-weight {
  font-size: 12px;
  color: #9aa0a8;
}

.wf-rmodal__row-value {
  margin-left: auto;
  font-weight: 700;
  color: #16181d;
}

.wf-rmodal__bar {
  height: 8px;
  border-radius: 6px;
  background: #eef1f3;
  overflow: hidden;
}

.wf-rmodal__bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  transition: width 0.5s ease;
}

.wf-rmodal__bar--cond .wf-rmodal__bar-fill { background: var(--wf-c-cond); }
.wf-rmodal__bar--transp .wf-rmodal__bar-fill { background: var(--wf-c-transp); }
.wf-rmodal__bar--access .wf-rmodal__bar-fill { background: var(--wf-c-access); }

.wf-rmodal__factors {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: #8a9098;
}

/* ---------- Шкала оцінок ---------- */
.wf-rmodal__scale {
  border-top: 1px solid #eef1f3;
  padding-top: 18px;
}

.wf-rmodal__scale-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #16181d;
  margin-bottom: 12px;
}

.wf-rmodal__scale-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wf-rmodal__scale-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.wf-rmodal__scale-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.wf-rmodal__scale-badge--green { background: #00c677; color: #e6ffe0; }
.wf-rmodal__scale-badge--yellow { background: #eab806; color: #1f1f1f; }
.wf-rmodal__scale-badge--orange { background: #ee742e; color: #fff; }
.wf-rmodal__scale-badge--red { background: #da3b3b; color: #fff; }

.wf-rmodal__scale-text {
  font-size: 13px;
  line-height: 1.4;
  color: #5a6169;
}

.wf-rmodal__scale-text strong {
  color: #16181d;
  margin-right: 4px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 720px) {
  .wf-rmodal {
    padding: 0;
    align-items: flex-end;
  }

  .wf-rmodal__dialog {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    padding: 24px 20px 28px;
  }

  .wf-rmodal__grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .wf-rmodal__title {
    font-size: 19px;
    margin-bottom: 18px;
    padding-right: 40px;
  }

  .wf-rmodal__donut {
    width: 168px;
    height: 168px;
  }
}
