@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg:        #1B1B20;
  --surface:   #24242B;
  --surface-2: #2E2E36;
  --border:    #3A3A43;
  --text:      #F2F2F4;
  --muted:     #96969F;
  --faint:     #55555F;
  --accent:    #FFFFFF;
  --radius:    14px;
  --radius-sm: 8px;
  --shadow:    0 18px 50px rgba(0,0,0,.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* Pages that need centered card layout (login, register, userzone, userinfo) */
body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.card.wide { max-width: 560px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 6px;
}
.brand .logo {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--accent);
  display: grid; place-items: center;
  color: var(--bg); font-weight: 700; font-size: 18px;
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .2px; color: var(--text); }

h2 {
  text-align: center;
  font-size: 24px;
  margin: 18px 0 4px;
  color: var(--text);
}
.subtitle {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 26px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px 4px;
}

input, select, textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
/* Чекбоксы — нативные: общие правила input (width:100%, padding) их ломали */
input[type="checkbox"] {
  -webkit-appearance: checkbox; appearance: auto;
  width: 16px; height: 16px; min-width: 16px;
  padding: 0; border: none; background: none; box-shadow: none;
  accent-color: var(--accent, #5B5BFF);
  cursor: pointer;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--faint);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(255,255,255,.06);
}

.field { margin-bottom: 18px; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0 0 4px; }

button.primary {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s, box-shadow .15s, opacity .15s;
  box-shadow: 0 10px 24px rgba(255,255,255,.08);
}
button.primary:hover { opacity: .9; box-shadow: 0 12px 30px rgba(255,255,255,.12); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: .6; cursor: not-allowed; }

.switch {
  text-align: center;
  margin-top: 22px;
  font-size: 14px;
  color: var(--muted);
}
.switch a { color: var(--text); font-weight: 600; text-decoration: none; }
.switch a:hover { text-decoration: underline; }

.alert {
  display: none;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert.show { display: block; }
.alert.error { background: #1A0A0A; color: #EF4444; border: 1px solid #2A1010; }
.alert.success { background: #0A1A0D; color: #22C55E; border: 1px solid #102A14; }

/* userzone / profile header */
.uz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  display: grid; place-items: center;
  font-size: 26px; font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 500;
  color: var(--text);
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-sm img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.uz-name { font-size: 22px; font-weight: 700; margin: 0; color: var(--text); }
.uz-sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

button.ghost {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: inherit;
}
button.ghost:hover { background: var(--surface-2); border-color: var(--faint); }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.info-card.full { grid-column: 1 / -1; }
.info-card .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.info-card .v { font-size: 18px; font-weight: 600; margin-top: 6px; word-break: break-word; color: var(--text); }

.balance .v { color: var(--accent); font-size: 26px; }

.loading { text-align: center; color: var(--muted); padding: 30px 0; }

.btn-create {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .12s;
}
.btn-create:hover { opacity: .88; }
.btn-create.hidden { display: none; }

.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 15px;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }

.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.modal-close {
  background: none; border: none;
  color: var(--muted); font-size: 20px;
  cursor: pointer; line-height: 1;
  padding: 2px 4px;
  transition: color .12s;
}
.modal-close:hover { color: var(--text); }

.btn-submit {
  width: 100%;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .12s;
  margin-top: 6px;
}
.btn-submit:hover { opacity: .9; }
.btn-submit:disabled { opacity: .4; cursor: not-allowed; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.role-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
}
.role-badge.admin { background: #2A1A0A; color: #F5A623; border: 1px solid #3A2A1A; }
.role-badge.moderator { background: #0A1A2A; color: #5FA8F5; border: 1px solid #1A2A3A; }
.role-badge.user { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

select { appearance: none; cursor: pointer; }
textarea { min-height: 70px; resize: vertical; }

@media (max-width: 480px) {
  .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  body.centered { padding: 12px; }
  .card { padding: 24px 18px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Page transition animations ────────────────────────────── */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pageOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-8px) scale(.99); }
}

body {
  animation: pageIn .35s cubic-bezier(.16,1,.3,1) both;
}
body.leaving {
  animation: pageOut .2s cubic-bezier(.4,0,1,1) forwards;
  pointer-events: none;
}

/* smooth card hovers */
.card, .lot-card, .modcard, .stat-card, .panel, .reviews-panel, .hero {
  transition: border-color .2s, transform .22s cubic-bezier(.16,1,.3,1), box-shadow .22s !important;
}

/* link/button micro-interactions */
a, button { transition: opacity .15s, transform .15s cubic-bezier(.16,1,.3,1), color .15s, background .15s, border-color .15s; }

/* ── Lenis smooth-scroll + scroll reveal ───────────────────── */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
  will-change: opacity, transform;
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* ══ ТЕМЫ (переключаются в настройках, атрибут ставит app.js/prefs.js) ══ */

/* Светлая */
html[data-theme="light"] {
  --bg:        #F4F4F6;
  --surface:   #FFFFFF;
  --surface-2: #ECECEF;
  --border:    #DEDEE4;
  --text:      #141419;
  --muted:     #6E6E78;
  --faint:     #A5A5AF;
  --accent:    #141419;
  --shadow:    0 18px 50px rgba(20,20,25,.10);
}
html[data-theme="light"] button.primary { color: #FFFFFF; box-shadow: 0 10px 24px rgba(20,20,25,.14); }
html[data-theme="light"] input:focus, html[data-theme="light"] select:focus, html[data-theme="light"] textarea:focus {
  box-shadow: 0 0 0 4px rgba(20,20,25,.06);
}

/* Графит — серый с мягким градиентом */
html[data-theme="gray"] {
  --bg:        #24252C;
  --surface:   rgba(255,255,255,.045);
  --surface-2: rgba(255,255,255,.08);
  --border:    rgba(255,255,255,.10);
  --text:      #EDEEF2;
  --muted:     #9CA0AC;
  --faint:     #666B78;
  --accent:    #E9EBFF;
  --shadow:    0 18px 50px rgba(0,0,0,.45);
}
html[data-theme="gray"] body {
  background: linear-gradient(160deg, #202128 0%, #262834 45%, #322E4A 100%) fixed;
}
html[data-theme="gray"] button.primary {
  background: linear-gradient(135deg, #7C8CFF 0%, #A56BFF 100%);
  color: #FFFFFF;
  box-shadow: 0 10px 26px rgba(124,140,255,.28);
}

/* Бейдж национальности (общий для страниц) */
.nat-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px; vertical-align: middle;
}

/* ── Единая кнопка «Назад» для всех страниц ─────────────────────
   Всегда слева от заголовка, один стиль, одно поведение. */
.bk-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px 9px 13px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: all .15s;
  flex-shrink: 0;
}
.bk-btn:hover { color: var(--text); border-color: var(--faint, #555); transform: translateX(-2px); }
.bk-btn .bk-ic { font-size: 15px; line-height: 1; }

/* ===== Site footer (реквизиты + документы — требование ЮKassa) ===== */
.site-footer { border-top: 1px solid var(--border); padding: 36px 24px; margin-top: 48px; background: var(--bg); }
.site-footer .inner { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; justify-content: space-between; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer nav a { color: var(--muted); text-decoration: none; font-size: 13.5px; transition: color .15s; }
.site-footer nav a:hover { color: var(--text); }
.site-footer .requisites { flex-basis: 100%; color: var(--faint); font-size: 12.5px; line-height: 1.7; }
.site-footer .requisites b { color: var(--muted); font-weight: 500; }
