/* ═══════════════════════════════════════════════
   M_Ali — основная таблица стилей
   ═══════════════════════════════════════════════ */

:root {
  --bg:        #0d1117;
  --bg2:       #161b22;
  --card:      #1c2230;
  --border:    rgba(255,255,255,.09);
  --blue:      #2563eb;
  --blue2:     #1d4ed8;
  --teal:      #38bdf8;
  --green:     #22c55e;
  --gold:      #f59e0b;
  --red:       #ef4444;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 4px 24px rgba(0,0,0,.35);
}

/* Светлая тема (по клику на солнце) */
[data-theme="light"] {
  --bg:      #f5f7fb;
  --bg2:     #ffffff;
  --card:    #ffffff;
  --border:  rgba(0,0,0,.10);
  --text:    #1a1f29;
  --muted:   #5b6471;
  --shadow:  0 4px 24px rgba(0,0,0,.10);
}
[data-theme="light"] .site-header { background: rgba(255,255,255,.9); }

/* Кнопка переключения темы (солнце/луна) */
.theme-toggle {
  margin-left: auto;
  background: none; border: 1px solid var(--border);
  border-radius: 50%; width: 38px; height: 38px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--text);
  transition: background .15s, transform .12s;
}
.theme-toggle:hover { background: var(--card); transform: translateY(-1px); }
.lang-item:hover { background: var(--bg2); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ── HEADER ─────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 200;
  background: rgba(13,17,23,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1140px; margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex; align-items: center; gap: 28px;
}
.logo {
  font-size: 1.45rem; font-weight: 900; letter-spacing: -.5px;
  color: var(--text); text-decoration: none; flex-shrink: 0;
}
.logo span { color: var(--teal); }
.nav-links { display: flex; gap: 24px; }
.nav-links a { color: var(--muted); font-size: .92rem; font-weight: 500; transition: color .15s; }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.header-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.burger span { width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: .2s; }

.mobile-nav { display: none; flex-direction: column; background: var(--bg2); border-top: 1px solid var(--border); }
.mobile-nav a { padding: 14px 20px; color: var(--text); font-weight: 500; border-bottom: 1px solid var(--border); }
.mobile-nav.open { display: flex; }

@media (max-width: 680px) {
  .nav-links, .header-actions { display: none; }
  .burger { display: flex; margin-left: auto; }
}

/* ── BUTTONS ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  border: none; transition: background .15s, transform .12s, opacity .15s;
  text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,99,235,.4);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(37,99,235,.55); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: rgba(255,255,255,.06); }

.btn-ghost {
  background: transparent; color: var(--muted);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,.05); }

.btn-green {
  background: var(--green); color: #fff;
  box-shadow: 0 4px 14px rgba(34,197,94,.35);
}
.btn-green:hover { background: #16a34a; }

.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── FLASH MESSAGES ──────────────────────────── */
.flash-container { max-width: 640px; margin: 16px auto 0; padding: 0 20px; }
.flash {
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: .92rem; font-weight: 500; margin-bottom: 8px;
}
.flash-error   { background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; }
.flash-success { background: rgba(34,197,94,.15);  border: 1px solid rgba(34,197,94,.3);  color: #86efac; }
.flash-info    { background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.3); color: #7dd3fc; }

/* ── FOOTER ──────────────────────────────────── */
.site-footer {
  text-align: center; padding: 32px 20px;
  color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }

/* ══════════════════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════════════════ */

/* Hero */
.hero {
  text-align: center;
  padding: 100px 20px 80px;
  background: radial-gradient(ellipse 80% 55% at 50% 0%, rgba(37,99,235,.22) 0%, transparent 65%);
}
.hero-badge {
  display: inline-block;
  background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.3);
  color: var(--teal); padding: 6px 18px; border-radius: 100px;
  font-size: .82rem; font-weight: 600; margin-bottom: 28px; letter-spacing: .3px;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 900;
  letter-spacing: -1px; line-height: 1.13; max-width: 820px; margin: 0 auto 20px;
}
.hero h1 em { font-style: normal; color: var(--teal); }
.hero p.lead {
  color: var(--muted); font-size: 1.1rem; max-width: 560px; margin: 0 auto 40px;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-note { margin-top: 20px; color: var(--green); font-size: .88rem; font-weight: 600; }
.hero-note span { color: var(--muted); font-weight: 400; }

/* Section common */
.section { padding: 80px 20px; }
.section-alt { background: rgba(255,255,255,.02); }
.container { max-width: 1100px; margin: 0 auto; }
.section-title { text-align: center; font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; margin-bottom: 10px; }
.section-sub { text-align: center; color: var(--muted); font-size: .97rem; max-width: 520px; margin: 0 auto 52px; }

/* Pricing cards */
.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}
.price-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 22px 24px;
  display: flex; flex-direction: column;
  transition: transform .2s, border-color .2s;
  position: relative; overflow: hidden;
}
.price-card:hover { transform: translateY(-4px); border-color: rgba(37,99,235,.45); }
.price-card.popular { border-color: var(--blue); background: linear-gradient(160deg, #1a2e50 0%, var(--card) 65%); }
.price-card.popular::after {
  content: 'Популярное';
  position: absolute; top: 14px; right: -28px;
  background: var(--blue); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 4px 34px;
  transform: rotate(45deg);
}
.pc-icon { font-size: 2.2rem; margin-bottom: 12px; }
.pc-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.pc-pages { color: var(--muted); font-size: .84rem; margin-bottom: 16px; }
.pc-features { list-style: none; display: flex; flex-direction: column; gap: 5px; margin-bottom: 20px; }
.pc-features li { font-size: .84rem; color: var(--muted); display: flex; gap: 6px; }
.pc-features li::before { content: '✓'; color: var(--green); flex-shrink: 0; }
.pc-price { margin-top: auto; font-size: 1.6rem; font-weight: 800; color: var(--gold); }
.pc-price small { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; margin-top: 2px; }

/* Steps */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 22px;
}
.step-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 20px; text-align: center;
}
.step-num {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; margin: 0 auto 14px;
}
.step-card h3 { font-size: .97rem; font-weight: 700; margin-bottom: 8px; }
.step-card p { color: var(--muted); font-size: .86rem; }

/* CTA block */
.cta-block {
  background: linear-gradient(135deg, rgba(37,99,235,.18), rgba(56,189,248,.12));
  border: 1px solid rgba(37,99,235,.25);
  border-radius: 22px; padding: 72px 32px; text-align: center;
  margin: 0 20px;
}
.cta-block h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 800; margin-bottom: 14px; }
.cta-block p { color: var(--muted); font-size: 1rem; margin-bottom: 36px; }

/* ══════════════════════════════════════════════
   AUTH PAGES
   ══════════════════════════════════════════════ */
.auth-wrap {
  min-height: calc(100vh - 130px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px 36px;
  width: 100%; max-width: 440px;
}
.auth-card h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.auth-card .auth-sub { color: var(--muted); font-size: .93rem; margin-bottom: 32px; }
.auth-footer { text-align: center; margin-top: 22px; color: var(--muted); font-size: .9rem; }

/* Form elements */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: .87rem; font-weight: 600;
  color: var(--muted); margin-bottom: 6px; letter-spacing: .2px;
}
.form-group label .native { font-weight: 400; color: var(--muted); opacity: .75; font-style: italic; }
.form-control {
  width: 100%; padding: 11px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: inherit; font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.2);
}
.form-control::placeholder { color: var(--muted); opacity: .6; }
select.form-control { cursor: pointer; }

/* Radio / checkbox groups */
.radio-group, .check-group {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.radio-btn input { display: none; }
.radio-btn label {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: .88rem; font-weight: 500; color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
  background: var(--bg);
}
.radio-btn input:checked + label {
  border-color: var(--blue); color: var(--text);
  background: rgba(37,99,235,.15);
}
.radio-btn label:hover { border-color: rgba(37,99,235,.5); color: var(--text); }

/* Lang select in register */
.lang-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-option input { display: none; }
.lang-option label {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: .87rem; font-weight: 500; transition: .15s;
  background: var(--bg);
}
.lang-option label .flag { font-size: 1.2rem; }
.lang-option label .lng-name { font-size: .78rem; color: var(--muted); }
.lang-option input:checked + label {
  border-color: var(--teal); background: rgba(56,189,248,.12);
}
.lang-option label:hover { border-color: rgba(56,189,248,.4); }

/* ══════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════ */
.dash-wrap { max-width: 1000px; margin: 0 auto; padding: 40px 20px; }
.dash-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 32px; }
.dash-header h1 { font-size: 1.6rem; font-weight: 800; }
.dash-header p { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.orders-empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.orders-empty p { font-size: 1rem; margin-bottom: 22px; }
.orders-list { display: flex; flex-direction: column; gap: 12px; }
.order-row {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.or-icon { font-size: 1.8rem; flex-shrink: 0; }
.or-info { flex: 1; min-width: 200px; }
.or-type { font-size: .78rem; font-weight: 600; color: var(--teal); text-transform: uppercase; letter-spacing: .5px; }
.or-topic { font-weight: 600; font-size: .97rem; margin: 2px 0; }
.or-meta { color: var(--muted); font-size: .82rem; }
.or-status {
  padding: 4px 12px; border-radius: 100px;
  font-size: .78rem; font-weight: 700; letter-spacing: .3px; flex-shrink: 0;
}
.status-done       { background: rgba(34,197,94,.15);   color: var(--green); }
.status-generating { background: rgba(56,189,248,.12);  color: var(--teal); }
.status-pending    { background: rgba(245,158,11,.1);   color: var(--gold); }
.status-error      { background: rgba(239,68,68,.12);   color: #fca5a5; }

/* ══════════════════════════════════════════════
   ORDER WIZARD
   ══════════════════════════════════════════════ */
.wizard-wrap { max-width: 820px; margin: 0 auto; padding: 36px 20px 60px; }
.wizard-wrap h1 { font-size: 1.55rem; font-weight: 800; margin-bottom: 6px; }
.wizard-wrap > p { color: var(--muted); font-size: .92rem; margin-bottom: 28px; }

/* Progress bar */
.wizard-progress { display: flex; align-items: center; margin-bottom: 36px; gap: 0; }
.wp-step {
  display: flex; flex-direction: column; align-items: center;
  flex: 1; position: relative; text-align: center;
}
.wp-step::before {
  content: ''; position: absolute; top: 16px; left: -50%; right: 50%;
  height: 2px; background: var(--border); z-index: 0;
}
.wp-step:first-child::before { display: none; }
.wp-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 700; z-index: 1;
  transition: .2s; color: var(--muted);
}
.wp-step.active .wp-dot   { background: var(--blue);  border-color: var(--blue);  color: #fff; }
.wp-step.done .wp-dot     { background: var(--green); border-color: var(--green); color: #fff; }
.wp-step.done::before     { background: var(--green); }
.wp-step.active::before   { background: var(--blue); }
.wp-label { font-size: .72rem; font-weight: 600; color: var(--muted); margin-top: 6px; }
.wp-step.active .wp-label, .wp-step.done .wp-label { color: var(--text); }

/* Step panels */
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fadeInUp .25s ease; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.step-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 6px; }
.step-sub { color: var(--muted); font-size: .9rem; margin-bottom: 24px; }

/* Type cards */
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px; margin-bottom: 28px;
}
.type-card {
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 22px 16px;
  cursor: pointer; text-align: center;
  transition: border-color .15s, transform .15s, background .15s;
  user-select: none;
}
.type-card:hover { border-color: rgba(37,99,235,.45); transform: translateY(-2px); }
.type-card.selected { border-color: var(--blue); background: rgba(37,99,235,.12); }
.tc-icon { font-size: 2rem; margin-bottom: 10px; }
.tc-name { font-weight: 700; font-size: .95rem; margin-bottom: 4px; }
.tc-pages { color: var(--muted); font-size: .78rem; }
.tc-price { color: var(--gold); font-size: .85rem; font-weight: 700; margin-top: 6px; }

/* Sections list (struct editor) */
.struct-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.struct-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
}
.struct-item input {
  flex: 1; background: none; border: none; color: var(--text);
  font-family: inherit; font-size: .9rem; outline: none;
}
.struct-del {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 1rem; padding: 2px 6px; border-radius: 4px;
  transition: color .15s;
}
.struct-del:hover { color: var(--red); }
.struct-add {
  background: none; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); padding: 8px; width: 100%;
  color: var(--muted); cursor: pointer; font-size: .88rem;
  transition: border-color .15s, color .15s;
  margin-top: 8px;
}
.struct-add:hover { border-color: var(--blue); color: var(--text); }

/* Summary */
.summary-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.summary-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: .92rem;
}
.summary-row:last-child { border-bottom: none; }
.summary-label { color: var(--muted); }
.summary-value { font-weight: 600; max-width: 65%; text-align: right; }
.price-total {
  font-size: 1.5rem; font-weight: 800; color: var(--gold);
  text-align: right; margin-top: 16px;
}
.price-total small { color: var(--muted); font-size: .82rem; font-weight: 400; }

/* Generating state */
.gen-state { text-align: center; padding: 48px 20px; }
.gen-spinner {
  width: 56px; height: 56px; border: 4px solid var(--border);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin 1s linear infinite; margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.gen-state h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.gen-state p { color: var(--muted); font-size: .92rem; }
.gen-done-icon { font-size: 3.5rem; margin-bottom: 16px; }

/* Navigation buttons */
.wizard-nav { display: flex; gap: 12px; justify-content: space-between; margin-top: 28px; flex-wrap: wrap; }
.wizard-nav-right { display: flex; gap: 12px; margin-left: auto; }

/* Error message */
.err-msg {
  background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .87rem; margin-top: 12px; display: none;
}
.err-msg.show { display: block; }

/* ── Responsive tweaks ───────────────────────── */
@media (max-width: 560px) {
  .auth-card { padding: 28px 20px; }
  .cta-block { margin: 0; padding: 52px 20px; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .wp-label { display: none; }
  .wizard-nav { flex-direction: column; }
  .wizard-nav-right { margin-left: 0; }
  .btn-lg { padding: 12px 24px; }
}
