/* =========================================
   PANIC ATTACK MODULE
   panic-attack.css
   ========================================= */


/* =========================================
   БОЛЬШАЯ МОДАЛКА (7 шагов)
   ========================================= */

.panic-back {
  position: fixed;
  inset: 0;
  /* Было полупрозрачное затемнение, сквозь которое видно интерфейс.
     Делаем глухой чёрный фон, чтобы ничего не отвлекало. */
  background: #000;

  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 210;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

.panic-back.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ModelPanicAttack-main {
  position: relative;
  width: min(480px, 100% - 32px);
  max-height: calc(100% - 48px);
  background: var(--ink);
  color: var(--text);
  border-radius: 18px;
  padding: 16px 16px 14px;
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Кнопка закрытия в правом верхнем углу */

.panic-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}

.panic-close:active {
  transform: scale(0.96);
}

/* --- Header: прогресс + заголовок шага --- */

.panic-header {
  padding-right: 28px; /* чтобы не заезжать под крестик */
}

.panic-progress {
  margin-bottom: 10px;
}

.panic-progress-bar {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.panic-progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--violet));
  border-radius: inherit;
  transition: width 0.25s ease-out;
}

.panic-progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

/* контейнер точки шага */
.panic-step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* сам кружок */
.panic-step-dot::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
}

/* цифра под кружком — берётся из data-step */
.panic-step-dot::after {
  content: attr(data-step);
  font-size: 10px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
}

.panic-step-dot.is-active::before {
  background: var(--pink);
}
.panic-step-meta {
  margin-top: 10px;
}

.panic-step-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
  margin-bottom: 4px;
}

.panic-step-title {
  font-size: 16px;
  font-weight: 600;
}

/* --- Body (текст шага, есть скролл) --- */

.panic-body {
  margin-top: 12px;
  padding-right: 6px;
  padding-bottom: 6px;
  overflow-y: auto;
  min-height: 260px;  /* фиксируем «коробку» под шаги */
  max-height: 60vh;   /* чуть больше, но в границах экрана */
}

.panic-step-text {
  font-size: 14px;
  line-height: 1.5;
}

.panic-step-text p + p {
  margin-top: 6px;
}

.panic-step-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.8;
}

/* --- Footer: кнопки управления --- */

.panic-footer {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;              /* можно переносить строки */
}

.panic-btn {
  flex: 1 1 0;
  min-height: 38px;
  font-size: 14px;
  white-space: normal;          /* разрешаем перенос текста */
  text-align: center;
}

/* "Назад" — по содержимому, чтобы больше места досталось другим */
.panic-btn-prev {
  flex: 0 0 auto;
}

/* финальные кнопки используют общий flex из .panic-btn */
.panic-btn-exit {
  /* больше не задаём отдельный flex, наследует общий */
}

.panic-btn-not-helped {
  /* тоже только стилистика через btn-outline-pink */
}

/* Когда кнопка disabled — приглушаем */
.panic-btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* Когда кнопка помечена hidden — полностью убираем с экрана */
.panic-btn[hidden] {
  display: none !important;
}

/* =========================================
   МАЛЕНЬКИЕ МОДАЛКИ (после "мне помогло / не помогло")
   ========================================= */

.panic-back-small {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 220;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

.panic-back-small.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ModelPanicAttack-small {
  width: min(360px, 100% - 40px);
  background: var(--ink);
  color: var(--text);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow:
    0 14px 35px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  box-sizing: border-box;
}

.panic-small-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panic-small-title {
  font-size: 16px;
  font-weight: 600;
}

.panic-small-text {
  font-size: 13px;
  line-height: 1.5;
}

.panic-small-text p + p {
  margin-top: 6px;
}

.panic-small-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.panic-small-actions .btn {
  min-height: 34px;
  font-size: 13px;
}

/* =========================================
   КРУГ ДЫХАНИЯ (шаг 2)
   ========================================= */

.panic-breathing {
  margin-top: 14px;
  padding: 12px 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top, rgba(234, 169, 255, 0.15), transparent 60%),
    radial-gradient(circle at bottom, rgba(246, 239, 174, 0.08), transparent 55%),
    rgba(0, 0, 0, 0.3);
}

.panic-breathing-top {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}

.breath-phase-label {
  font-weight: 600;
}

.breath-cycle-counter {
  opacity: 0.8;
}

.panic-breathing-circle-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0 12px;
}

.panic-breathing-circle {
  position: relative;
  width: 200px;
  height: 200px;
  max-width: 70vw;
  max-height: 70vw;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 10px 24px rgba(0, 0, 0, 0.45);
  /* даём точке выходить за границы, чтобы центр шёл ровно по контуру */
  overflow: visible;
}

/* Круговой режим — 4–2–6 по кругу */
.panic-breathing-circle.is-circle {
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background:
    conic-gradient(
      from -90deg,
      var(--sand) 0deg,
      var(--sand) calc(360deg * 4 / 12), /* вдох 4 */
      var(--violet) calc(360deg * 4 / 12),
      var(--violet) calc(360deg * 6 / 12), /* пауза 2 (4+2) */
      var(--pink)   calc(360deg * 6 / 12),
      var(--pink)   360deg                 /* выдох 6 (остаток до 12) */
    );
}

/* Квадратный режим — строгая коробочка, точка идёт по самой линии */
.panic-breathing-circle.is-box {
  border-radius: 0; /* строгий квадрат */
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(0, 0, 0, 0.65);
}

.breath-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%) rotate(-90deg); /* старт сверху */
  transform-origin: center center;
}

.breath-dot {
  position: absolute;
  top: 0;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 4px rgba(241, 100, 179, 0.35);
}

.breath-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 104px;
  height: 104px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 10px 20px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.breath-center-phase {
  font-size: 12px;
  opacity: 0.85;
}

.breath-center-count {
  font-size: 24px;
  font-weight: 600;
}

.panic-breathing-bottom {
  display: flex;
  gap: 8px;
}

.panic-breath-btn {
  flex: 1 1 0;
  min-height: 36px;
  font-size: 13px;
}

.breath-mode-toggle {
  display: flex;
  gap: 4px;
  padding: 2px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  justify-content: center;
  margin: 6px auto 10px; /* центрируем под кругом/квадратом */
  max-width: 100%;
}

.breath-mode-btn {
  flex: 1 1 0;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.breath-mode-btn.is-active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Небольшая адаптация для совсем маленьких экранов */

@media (max-height: 600px) {
  .ModelPanicAttack-main {
    max-height: calc(100% - 24px);
  }
  .panic-body {
    max-height: 52vh;
  }
  .panic-breathing-circle {
    width: 170px;
    height: 170px;
  }
  .breath-center {
    width: 90px;
    height: 90px;
  }
}