/* ============================================================
   EDITOR CSS
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red: #E63950; --red-light: #fff0f2;
  --purple: #7C3AED; --purple-light: #ede9fe;
  --dark: #141414; --text: #1F1F1F;
  --muted: #71717A; --border: #E4E4E7;
  --bg: #F8F8F5; --white: #FFFFFF;
  --r: 12px; --r-lg: 20px;
  --shadow: 0 2px 12px rgba(0,0,0,.07);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

html { -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

.hidden { display: none !important; }

/* ── HEADER ── */
.editor-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
  height: 64px;
}
.editor-header__logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--dark); font-weight: 800; font-size: 16px;
  flex-shrink: 0;
}

/* Progress */
.editor-progress {
  display: flex; align-items: center; gap: 0;
  flex: 1; justify-content: center; max-width: 560px; margin: 0 auto;
}
.ep-step { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.ep-circle {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--border); background: #fff;
  font-size: 13px; font-weight: 700; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .3s;
}
.ep-step span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ep-step.active .ep-circle { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 0 4px rgba(230,57,80,.15); }
.ep-step.active span { color: var(--red); font-weight: 600; }
.ep-step.done .ep-circle { background: #22c55e; border-color: #22c55e; color: #fff; }
.ep-step.done .ep-circle::after { content: '✓'; }
.ep-step.done .ep-circle { font-size: 0; }
.ep-step.done .ep-circle::after { font-size: 14px; }
.ep-line { flex: 1; height: 2px; background: var(--border); min-width: 24px; transition: background .3s; }
.ep-line.done { background: #22c55e; }

.editor-header__right { flex-shrink: 0; margin-left: auto; }
.editor-save-btn { padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--muted); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s; font-family: 'Inter',sans-serif; }
.editor-save-btn:hover { border-color: var(--red); color: var(--red); }

/* ── MAIN AREA ── */
.editor-main { min-height: calc(100vh - 64px); }
.editor-step { padding: 40px 0 80px; }
.editor-step__inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.editor-step__inner--two-col { display: grid; grid-template-columns: 1fr 360px; gap: 40px; align-items: start; }
.editor-step__inner--preview { max-width: 900px; }
.editor-step__inner--narrow { max-width: 800px; }

/* ── STEP HEADER ── */
.step-header { margin-bottom: 32px; }
.step-header h1, .step-header h2 { font-size: 28px; font-weight: 800; color: var(--dark); margin-bottom: 6px; }
.step-header p { font-size: 15px; color: var(--muted); }

/* ── TEMPLATE FILTER ── */
.template-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 28px; }
.tf-btn {
  padding: 8px 16px; border-radius: 100px; border: 2px solid var(--border);
  background: #fff; color: var(--muted); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all .2s; white-space: nowrap; font-family: 'Inter',sans-serif;
}
.tf-btn:hover { border-color: var(--red); color: var(--red); }
.tf-btn--active { background: var(--red); border-color: var(--red); color: #fff; }

/* ── TEMPLATE PICKER ── */
.template-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.tp-card {
  border-radius: var(--r-lg); overflow: hidden;
  background: #fff; border: 3px solid transparent;
  cursor: pointer; transition: all .25s;
  box-shadow: var(--shadow);
}
.tp-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(230,57,80,.3); }
.tp-card.selected { border-color: var(--red); box-shadow: 0 0 0 4px rgba(230,57,80,.12), var(--shadow-lg); }
.tp-card__preview {
  height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 16px;
}
.tp-card__emoji { font-size: 36px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.2)); }
.tp-card__name { font-family: 'Playfair Display',serif; font-size: 14px; font-weight: 700; text-align: center; line-height: 1.3; }
.tp-card__footer { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.tp-card__sub { font-size: 12px; color: var(--muted); font-weight: 500; }
.tp-card__check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.tp-card.selected .tp-card__check { background: var(--red); border-color: var(--red); }
.tp-card.selected .tp-card__check::after { content: '✓'; font-size: 11px; font-weight: 700; color: #fff; }

/* ── FORM FIELDS ── */
.editor-fields { display: flex; flex-direction: column; gap: 0; }
.field-group { margin-bottom: 20px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.field-input {
  width: 100%; padding: 11px 14px; border-radius: var(--r);
  border: 2px solid var(--border); background: #fff;
  font-family: 'Inter',sans-serif; font-size: 15px; color: var(--text);
  transition: border-color .2s;
}
.field-input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,57,80,.1); }
.field-input::placeholder { color: #b0b0b8; }
.field-textarea {
  width: 100%; padding: 11px 14px; border-radius: var(--r);
  border: 2px solid var(--border); background: #fff;
  font-family: 'Inter',sans-serif; font-size: 15px; color: var(--text);
  resize: vertical; min-height: 110px;
  transition: border-color .2s;
}
.field-textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(230,57,80,.1); }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; display: block; }
.field-count { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; }

/* ── PHOTO UPLOAD ── */
.photo-upload {
  border: 2px dashed var(--border); border-radius: var(--r);
  padding: 32px 20px; text-align: center; cursor: pointer;
  transition: all .2s; background: #fafafa;
}
.photo-upload:hover { border-color: var(--red); background: var(--red-light); }
.photo-upload__text { font-size: 14px; color: var(--muted); margin-top: 8px; }
.photo-upload__text span { color: var(--red); font-weight: 600; }
.photo-upload__hint { font-size: 12px; color: #b0b0b8; margin-top: 4px; }
.photo-preview { position: relative; border-radius: var(--r); overflow: hidden; }
.photo-preview img { width: 100%; height: 180px; object-fit: cover; border-radius: var(--r); }
.photo-remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: none; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }

/* ── GAME SELECT ── */
.radio-group { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.radio-card { cursor: pointer; }
.radio-card input { display: none; }
.radio-card__icon {
  display: block; text-align: center; padding: 12px 8px 8px; font-size: 22px;
  border: 2px solid var(--border); border-radius: var(--r); background: #fff;
  transition: all .2s;
}
.radio-card__label { display: block; text-align: center; font-size: 11px; color: var(--muted); margin-top: 4px; font-weight: 500; }
.radio-card--active .radio-card__icon,
.radio-card input:checked ~ .radio-card__icon { border-color: var(--red); background: var(--red-light); }

/* ── STEP NAV ── */
.step-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.step-nav--centered { justify-content: center; gap: 16px; }
.btn-back { padding: 12px 24px; border-radius: var(--r); border: 2px solid var(--border); background: #fff; color: var(--muted); font-size: 15px; font-weight: 600; cursor: pointer; font-family: 'Inter',sans-serif; transition: all .2s; }
.btn-back:hover { border-color: var(--dark); color: var(--dark); }
.btn-next { padding: 12px 28px; border-radius: var(--r); background: var(--red); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; border: none; font-family: 'Inter',sans-serif; box-shadow: 0 4px 16px rgba(230,57,80,.3); transition: all .2s; }
.btn-next:hover { background: #cc2e43; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(230,57,80,.4); }
.btn-next--pay { font-size: 16px; padding: 16px 36px; }

/* ── LIVE PREVIEW ── */
.editor-preview-col { position: sticky; top: 80px; }
.preview-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.live-preview {
  width: 100%; aspect-ratio: 3/4; border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  background: #f0f0f0;
}
.preview-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }

/* ── OPTIONS ── */
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 32px; }
.option-card { background: #fff; border-radius: var(--r-lg); border: 2px solid var(--border); overflow: hidden; box-shadow: var(--shadow); }
.option-card__head { display: flex; align-items: center; gap: 16px; padding: 20px 24px; }
.option-card__icon { font-size: 28px; flex-shrink: 0; }
.option-card__head > div:nth-child(2) { flex: 1; }
.option-card__head h3 { font-size: 16px; color: var(--dark); margin-bottom: 2px; }
.option-card__head p { font-size: 13px; color: var(--muted); }
.option-card__body { padding: 0 24px 24px; border-top: 1px solid var(--border); }
.option-card__body .field-group:first-child { margin-top: 20px; }
.option-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 8px; }

/* Toggle */
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle__slider { position: absolute; inset: 0; background: #d1d5db; border-radius: 100px; cursor: pointer; transition: .3s; }
.toggle__slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .3s; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.toggle input:checked ~ .toggle__slider { background: var(--red); }
.toggle input:checked ~ .toggle__slider::before { transform: translateX(20px); }

.datetime-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Group invite */
.group-invite-preview { background: #f8f8f5; border-radius: var(--r); padding: 12px 14px; margin: 12px 0; }
.group-invite-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.group-invite-example { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text); font-weight: 500; }

/* Music options */
.music-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.music-opt { cursor: pointer; }
.music-opt input { display: none; }
.music-opt__inner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--r); background: #fff; transition: all .2s; }
.music-opt input:checked ~ .music-opt__inner { border-color: var(--red); background: var(--red-light); }
.music-opt__emoji { font-size: 20px; }
.music-opt__name { flex: 1; font-size: 14px; font-weight: 500; }
.music-play { padding: 4px 10px; border-radius: 6px; background: var(--red); color: #fff; border: none; cursor: pointer; font-size: 12px; }

/* ── PREVIEW STEP ── */
.preview-container { position: relative; max-width: 400px; margin: 0 auto 32px; }
.preview-frame { width: 100%; min-height: 500px; border-radius: var(--r-lg); overflow: hidden; box-shadow: 0 24px 64px rgba(0,0,0,.2); }

.preview-qr-preview { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: start; background: #fff; border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow); }
.preview-qr-block { text-align: center; }
.preview-qr-placeholder { width: 100px; height: 100px; margin: 0 auto 10px; }
.preview-qr-block p { font-size: 12px; color: var(--muted); }
.preview-info h3 { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 12px; }
.preview-features-list { list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--text); margin-bottom: 16px; }
.preview-summary { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.preview-summary__row { display: flex; justify-content: space-between; font-size: 14px; }
.preview-summary__row span:first-child { color: var(--muted); }
.preview-summary__row span:last-child { font-weight: 600; color: var(--dark); }

/* ── PAYMENT ── */
.payment-layout { display: grid; grid-template-columns: 1fr 320px; gap: 32px; }
.payment-methods { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.pm-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--r); border: 2px solid var(--border);
  background: #fff; color: var(--muted); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s; font-family: 'Inter',sans-serif;
}
.pm-btn:hover { border-color: var(--dark); color: var(--dark); }
.pm-btn--active { border-color: var(--red); color: var(--red); background: var(--red-light); }
.payment-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.erip-instructions { display: flex; flex-direction: column; gap: 12px; margin: 12px 0; }
.erip-step { display: flex; align-items: flex-start; gap: 12px; }
.erip-num { width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.erip-step p { font-size: 14px; color: var(--text); }

.payment-agree { margin: 16px 0; }
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13px; color: var(--muted); }
.checkbox-label a { color: var(--red); }
.checkbox-label input { display: none; }
.checkbox-custom { width: 18px; height: 18px; border: 2px solid var(--border); border-radius: 4px; flex-shrink: 0; margin-top: 1px; transition: all .2s; display: flex; align-items: center; justify-content: center; }
.checkbox-label input:checked ~ .checkbox-custom { background: var(--red); border-color: var(--red); }
.checkbox-label input:checked ~ .checkbox-custom::after { content: '✓'; font-size: 11px; color: #fff; font-weight: 700; }

.btn-pay {
  width: 100%; padding: 16px; border-radius: var(--r); background: var(--red);
  color: #fff; font-size: 18px; font-weight: 800; border: none; cursor: pointer;
  font-family: 'Inter',sans-serif; display: flex; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 6px 24px rgba(230,57,80,.35); transition: all .2s; margin-top: 4px;
}
.btn-pay:hover { background: #cc2e43; transform: translateY(-2px); box-shadow: 0 10px 30px rgba(230,57,80,.4); }
.btn-pay:active { transform: translateY(0); }
.payment-security { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 12px; justify-content: center; }

/* Order card */
.payment-order { background: #fff; border-radius: var(--r-lg); border: 1px solid var(--border); padding: 24px; box-shadow: var(--shadow); height: fit-content; }
.payment-order h3 { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 16px; }
.order-template { background: var(--bg); border-radius: var(--r); padding: 16px; margin-bottom: 20px; min-height: 80px; }
.order-lines { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.order-line { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.order-line--bold { font-weight: 800; font-size: 18px; color: var(--dark); }
.order-note { background: #f0fdf4; border-radius: 8px; padding: 12px 14px; font-size: 12px; color: #166534; line-height: 1.8; margin-top: 16px; }

/* ── SUCCESS PAGE ── */
.success-page { text-align: center; padding: 40px 0; }
.success-icon { font-size: 72px; margin-bottom: 24px; animation: success-bounce .6s cubic-bezier(.175,.885,.32,1.275); }
@keyframes success-bounce { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.success-page h2 { font-size: 36px; font-weight: 900; color: var(--dark); margin-bottom: 12px; }
.success-sub { font-size: 16px; color: var(--muted); max-width: 480px; margin: 0 auto 32px; line-height: 1.7; }

.success-qr { width: 180px; height: 180px; margin: 0 auto 24px; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); background: #fff; padding: 12px; }
.success-qr canvas { width: 100% !important; height: 100% !important; }

.success-link { display: flex; gap: 8px; margin-bottom: 24px; max-width: 500px; margin-left: auto; margin-right: auto; }
.success-link .field-input { flex: 1; font-size: 13px; background: #f8f8f5; color: var(--muted); }
.btn-copy { padding: 11px 20px; border-radius: var(--r); background: var(--dark); color: #fff; font-size: 14px; font-weight: 600; border: none; cursor: pointer; font-family: 'Inter',sans-serif; white-space: nowrap; transition: background .2s; }
.btn-copy:hover { background: #333; }

.success-share { margin-bottom: 32px; }
.success-share p { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.share-btns { display: flex; gap: 10px; justify-content: center; }
.share-btn { padding: 10px 20px; border-radius: var(--r); font-size: 14px; font-weight: 600; border: none; cursor: pointer; font-family: 'Inter',sans-serif; transition: opacity .2s; }
.share-btn:hover { opacity: .85; }
.share-btn--tg { background: #0088cc; color: #fff; }
.share-btn--wa { background: #25D366; color: #fff; }
.share-btn--vk { background: #4680C2; color: #fff; }

.success-group-invite { background: var(--purple-light); border-radius: var(--r-lg); padding: 24px; margin-bottom: 32px; text-align: left; max-width: 500px; margin-left: auto; margin-right: auto; }
.success-group-invite h3 { font-size: 16px; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.success-group-invite p { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.success-group-invite .success-link { margin-bottom: 0; }

.btn-back-home { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500; padding: 8px 16px; border-radius: 8px; transition: color .2s; }
.btn-back-home:hover { color: var(--red); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .editor-step__inner--two-col { grid-template-columns: 1fr; }
  .editor-preview-col { position: static; }
  .options-grid { grid-template-columns: 1fr; }
  .payment-layout { grid-template-columns: 1fr; }
  .payment-order { order: -1; }
  .editor-progress { max-width: 380px; }
  .ep-step span { display: none; }
}

@media (max-width: 600px) {
  .template-picker { grid-template-columns: repeat(2,1fr); }
  .radio-group { grid-template-columns: repeat(3,1fr); }
  .editor-progress { display: none; }
}
