/* ── Floating tab ──────────────────────────────── */
.mp-tab {
  display: flex; align-items: center; justify-content: center;
  background: #E8312A; width: 40px; height: 160px;
  position: fixed; bottom: 80px; right: -1px;
  border: 1px solid #E8312A; border-right-color: transparent;
  border-radius: 8px 0 0 8px; z-index: 9998; cursor: pointer;
  box-shadow: -2px 0 10px rgba(232,49,42,0.3);
  transition: width 150ms ease, background 150ms ease, opacity 150ms ease;
}
.mp-tab:hover { background: #C8261F; width: 44px; }
.mp-tab--hidden { opacity: 0; pointer-events: none; }
.mp-tab__text {
  writing-mode: vertical-rl; transform: rotate(180deg);
  color: #fff; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; user-select: none;
}

/* ── Auto-popup (появляется через 9 сек) ────────── */
.mp-popup {
  position: fixed; bottom: 90px; right: 60px; z-index: 9997;
  background: #fff; border-radius: 16px; padding: 24px 20px 20px;
  width: 280px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.18), 0 4px 12px rgba(232,49,42,0.12);
  border-top: 3px solid #E8312A;
  transform: translateY(20px); opacity: 0;
  transition: transform 300ms cubic-bezier(0.0,0.0,0.2,1), opacity 300ms ease;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.mp-popup.is-visible {
  transform: translateY(0); opacity: 1; pointer-events: auto;
}
.mp-popup__close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; font-size: 18px; color: #aaa;
  cursor: pointer; line-height: 1; padding: 2px 6px;
}
.mp-popup__close:hover { color: #555; }
.mp-popup__title {
  font-size: 15px; font-weight: 700; color: #0E0E0E;
  margin: 0 0 8px; line-height: 1.3;
}
.mp-popup__text {
  font-size: 13px; color: #666; margin: 0 0 16px; line-height: 1.5;
}
.mp-popup__btn {
  display: block; width: 100%; background: #E8312A; color: #fff;
  border: none; border-radius: 8px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; text-align: center;
  transition: background 150ms ease;
}
.mp-popup__btn:hover { background: #C8261F; }
.mp-popup__note { font-size: 11px; color: #aaa; margin: 8px 0 0; text-align: center; }

/* ── Оверлей модалки ────────────────────────────── */
.mp-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55); z-index: 99999;
  align-items: center; justify-content: center;
}
.mp-overlay.is-open { display: flex; }

/* ── Модалка с формой ───────────────────────────── */
.mp-modal {
  background: #0D1117; color: #fff; border-radius: 20px;
  width: min(480px, 96vw); max-height: 92vh; overflow-y: auto;
  position: relative; box-shadow: 0 25px 50px rgba(0,0,0,0.5);
  animation: mp-in 220ms cubic-bezier(0.0,0.0,0.2,1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  padding: 32px 32px 28px;
}
.mp-modal__close {
  position: absolute; top: 14px; right: 16px;
  background: rgba(255,255,255,0.08); border: none; border-radius: 50%;
  width: 32px; height: 32px; font-size: 18px; cursor: pointer; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.mp-modal__close:hover { background: rgba(255,255,255,0.15); }

/* Форма */
.mp-form__logo { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.mp-form__logo-dot { width: 28px; height: 28px; background: #E8312A; border-radius: 6px; }
.mp-form__logo-text { font-size: 14px; font-weight: 700; color: #fff; }
.mp-form__logo-sub { font-size: 11px; color: rgba(255,255,255,0.4); }
.mp-form__title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.mp-form__sub { font-size: 13px; color: rgba(255,255,255,0.45); margin: 0 0 24px; }

.mp-progress { display: flex; gap: 4px; margin-bottom: 24px; }
.mp-progress__bar { height: 3px; flex: 1; border-radius: 2px; background: rgba(255,255,255,0.1); }
.mp-progress__bar.active { background: #E8312A; }

.mp-label { display: block; font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 8px; }
.mp-field { margin-bottom: 16px; }
.mp-select-btn {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 11px 14px; color: #fff; font-size: 14px;
  text-align: left; display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; font-family: inherit; transition: border-color 150ms;
}
.mp-select-btn:hover, .mp-select-btn.active { border-color: #E8312A; }
.mp-select-btn .placeholder { color: rgba(255,255,255,0.3); }
.mp-dropdown {
  display: none; position: absolute; z-index: 10; width: 100%; margin-top: 4px;
  background: #161B22; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; max-height: 200px; overflow-y: auto;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}
.mp-dropdown.open { display: block; }
.mp-dropdown__item {
  padding: 10px 14px; font-size: 13px; color: rgba(255,255,255,0.7);
  cursor: pointer; transition: background 100ms;
}
.mp-dropdown__item:hover, .mp-dropdown__item.selected { background: rgba(232,49,42,0.1); color: #fff; }
.mp-field-wrap { position: relative; }

.mp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mp-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(232,49,42,0.15); border: 1px solid rgba(232,49,42,0.35);
  border-radius: 20px; padding: 3px 10px; font-size: 12px; color: #fff;
}
.mp-tag__x { background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; }
.mp-tag__x:hover { color: #fff; }

.mp-input {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 11px 14px; color: #fff; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color 150ms;
}
.mp-input:focus { border-color: #E8312A; }
.mp-input::placeholder { color: rgba(255,255,255,0.3); }

.mp-city-hint { font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 5px; }
.mp-city-hint-pre { font-size: 11px; color: rgba(255,255,255,0.3); margin-top: 5px; }
.mp-textarea { resize: vertical; min-height: 58px; line-height: 1.5; font-family: inherit; }
.mp-opt { color: rgba(255,255,255,0.3); font-weight: 400; text-transform: none; letter-spacing: 0; }

.mp-btn {
  width: 100%; background: #E8312A; color: #fff; border: none; border-radius: 10px;
  padding: 13px; font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: inherit; margin-top: 8px; transition: background 150ms;
}
.mp-btn:hover:not(:disabled) { background: #C8261F; }
.mp-btn:disabled { opacity: 0.4; cursor: default; }
.mp-btn-back { background: none; border: none; color: rgba(255,255,255,0.4); font-size: 13px; cursor: pointer; font-family: inherit; padding: 0; margin-top: 10px; display: inline-block; }
.mp-btn-back:hover { color: rgba(255,255,255,0.7); }

.mp-error { color: #ff6b6b; font-size: 13px; margin-top: 8px; }

.mp-consent { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; }
.mp-consent input { margin-top: 2px; accent-color: #E8312A; cursor: pointer; }
.mp-consent label { font-size: 11px; color: rgba(255,255,255,0.35); line-height: 1.5; cursor: pointer; }
.mp-consent strong { color: rgba(255,255,255,0.55); }

.mp-success { text-align: center; padding: 20px 0; }
.mp-success__icon { font-size: 48px; margin-bottom: 16px; }
.mp-success__title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.mp-success__text { font-size: 14px; color: rgba(255,255,255,0.5); }

@keyframes mp-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
/* iOS safe area (notch / home bar) + базовая позиция таба */
.mp-tab {
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}

/* Планшеты */
@media (min-width: 481px) and (max-width: 1024px) {
  .mp-tab { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* Мобильные — поднять выше мобильного UI браузера */
@media (max-width: 480px) {
  .mp-tab {
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    width: 36px;
    height: 140px;
  }
  .mp-tab__text { font-size: 11px; }
}

@media (max-width: 500px) {
  .mp-modal { padding: 24px 20px 20px; }
  .mp-popup { right: 12px; left: 12px; width: auto; bottom: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .mp-modal { animation: none; }
  .mp-popup { transition: none; }
  .mp-tab { transition: none; }
}
