/*
 * theme.css — Единый файл стилей сайта
 *
 * СТРУКТУРА:
 *   1. CSS-переменные (цвета, типографика, размеры)
 *   2. Сброс и базовые стили
 *   3. Фоновый декор
 *   4. Шапка (header)
 *   5. Сайдбар и навигация
 *   6. Контентная область
 *   7. Форма авторизации (auth)
 *   8. Карточки тарифов (products)
 *   9. Футер
 *  10. Страницы документов (privacy / terms)
 *  11. Лендинг (index.html)
 *  12. История заказов (orders.html)
 *  13. Адаптив (responsive)
 *  14. Анимации
 */

/* ═══════════════════════════════════════════════════════════
   1. CSS-ПЕРЕМЕННЫЕ
   Меняйте значения здесь — изменения применятся на всех страницах.
   ═══════════════════════════════════════════════════════════ */
:root {
  /* ── Фоны ───────────────────────────────────────────────── */
  --bg:       #0d0d0f;   /* основной фон страницы              */
  --surface:  #17171a;   /* фон карточек, модалок              */
  --surface2: #1f1f24;   /* фон полей ввода, вложенных блоков  */
  --surface3: #242428;   /* ещё один уровень вложенности       */

  /* ── Границы ────────────────────────────────────────────── */
  --border:        rgba(255,255,255,0.08);  /* обычная граница      */
  --border-strong: rgba(255,255,255,0.18);  /* граница при фокусе   */

  /* ── Текст ──────────────────────────────────────────────── */
  --text:       #f0eeeb;  /* основной текст                    */
  --text-soft:  #a8a5a0;  /* второстепенный текст              */
  --text-muted: #7a7876;  /* подсказки, метки, даты            */

  /* ── Акцент (золотистый) ────────────────────────────────── */
  --accent:      #e8d5a3;                   /* основной акцент      */
  --accent-glow: rgba(232, 213, 163, 0.15); /* свечение акцента     */
  --accent-dim:  rgba(232, 213, 163, 0.08); /* фон активного пункта */

  /* ── Статусные цвета ────────────────────────────────────── */
  --danger:  #e07070;  /* ошибки                               */
  --success: #78c5a0;  /* успех                                */
  --warning: #e8c57a;  /* ожидание оплаты, предупреждения      */

  /* ── Размеры и типографика ──────────────────────────────── */
  --sidebar-w:    220px;
  --radius:       16px;
  --content-max:  780px;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
}

/* ═══════════════════════════════════════════════════════════
   2. СБРОС И БАЗОВЫЕ СТИЛИ
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════
   3. ФОНОВЫЙ ДЕКОР
   ═══════════════════════════════════════════════════════════ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 10%, rgba(232,213,163,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 60% at 80% 90%, rgba(120,197,160,0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════
   4. ШАПКА (HEADER)
   ═══════════════════════════════════════════════════════════ */
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,13,15,0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-user { display: flex; align-items: center; gap: 12px; }

.header-avatar {
  width: 32px; height: 32px;
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.header-username { font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.2; }
.header-since    { font-size: 11px; color: var(--text-muted); }

.header-logo {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--accent);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 12px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.btn-logout:hover { border-color: var(--border-strong); color: var(--text-soft); }

/* ═══════════════════════════════════════════════════════════
   5. САЙДБАР И НАВИГАЦИЯ
   ═══════════════════════════════════════════════════════════ */
.home-body { display: flex; flex: 1; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-link:hover  { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--accent-dim); color: var(--accent); }
.nav-link svg    { width: 16px; height: 16px; opacity: 0.7; flex-shrink: 0; }
.nav-link.active svg { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   6. КОНТЕНТНАЯ ОБЛАСТЬ
   ═══════════════════════════════════════════════════════════ */
.home-content {
  flex: 1;
  padding: 32px 36px;
  overflow-y: auto;
  animation: fadeUp 0.35s ease both;
}

.content-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 24px;
}

#page-home { display: none; position: relative; z-index: 1; min-height: 100vh; }
#page-home.active { display: flex; flex-direction: column; }

/* ═══════════════════════════════════════════════════════════
   7. ФОРМА АВТОРИЗАЦИИ
   ═══════════════════════════════════════════════════════════ */
.step { display: none; }
.step.active { display: block; }

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}
.field input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px; font-weight: 300;
  padding: 14px 16px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.field input:focus { border-color: var(--border-strong); }
.field input.error { border-color: var(--danger); }

.otp-grid { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.otp-grid input {
  width: 52px; height: 60px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 24px; text-align: center;
  outline: none; caret-color: var(--accent);
  transition: border-color 0.2s, background 0.2s;
  -webkit-appearance: none;
}
.otp-grid input:focus { border-color: var(--accent); background: rgba(232,213,163,0.04); }
.otp-grid input.error { border-color: var(--danger); }

.otp-hint { text-align: center; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.otp-hint span { color: var(--accent); }

.btn {
  width: 100%; padding: 14px;
  border-radius: 10px; border: none;
  cursor: pointer;
  font-family: var(--font-body); font-size: 15px; font-weight: 500;
  letter-spacing: 0.02em;
  transition: opacity 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #1a1a14; }
.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); margin-top: 10px;
}
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text-soft); }

.msg {
  font-size: 13px; padding: 12px 14px;
  border-radius: 8px; margin-bottom: 16px; display: none;
}
.msg.visible { display: block; }
.msg-error   { background: rgba(224,112,112,0.1); border: 1px solid rgba(224,112,112,0.25); color: var(--danger); }
.msg-success { background: rgba(120,197,160,0.1); border: 1px solid rgba(120,197,160,0.25); color: var(--success); }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(26,26,20,0.3);
  border-top-color: rgba(26,26,20,0.9);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}

/* ═══════════════════════════════════════════════════════════
   8. КАРТОЧКИ ТАРИФОВ
   ═══════════════════════════════════════════════════════════ */
#products-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.4); }
.card:hover::before { opacity: 1; }

.card-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: var(--surface2); }
.card-img-placeholder {
  width: 100%; aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2); color: var(--text-muted);
}
.card-img-placeholder svg { width: 40px; height: 40px; opacity: 0.3; }

.card-body   { padding: 18px 20px 20px; }
.card-title  { font-family: var(--font-display); font-size: 16px; font-weight: 400; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.card-desc   { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.card-meta   { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.card-meta-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.card-meta-key { color: var(--text-muted); }
.card-meta-val { color: var(--text-soft); background: var(--surface2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 8px; font-size: 11px; }

.card-footer { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-price  { font-family: var(--font-display); font-size: 22px; color: var(--accent); }
.card-price-sub { font-size: 11px; color: var(--text-muted); }

.action-btn { padding: 9px 18px; border-radius: 8px; border: none; font-family: var(--font-body); font-size: 13px; font-weight: 500; cursor: pointer; transition: opacity 0.2s, transform 0.1s; }
.action-btn:active { transform: scale(0.97); }
.btn-select { background: var(--accent); color: #1a1a14; width: 100%; }
.btn-select:hover { opacity: 0.88; }

.buy-form { display: none; margin-top: 4px; }
.buy-form label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }

.email-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: var(--font-body);
  font-size: 13px; padding: 10px 12px; outline: none;
  transition: border-color 0.2s; margin-bottom: 10px; -webkit-appearance: none;
}
.email-input:focus { border-color: var(--border-strong); }
.btn-buy { background: var(--success); color: #0d1a13; width: 100%; }
.btn-buy:hover:not(:disabled) { opacity: 0.88; }
.btn-buy:disabled { opacity: 0.35; cursor: not-allowed; }

/* ═══════════════════════════════════════════════════════════
   9. ФУТЕР
   ═══════════════════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 36px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.site-footer a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.site-footer a:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════
   10. СТРАНИЦЫ ДОКУМЕНТОВ (privacy.html / terms.html)
   ═══════════════════════════════════════════════════════════ */
#page-doc { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.doc-content { flex: 1; padding: 40px 36px; max-width: calc(var(--content-max) + 72px); width: 100%; margin: 0 auto; animation: fadeUp 0.35s ease both; }
.doc-content h1 { font-family: var(--font-display); font-size: 28px; font-weight: 400; color: var(--text); margin-bottom: 8px; line-height: 1.2; }
.doc-content .doc-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 36px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.doc-content h2 { font-family: var(--font-display); font-size: 17px; font-weight: 400; color: var(--accent); margin: 32px 0 12px; }
.doc-content p { font-size: 15px; color: var(--text-soft); margin-bottom: 14px; line-height: 1.75; }
.doc-content ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; }
.doc-content ul li { font-size: 15px; color: var(--text-soft); line-height: 1.7; padding-left: 20px; position: relative; }
.doc-content ul li::before { content: '—'; position: absolute; left: 0; color: var(--accent); opacity: 0.6; }

/* ═══════════════════════════════════════════════════════════
   11. ЛЕНДИНГ (index.html)
   ═══════════════════════════════════════════════════════════ */
.landing-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.landing-box {
  width: 100%;
  max-width: 1100px;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  animation: fadeUp 0.4s ease both;
  position: relative;
}
.landing-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

/* Левая колонка — форма */
.landing-left {
  width: 37.5%;
  flex-shrink: 0;
  padding: 48px 40px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.landing-logo {
  width: 100%; height: 70px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 28px;
}
.landing-logo img { max-width: 100%; max-height: 70px; object-fit: contain; }
.landing-logo-fallback {
  width: 44px; height: 44px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
}
.landing-logo-fallback::after { content: '●'; font-family: var(--font-display); font-size: 20px; color: var(--accent); opacity: 0.7; }

.landing-greeting {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 400;
  color: var(--text);
  text-align: center;
  margin-bottom: 6px; line-height: 1.2;
}
.landing-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.landing-form { flex: 1; }

/* Правая колонка — контент */
.landing-right {
  flex: 1;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.landing-img { width: 100%; max-width: 420px; display: flex; align-items: center; justify-content: center; }
.landing-img img { max-width: 100%; max-height: 220px; object-fit: contain; display: block; }
.landing-img-fallback { width: 100%; height: 160px; background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; }

.landing-text { max-width: 480px; font-size: 14px; font-weight: 300; color: var(--text-soft); line-height: 1.8; text-align: center; }

/* ═══════════════════════════════════════════════════════════
   12. ИСТОРИЯ ЗАКАЗОВ (orders.html)
   ═══════════════════════════════════════════════════════════ */
.section-label { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }
.section-label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warning); flex-shrink: 0; box-shadow: 0 0 6px var(--warning); animation: pulse 2s ease-in-out infinite; }
.dot-paid { background: var(--success) !important; box-shadow: 0 0 6px var(--success) !important; animation: none !important; }

.orders-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }

.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; position: relative; overflow: hidden; transition: border-color 0.2s; }
.order-card::before { content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%; background: var(--warning); opacity: 0.7; }
.order-card.paid::before { background: var(--success); }
.order-card:hover { border-color: var(--border-strong); }

.order-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.order-date-label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 2px; }
.order-date-value { font-size: 14px; color: var(--text-soft); font-weight: 400; }
.order-link-block { flex: 1; min-width: 0; }
.order-link-label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 4px; }
.order-link-row { display: flex; align-items: center; gap: 10px; }
.order-link-text { font-size: 13px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }

.btn-pay { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 8px; border: none; background: var(--warning); color: #1a1500; font-family: var(--font-body); font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; transition: opacity 0.2s, transform 0.1s; white-space: nowrap; flex-shrink: 0; }
.btn-pay:hover { opacity: 0.88; }
.btn-pay:active { transform: scale(0.97); }
.btn-pay svg { width: 13px; height: 13px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px; }
.empty-state-icon { font-size: 36px; margin-bottom: 16px; opacity: 0.4; }
.empty-state-title { font-family: var(--font-display); font-size: 18px; color: var(--text-soft); margin-bottom: 8px; }

.skeleton { background: var(--surface2); border-radius: 8px; height: 80px; animation: shimmer 1.5s ease-in-out infinite; }

.load-error { background: rgba(224,112,112,0.08); border: 1px solid rgba(224,112,112,0.2); border-radius: 10px; padding: 16px 20px; color: var(--danger); font-size: 13px; }

#page-unauth { position: relative; z-index: 1; min-height: 100vh; display: none; align-items: center; justify-content: center; }
#page-unauth.active { display: flex; }
.unauth-card { text-align: center; padding: 48px 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 360px; width: 100%; animation: fadeUp 0.4s ease both; }
.unauth-card p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.unauth-card a { display: inline-block; padding: 12px 28px; background: var(--accent); color: #1a1a14; border-radius: 10px; font-size: 14px; font-weight: 500; text-decoration: none; transition: opacity 0.2s; }
.unauth-card a:hover { opacity: 0.88; }

#page-main { display: none; position: relative; z-index: 1; min-height: 100vh; }
#page-main.active { display: flex; flex-direction: column; }

/* ═══════════════════════════════════════════════════════════
   13. АДАПТИВ
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) and (min-width: 769px) {
  #products-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .landing-box { flex-direction: column; }
  .landing-left { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 36px 28px; }
  .landing-right { padding: 32px 28px; }
}

@media (max-width: 768px) {
  .home-body { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); padding: 10px 12px; flex-direction: row; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-label { display: none; }
  .nav-link { flex-shrink: 0; padding: 8px 14px; white-space: nowrap; font-size: 13px; }
  .home-content { padding: 20px 16px; }
  #products-grid { grid-template-columns: 1fr; }
  .header-logo { display: none; }
  .header-since { display: none; }
  .doc-content { padding: 24px 16px; }
  .site-footer { padding: 16px; flex-direction: column; align-items: flex-start; }
  .order-meta { flex-direction: column; align-items: flex-start; gap: 12px; }
  .order-link-text { max-width: 200px; }
  .btn-pay { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .landing-wrap { padding: 16px; }
  .landing-left { padding: 28px 20px; }
  .landing-right { padding: 24px 20px; }
  .landing-greeting { font-size: 22px; }
}

/* ═══════════════════════════════════════════════════════════
   14. АНИМАЦИИ
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin   { to { transform: rotate(360deg); } }
@keyframes pulse  { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes shimmer { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
