/* KaDerix — главная: рабочая модель заказа на FunPay (чат покупателя + Telegram продавца).
   Подключается после kaderix-theme.css: цвета, кнопки, шапка, подвал и первый экран («KaDerix!») берутся оттуда.
   Классы с префиксом fp-, чтобы не пересекаться с остальной темой. */

.fp-section { padding: 3.5rem 0; border-top: 1px solid var(--line); }

.fp-h2 {
  max-width: 24ch;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.fp-sub { max-width: 44rem; margin-top: 0.8rem; color: var(--muted); }

.fp-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
  gap: 3rem;
  align-items: start;
}

/* ---------- модель заказа ---------- */

.fp-sim {
  display: grid;
  grid-template-columns: minmax(0, 20rem) minmax(0, 1fr) 17.5rem;
  grid-template-areas:
    "form chat phone"
    "order order order";
  gap: 1.25rem;
  align-items: stretch;
  margin-top: 2rem;
}

.fp-left { display: contents; }
.fp-form { grid-area: form; align-content: space-between; }
.fp-chatwin { grid-area: chat; }
.fp-device { grid-area: phone; }
.fp-ordercard { grid-area: order; }

.fp-card {
  padding: 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
}

.fp-form { display: grid; gap: 1.1rem; }

.fp-label { display: block; margin-bottom: 0.45rem; color: var(--muted); font-size: 0.85rem; font-weight: 650; }

.fp-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.35rem; }
.fp-seg label { position: relative; }

.fp-seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.fp-seg span {
  display: grid;
  place-items: center;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fp-seg input:hover + span { background: rgba(233, 240, 234, 0.06); color: var(--ink); }
.fp-seg input:checked + span { border-color: var(--lime); background: rgba(182, 242, 74, 0.1); color: var(--ink); }
.fp-seg input:focus-visible + span { outline: 2px solid var(--lime); outline-offset: 2px; }
.fp-seg input:disabled { cursor: not-allowed; }

.fp-input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.fp-input::placeholder { color: var(--muted); opacity: 0.8; }
.fp-input:focus-visible { border-color: var(--lime); }
.fp-input:disabled { opacity: 0.55; }
.fp-input[aria-invalid="true"] { border-color: var(--error); }

.fp-hint { margin-top: 0.35rem; color: var(--muted); font-size: 0.82rem; min-height: 1.2em; }
.fp-hint.is-error { color: var(--error); }

/* переключатели настроек плагина */
.fp-opt {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fp-opt:hover { background: rgba(233, 240, 234, 0.04); }
.fp-opt-text { display: grid; gap: 0.15rem; }
.fp-opt-title { font-size: 0.95rem; font-weight: 650; }
.fp-opt-desc { color: var(--muted); font-size: 0.82rem; line-height: 1.4; }

.fp-switch {
  position: relative;
  flex: none;
  width: 2.75rem;
  height: 1.6rem;
  margin: 0.1rem 0 0;
  border-radius: 999px;
  background: rgba(233, 240, 234, 0.16);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.2s ease;
}

.fp-switch::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.2s ease, background 0.2s ease;
}

.fp-switch:checked { background: var(--lime); }
.fp-switch:checked::after { transform: translateX(1.15rem); background: var(--lime-ink); }
.fp-switch:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.fp-switch:disabled { opacity: 0.5; cursor: not-allowed; }

.fp-opt:has(.fp-switch:checked) { border-color: rgba(182, 242, 74, 0.55); background: rgba(182, 242, 74, 0.06); }
.fp-opt-fail:has(.fp-switch:checked) { border-color: rgba(255, 107, 107, 0.6); background: rgba(255, 107, 107, 0.07); }
.fp-opt-fail .fp-switch:checked { background: var(--error); }
.fp-opt-fail .fp-switch:checked::after { background: var(--ink); }

.fp-pay { height: 3rem; width: 100%; font-size: 1rem; }

.fp-ordercard {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto;
  gap: 1.5rem 2.5rem;
  align-items: start;
}

.fp-order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.fp-order-id { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.fp-order-sub { color: var(--muted); font-size: 0.88rem; }

.fp-pill {
  flex: none;
  padding: 0.2rem 0.7rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
}

.fp-pill[data-state="wait"] { color: var(--warning); }
.fp-pill[data-state="paid"] { color: var(--accent); }
.fp-pill[data-state="closed"] { color: var(--success); }
.fp-pill[data-state="refund"] { color: var(--error); }

.fp-dl { margin: 0.9rem 0 0; border-top: 1px solid var(--line); }
.fp-dl > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.fp-dl dt { color: var(--muted); }
.fp-dl dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.fp-box-title { margin-bottom: 0.5rem; color: var(--muted); font-size: 0.85rem; font-weight: 650; }

.fp-checks { display: grid; gap: 0.4rem; list-style: none; font-size: 0.93rem; }
.fp-check { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); }
.fp-check::before {
  content: "";
  display: grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
}

.fp-check[data-s="doing"] { color: var(--ink); }
.fp-check[data-s="doing"]::before { border-top-color: var(--lime); animation: fp-spin 0.9s linear infinite; }
.fp-check[data-s="done"] { color: var(--ink); }
.fp-check[data-s="done"]::before { content: "\2713"; border-color: var(--success); background: var(--success); color: var(--lime-ink); }
.fp-check[data-s="fail"] { color: var(--ink); }
.fp-check[data-s="fail"]::before { content: "\2715"; border-color: var(--error); background: var(--error); color: var(--lime-ink); }

@keyframes fp-spin { to { transform: rotate(360deg); } }

.fp-actions-col { display: grid; gap: 0.5rem; }
.fp-actions-col .btn { width: 100%; height: 2.75rem; padding: 0 1.4rem; }
.fp-oc-actions { align-self: center; }
.fp-actions-col[hidden] { display: none; }

/* ---------- окно чата FunPay ---------- */

.fp-chatwin {
  display: flex;
  flex-direction: column;
  height: 36rem;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
}

.fp-cw-head { display: flex; align-items: center; gap: 0.75rem; padding: 0.8rem 1rem; border-bottom: 1px solid var(--line); }
.fp-cw-title { font-weight: 650; line-height: 1.2; }
.fp-cw-sub { color: var(--muted); font-size: 0.82rem; }

.fp-ava {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: #16222b;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.fp-ava img { width: 100%; height: 100%; object-fit: cover; }
.fp-ava-logo img { transform: scale(1.7) translateY(2%); background: #000; }

.fp-cw-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem;
  overflow-y: auto;
  background: #0a1116;
}

.fp-cw-log,
.fp-tg-log { scrollbar-width: thin; scrollbar-color: rgba(233, 240, 234, 0.22) transparent; }

.fp-empty { margin: auto; max-width: 20rem; color: var(--muted); font-size: 0.93rem; text-align: center; }

.fp-m { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 0.15rem 0.7rem; }
.fp-m .fp-ava { grid-row: span 2; margin-top: 0.1rem; }
.fp-m-head { display: flex; align-items: baseline; gap: 0.55rem; }
.fp-m-name { font-size: 0.9rem; font-weight: 650; }
.fp-m-time { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.fp-m-text { font-size: 0.93rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.fp-m-sys .fp-m-name { color: var(--accent); }
.fp-m-sys .fp-m-text { padding-left: 0.7rem; border-left: 2px solid var(--accent); color: var(--ink); }
.fp-lnk { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(61, 214, 198, 0.45); text-underline-offset: 0.18em; }

.fp-quick { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1rem 0; background: var(--bg-elev); }
.fp-quick-label { margin-right: 0.2rem; color: var(--muted); font-size: 0.85rem; }
.fp-quick[hidden] { display: none; }
.fp-chip { height: 2.5rem; padding: 0 1.1rem; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-weight: 650; cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.fp-chip:hover { border-color: var(--lime); background: rgba(182, 242, 74, 0.08); }

.fp-compose { display: flex; gap: 0.5rem; padding: 0.7rem 1rem 0.9rem; background: var(--bg-elev); }
.fp-compose .fp-input { flex: 1; min-width: 0; }
.fp-send { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex: none; border: 0; border-radius: var(--radius); background: var(--lime); color: var(--lime-ink); cursor: pointer; }
.fp-send:disabled { opacity: 0.4; cursor: not-allowed; }
.fp-send svg { width: 1.1rem; height: 1.1rem; }

/* ---------- телефон продавца: Telegram ---------- */

.fp-device { position: relative; width: 100%; max-width: 17.5rem; margin: 0 auto; }

.fp-phone {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 36rem;
  overflow: hidden;
  border: 0.6rem solid #151d25;
  border-radius: 2.8rem;
  background: #0b1218;
  box-shadow: 0 0 0 1px #2a3643, 0 1.5rem 3rem rgba(0, 0, 0, 0.45);
}

/* «остров» с камерой */
.fp-phone::before {
  content: "";
  position: absolute;
  top: 0.4rem;
  left: 50%;
  z-index: 3;
  width: 4.6rem;
  height: 1.2rem;
  border-radius: 999px;
  background: #050709;
  transform: translateX(-50%);
}

.fp-phone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem 0.4rem;
  background: #101a21;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fp-phone-icons { display: flex; align-items: center; gap: 0.38rem; }
.fp-phone-icons svg { display: block; width: auto; }
.fp-ic-signal { height: 0.68rem; }
.fp-ic-wifi { height: 0.72rem; }
.fp-ic-battery { height: 0.72rem; }

.fp-tg-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.7rem 0.55rem; border-bottom: 1px solid var(--line); background: #101a21; }
.fp-tg-head svg { width: 1.05rem; height: 1.05rem; flex: none; color: var(--accent); }
.fp-tg-head .fp-tg-more { margin-left: auto; width: 1.1rem; color: var(--muted); }
.fp-tg-head .fp-ava { width: 2.1rem; height: 2.1rem; font-size: 0.82rem; background: var(--accent); color: var(--lime-ink); }
.fp-tg-name { font-size: 0.9rem; font-weight: 650; line-height: 1.15; }
.fp-tg-sub { color: var(--accent); font-size: 0.7rem; }

.fp-tg-log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.7rem;
  overflow-y: auto;
  background-color: #0b1218;
  background-image: radial-gradient(rgba(233, 240, 234, 0.045) 1px, transparent 1px);
  background-size: 14px 14px;
}

.fp-tg-date { align-self: center; padding: 0.12rem 0.65rem; border-radius: 999px; background: rgba(233, 240, 234, 0.1); color: var(--ink); font-size: 0.7rem; font-weight: 600; }

.fp-tg-b {
  max-width: 94%;
  padding: 0.45rem 0.65rem 0.3rem;
  border-radius: 0.95rem 0.95rem 0.95rem 0.25rem;
  background: #182533;
  font-size: 0.8rem;
  line-height: 1.4;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.fp-tg-time { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.64rem; text-align: right; }

.fp-tg-composer { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.8rem; border-top: 1px solid var(--line); background: #101a21; color: var(--muted); font-size: 0.8rem; }
.fp-tg-composer svg { width: 1.1rem; height: 1.1rem; flex: none; }
.fp-tg-composer span { flex: 1; }

.fp-home { width: 36%; height: 0.28rem; margin: 0.35rem auto 0.5rem; border-radius: 999px; background: rgba(233, 240, 234, 0.35); }

/* появление сообщений — только когда они действительно приходят */
.fp-new { animation: fp-pop 0.28s ease both; }
@keyframes fp-pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- как купить: тут нумерация уместна, это последовательность ---------- */

.fp-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 1.75rem;
  list-style: none;
  counter-reset: step;
  border-top: 1px solid var(--line);
}

.fp-steps li { padding: 1.4rem 1.5rem 0 0; counter-increment: step; }
.fp-steps li + li { padding-left: 1.5rem; border-left: 1px solid var(--line); }

.fp-steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--lime);
  font-weight: 650;
}

.fp-steps h3 { margin-bottom: 0.3rem; font-size: 1.08rem; font-weight: 650; }
.fp-steps p { color: var(--muted); font-size: 0.95rem; }
.fp-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 2rem; }
.fp-cta .btn { height: 3rem; padding: 0 1.4rem; }
.fp-cta p { color: var(--muted); }

/* ---------- вопросы ---------- */

.fp-faq details { border-top: 1px solid var(--line); }
.fp-faq details:last-child { border-bottom: 1px solid var(--line); }

.fp-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  padding: 0.7rem 0;
  font-size: 1.05rem;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.fp-faq summary::-webkit-details-marker { display: none; }
.fp-faq summary::after { content: "+"; color: var(--muted); font-size: 1.4rem; font-weight: 400; line-height: 1; }
.fp-faq details[open] summary::after { content: "\2212"; color: var(--lime); }
.fp-faq summary:hover { color: var(--lime); }
.fp-faq details p { max-width: 40rem; padding-bottom: 1.25rem; color: var(--muted); }

.fp-link {
  color: var(--lime);
  text-decoration: underline;
  text-decoration-color: rgba(182, 242, 74, 0.5);
  text-underline-offset: 0.2em;
}

.fp-section :focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
  border-radius: 0.35rem;
}

.fp-note { margin-top: 1rem; color: var(--muted); font-size: 0.85rem; }

.fp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- ноутбук, планшет, телефон ---------- */

@media (max-width: 1099px) {
  .fp-sim {
    grid-template-columns: minmax(0, 19rem) minmax(0, 1fr);
    grid-template-areas:
      "form chat"
      "order order"
      "phone phone";
  }
}

@media (max-width: 899px) {
  .fp-section { padding: 2.75rem 0; }
  .fp-split { grid-template-columns: 1fr; gap: 1.75rem; }
  .fp-sim {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "form"
      "chat"
      "order"
      "phone";
  }

  .fp-chatwin { height: 32rem; }
  .fp-ordercard { grid-template-columns: 1fr; }
  .fp-oc-actions { align-self: stretch; }
  .fp-steps { grid-template-columns: 1fr; border-top: 0; }
  .fp-steps li,
  .fp-steps li + li { padding: 1.25rem 0; border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 520px) {
  .fp-cta .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .fp-new { animation: none; }
  .fp-switch,
  .fp-switch::after { transition: none; }
  .fp-check[data-s="doing"]::before { animation: none; }
}

/* ---------- движение: общая основа ---------- */

/* плавный переход между страницами сайта (где браузер это умеет) */
@view-transition { navigation: auto; }

/* блоки появляются, когда доходят до экрана (скрипт kaderix-motion.js ставит is-in) */
.kx-m :is(.fp-section, .rf-top, .rf-section, .pp-block, .pp-live, .pp-host, .pp-bottom, .pf-sec, .docs-section, .guide-section, .co-block, [data-reveal]) {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.kx-m :is(.fp-section, .rf-top, .rf-section, .pp-block, .pp-live, .pp-host, .pp-bottom, .pf-sec, .docs-section, .guide-section, .co-block, [data-reveal]).is-in { opacity: 1; transform: none; }

@keyframes kx-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes kx-pop {
  0% { transform: scale(0.9); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

@keyframes kx-shimmer { to { transform: translateX(100%); } }

.btn:active { transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) {
  .kx-m :is(.fp-section, .rf-top, .rf-section, .pp-block, .pp-live, .pp-host, .pp-bottom, .pf-sec, .docs-section, .guide-section, .co-block, [data-reveal]) { opacity: 1; transform: none; transition: none; }
}

/* ---------- движение: модель заказа ---------- */

/* «печатает…» */
.fp-typing .fp-m-text { display: inline-flex; align-items: center; gap: 0.28rem; height: 1.5rem; }

.fp-typing i {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--muted);
  animation: fp-dot 1s ease-in-out infinite;
}

.fp-typing i:nth-child(2) { animation-delay: 0.15s; }
.fp-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes fp-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* статус и проверки реагируют на смену */
.fp-pill.is-pop { animation: kx-pop 0.35s ease; }
.fp-check[data-s="done"]::before { animation: kx-pop 0.3s ease; }

/* уведомление, которое приходит на телефон продавца */
.fp-push {
  position: absolute;
  top: 2.1rem;
  right: 0.5rem;
  left: 0.5rem;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(233, 240, 234, 0.1);
  border-radius: 1rem;
  background: rgba(30, 42, 54, 0.96);
  box-shadow: 0 12px 26px -10px rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-150%);
  transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2), opacity 0.3s ease;
}

.fp-push.is-on { opacity: 1; transform: none; }

.fp-push-ava {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
  border-radius: 0.55rem;
  background: var(--accent);
  color: var(--lime-ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.fp-push-txt { display: grid; min-width: 0; font-size: 0.72rem; line-height: 1.3; }
.fp-push-txt strong { font-size: 0.78rem; }
.fp-push-txt span { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.fp-push-time { margin-left: auto; color: var(--muted); font-size: 0.64rem; }

@media (prefers-reduced-motion: reduce) {
  .fp-typing i,
  .fp-pill.is-pop,
  .fp-check[data-s="done"]::before { animation: none; }
  .fp-push { transition: opacity 0.2s ease; transform: none; }
}
