/* ===================================================================
   modal.css — Unified modals (FINAL)
   =================================================================== */

:root {
  --z-modal: 7000;
  --modal-backdrop: rgba(15, 23, 42, 0.55);
  --modal-radius: 20px;
  --modal-shadow: 0 16px 40px rgba(31, 38, 135, 0.22);
  --modal-bg: rgba(255, 255, 255, 0.94);
  --modal-border: rgba(255, 255, 255, 0.98);
  --modal-pad: 18px;
  --modal-maxw: 560px;
  --modal-btn-h: 44px;
  --modal-primary: var(--accent, #4c6fff);
  --modal-primary-hover: var(--accent-alt, #2bc5d9);
}

/* ===== Backdrop ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--modal-backdrop);
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.modal.open,
.modal.active {
  display: flex;
}

/* ===== Scroll lock ===== */
html.modal-open,
body.modal-open {
  overscroll-behavior: none;
}

body.modal-open {
  overflow: hidden;
}

/* ===== Content ===== */
.modal-content {
  position: relative;
  width: min(var(--modal-maxw), calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: var(--modal-pad);
  border-radius: var(--modal-radius);
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  box-shadow: var(--modal-shadow);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  transform: translateY(6px);
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.modal.open .modal-content,
.modal.active .modal-content {
  transform: translateY(0);
  opacity: 1;
}

/* ===== Typography ===== */
.modal-content h2,
.modal-content h3 {
  margin: 0 0 10px;
  font-weight: 800;
  color: var(--text-main, #0f172a);
}

.modal-content p {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-soft, #4b5563);
}

/* ===== Close ===== */
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}

@media (hover: hover) {
  .modal-close:hover {
    color: #0f172a;
    transform: translateY(-1px);
  }
}

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

/* ===== Buttons ===== */
.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
  flex-wrap: wrap;
}

.modal-buttons button,
.modal-buttons .btn-confirm,
.modal-buttons .btn-cancel {
  min-height: var(--modal-btn-h);
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: var(--text-main, #0f172a);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.modal-buttons .btn-confirm {
  background: linear-gradient(
    130deg,
    var(--modal-primary),
    var(--modal-primary-hover)
  );
  color: #fff;
  border: none;
  box-shadow: 0 12px 30px rgba(31, 38, 135, 0.18);
}

@media (hover: hover) {
  .modal-buttons button:hover,
  .modal-buttons .btn-confirm:hover,
  .modal-buttons .btn-cancel:hover {
    transform: translateY(-1px);
  }
}

.modal-buttons button:active,
.modal-buttons .btn-confirm:active,
.modal-buttons .btn-cancel:active {
  transform: scale(0.98);
}

/* ===== Auth modal fixes (close + button) ===== */
#authModal .modal-close {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #94a3b8;
}

/* Кнопка авторизации — делаем настоящей кнопкой (не “плашкой по тексту”) */
#authModal .auth-button {
  display: flex !important;
  align-items: center;
  justify-content: center;

  width: 100%;
  min-height: 48px;

  padding: 0 20px;
  border-radius: 16px;

  font-size: 16px;
  font-weight: 700;
  line-height: 1;

  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;

  background: linear-gradient(
    130deg,
    var(--modal-primary),
    var(--modal-primary-hover)
  ) !important;

  border: none !important;
  box-shadow: 0 10px 26px rgba(31, 38, 135, 0.25);

  text-decoration: none;
  white-space: nowrap;

  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

@media (hover: hover) {
  #authModal .auth-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(31, 38, 135, 0.35);
    filter: brightness(1.03);
  }
}

#authModal .auth-button:active {
  transform: scale(0.97);
  box-shadow: 0 6px 18px rgba(31, 38, 135, 0.2);
}

/* ===== Modal textarea unified style ===== */
.modal textarea,
.modal-content textarea {
  width: 100%;
  min-height: 110px;

  padding: 12px 14px;
  margin-top: 10px;

  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;

  color: var(--text-main, #0f172a);
  background: rgba(248, 250, 252, 0.96);

  border-radius: 12px;
  border: 1px solid rgba(203, 213, 225, 0.9);

  resize: vertical;
  outline: none;

  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    background 0.18s ease;
}

.modal textarea::placeholder,
.modal-content textarea::placeholder {
  color: #94a3b8;
}

.modal textarea:focus,
.modal-content textarea:focus {
  border-color: rgba(76, 111, 255, 0.65);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(76, 111, 255, 0.15);
}

/* ===== Mobile bottom-sheet ===== */
@media (max-width: 1024px) {
  .modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    width: 100%;
    max-width: none;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    transform: translateY(100%);
    opacity: 1; /* шторка без fade */
    transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  .modal.open .modal-content,
  .modal.active .modal-content {
    transform: translateY(0);
  }
}

/* ===== Small screens: actions full width ===== */
@media (max-width: 520px) {
  .modal-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .modal-buttons button,
  .modal-buttons .btn-confirm,
  .modal-buttons .btn-cancel {
    width: 100%;
    justify-content: center;
  }
}
/* =========================================================
   SERVICES -> EXTRACT: "Как это работает?" (button + modal design)
   Перенеси в modal.css (или отдельный how-it-works.css)
   ========================================================= */

/* Кнопка "Как это работает" — обычный вес и курсор-рука */
#howItWorksBtn {
  font-weight: 400;
  cursor: pointer;
}

#howItWorksBtn:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-ink-sm, 0 6px 18px rgba(0, 0, 0, 0.08));
}

/* Корпус модалки */
#howItWorksModal .modal-content {
  position: relative;
  overflow: hidden;

  padding: 16px 16px 14px;
  border-radius: var(--radius-lg, 20px);

  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.95);

  box-shadow: 0 16px 40px rgba(31, 38, 135, 0.25);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);

  max-width: 560px;
  width: 94%;
}

/* Заголовок */
#howItWorksModal h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: #0f172a;
}

/* Подзаголовок */
#howItWorksModal .modal-subtitle {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #4b5563;
}

/* Список шагов */
#howItWorksModal .steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Один шаг */
#howItWorksModal .step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

/* Номер шага */
#howItWorksModal .step-number {
  min-width: 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 800;
  font-size: 14px;
  color: #ffffff;

  background: linear-gradient(135deg, #4c6fff, #2bc5d9);
  box-shadow: 0 0 0 3px rgba(76, 111, 255, 0.15);
}

/* Текст шага */
#howItWorksModal .step h3 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

#howItWorksModal .step p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #4b5563;
}

/* Блок "Важно" */
#howItWorksModal .note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;

  background: rgba(76, 111, 255, 0.08);
  color: #0f172a;

  font-size: 14px;
  line-height: 1.45;
}

/* Кнопки */
#howItWorksModal .modal-buttons {
  margin-top: 16px;
}

/* На services кнопка выглядит как большая CTA */
#howItWorksModal .btn-confirm {
  width: 100%;
}
/* =========================================================
   HOW IT WORKS — MOBILE BOTTOM SHEET (под ваш modal.css)
   ========================================================= */
@media (max-width: 768px) {
  #howItWorksModal {
    align-items: flex-end;
    padding: 0;
  }

  #howItWorksModal .modal-content {
    max-width: none;
    width: 100%;
    margin: 0;

    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow: auto;

    transform: translateY(100%);
    transition: transform 0.35s ease;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));

    /* ✅ FIX: убираем синюю внутреннюю inset-тень (правый верхний угол) */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6),
      0 18px 40px rgba(0, 0, 0, 0.18);
  }

  /* Открытое состояние — через классы (НЕ через style*="display") */
  #howItWorksModal.open .modal-content,
  #howItWorksModal.active .modal-content {
    transform: translateY(0);
  }

  /* “Ручка” (если используете drag-area) */
  #howItWorksModal .modal-drag {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: #d1d5db;
    margin: 0 auto 12px;
  }

  /* Крестик (если решите добавить) */
  #howItWorksModal .modal-close {
    top: 12px;
    right: 12px;
    font-size: 22px;
  }

  /* Кнопка всегда доступна (липкая зона) */
  #howItWorksModal .modal-buttons {
    position: sticky;
    bottom: 0;
    background: linear-gradient(
      to top,
      rgba(255, 255, 255, 0.98),
      rgba(255, 255, 255, 0.85),
      transparent
    );
    padding-top: 12px;
    margin-top: 16px;
  }
}
#howItWorksModal .modal-content::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  top: -80px;
  right: -80px;
  opacity: 0.9;
  background: radial-gradient(
    circle,
    rgba(76, 111, 255, 0.22),
    transparent 70%
  );
}
.modal-content ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-soft, #4b5563);
  line-height: 1.5;
  font-size: 15px;
}

.modal-content li + li {
  margin-top: 6px;
}
.modal input:not([type="hidden"]),
.modal-content input:not([type="hidden"]) {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  margin-top: 10px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-main, #0f172a);
  background: rgba(248, 250, 252, 0.96);
  border-radius: 12px;
  border: 1px solid rgba(203, 213, 225, 0.9);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    background 0.18s ease;
}
.modal input:not([type="hidden"]):focus,
.modal-content input:not([type="hidden"]):focus {
  border-color: rgba(76, 111, 255, 0.65);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(76, 111, 255, 0.15);
}
/* =========================================================
   FEEDBACK FORM (about.html): icons inside inputs + errors
   Fixes: иконки "вылезают" слева и не совпадают по высоте с инпутами.
   ========================================================= */

/* Группа поля */
.modal .form-group,
.modal-content .form-group {
  position: relative;
  margin-top: 10px;
}

.modal .form-group:first-child,
.modal-content .form-group:first-child {
  margin-top: 0;
}

/* Иконка слева — внутри поля */
.modal .form-group .input-icon,
.modal-content .form-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: rgba(15, 23, 42, 0.55);
  pointer-events: none;
}

/* Снимаем margin-top у input/textarea внутри form-group,
   чтобы иконка и поле были на одной строке */
.modal .form-group input:not([type="hidden"]),
.modal-content .form-group input:not([type="hidden"]),
.modal .form-group textarea,
.modal-content .form-group textarea {
  margin-top: 0;
}

/* Отступ слева под иконку */
.modal .form-group input:not([type="hidden"]),
.modal-content .form-group input:not([type="hidden"]),
.modal .form-group textarea,
.modal-content .form-group textarea {
  padding-left: 44px;
}

/* Текстовое поле: иконку ставим сверху */
.modal .form-group-textarea .input-icon,
.modal-content .form-group-textarea .input-icon {
  top: 18px;
  transform: none;
}

/* Ошибки валидации */
.modal .error-message,
.modal-content .error-message {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.25;
  color: #ef4444;
}
/* ============================
   TOAST (about.js) – FINAL FIX
   classes: .toast-stack / .toast / .toast__icon / .toast__msg / .toast__close
   ============================ */

.toast-stack {
  position: fixed !important;
  left: 50% !important;
  bottom: 96px !important; /* чтобы не наезжало на нижнее меню */
  transform: translateX(-50%) !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  pointer-events: none !important;
}

/* Сам тост */
.toast {
  width: 460px;
  max-width: calc(100vw - 32px);
  padding: 18px 20px;
  border-radius: 22px;

  display: flex;
  align-items: center;
  gap: 14px;

  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;

  background: linear-gradient(135deg, #2563eb, #38bdf8);
  box-shadow: 0 14px 36px rgba(37, 99, 235, 0.45);
  backdrop-filter: blur(14px);

  pointer-events: auto;
}

/* Типы из скрипта: toast--success / toast--error / toast--info */
.toast.toast--success {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
}
.toast.toast--error {
  background: linear-gradient(135deg, #ef4444, #fb7185);
}
.toast.toast--info {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
}

/* Убираем любые “доп.галочки”, если они были добавлены ранее */
.toast::before,
.toast::after {
  content: none !important;
  display: none !important;
}

/* Иконка из твоего JS (.toast__icon) */
.toast__icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
  font-weight: 900;
  color: #fff;
}

/* Текст */
.toast__msg {
  flex: 1 1 auto;
  min-width: 0;
}

/* Крестик (он у тебя .toast__close) — скрываем полностью */
.toast__close {
  display: none !important;
}

/* Анимация (твои классы toast--out уже есть в JS) */
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.toast {
  animation: toastIn 0.28s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.toast.toast--out {
  animation: toastOut 0.18s ease-in both;
}

/* Мобилки: ещё выше, чтобы точно не пряталось */
@media (max-width: 600px) {
  .toast-stack {
    bottom: 110px !important;
  }
  .toast {
    width: calc(100vw - 24px);
    max-width: none;
  }
}
