/* ── Шрифты Уника Метаматрица ─────────────────────────────────────────────── */
@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/Nunito-Light.ttf') format('truetype');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/Nunito-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/Nunito-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/Nunito-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/static/fonts/Nunito-ExtraBold.ttf') format('truetype');
  font-weight: 800; font-style: normal; font-display: swap;
}

/* ── Переменные (перекрываются через <style> в base.html из БД) ──────────── */
:root {
  --color-primary: #5D4280;
  --color-accent:  #7B5EA7;
  --color-light:   #B5CBE2;
  --color-bg:      #f9f8fc;
  --color-surface: #ffffff;
  --color-border:  #e8e0f0;
  --color-text:    #1a1528;
  --color-muted:   #7a7085;
  --color-success: #22c55e;
  --color-danger:  #ef4444;
  --color-warning: #f59e0b;

  --font-heading: 'Nunito', sans-serif;
  --font-body:    'Nunito', sans-serif;

  --radius:        14px;
  --radius-sm:     8px;
  --radius-lg:     24px;
  --shadow:        0 2px 12px rgba(93,66,128,.10);
  --shadow-lg:     0 8px 32px rgba(93,66,128,.18);
  --transition:    .2s ease;

  --nav-h: 68px;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { opacity: .85; }

/* ── Контейнер ──────────────────────────────────────────────────────────────── */
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* ── Навигация ───────────────────────────────────────────────────────────────── */
.nav-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  height: var(--nav-h);
  box-shadow: var(--shadow);
}
.nav-inner {
  display: flex; align-items: center; gap: 24px;
  height: 100%;
}
.nav-logo { display: flex; align-items: center; gap: 10px; }
.nav-logo img { height: 44px; object-fit: contain; }
.nav-logo span {
  font-family: var(--font-heading); font-weight: 800; font-size: 1.05rem;
  color: var(--color-primary); line-height: 1.2; max-width: 200px;
}
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-links a { font-weight: 600; color: var(--color-text); transition: color var(--transition); }
.nav-links a:hover { color: var(--color-primary); }
.nav-actions { display: flex; gap: 10px; }
.nav-burger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 4px; }
.nav-burger span { display: block; width: 24px; height: 2px; background: var(--color-text); border-radius: 2px; }

/* ── Кнопки ──────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: .9rem; font-weight: 700;
  cursor: pointer; border: 2px solid transparent;
  transition: all var(--transition); text-decoration: none; white-space: nowrap;
}
.btn-primary  { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover  { filter: brightness(1.12); opacity: 1; }
.btn-accent   { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.btn-outline  { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover  { background: var(--color-primary); color: #fff; opacity: 1; }
.btn-ghost    { background: transparent; color: var(--color-muted); border-color: var(--color-border); }
.btn-danger   { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 36px; font-size: 1.05rem; }

/* ── Секции ──────────────────────────────────────────────────────────────────── */
.section { padding: 72px 0; }
.section-title {
  font-family: var(--font-heading); font-size: 2rem; font-weight: 800;
  text-align: center; margin-bottom: 48px; color: var(--color-text);
}

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, #7B5EA7 60%, var(--color-light) 100%);
  color: #fff; padding: 96px 0;
  text-align: center;
}
.hero-title {
  font-family: var(--font-heading); font-size: 3rem; font-weight: 800;
  line-height: 1.15; margin-bottom: 20px;
}
.hero-subtitle { font-size: 1.2rem; opacity: .92; max-width: 620px; margin: 0 auto 36px; }
.hero-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero .btn-primary { background: #fff; color: var(--color-primary); border-color: #fff; }
.hero .btn-outline  { border-color: rgba(255,255,255,.75); color: #fff; }
.hero .btn-outline:hover { background: rgba(255,255,255,.18); }

/* ── Карточки преимуществ ────────────────────────────────────────────────────── */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 24px; }
.feature-card {
  background: var(--color-surface); border-radius: var(--radius);
  padding: 28px; border: 1px solid var(--color-border);
  box-shadow: var(--shadow); transition: box-shadow var(--transition), transform var(--transition);
}
.feature-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.feature-icon { font-size: 2.4rem; margin-bottom: 14px; }
.feature-card h3 { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { color: var(--color-muted); font-size: .9rem; }

/* ── Карточки курсов ──────────────────────────────────────────────────────────── */
.courses-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 24px; }
.course-card {
  background: var(--color-surface); border-radius: var(--radius);
  border: 1px solid var(--color-border); box-shadow: var(--shadow);
  overflow: hidden; transition: box-shadow var(--transition), transform var(--transition);
  display: flex; flex-direction: column; color: inherit;
}
.course-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.course-cover { width: 100%; height: 180px; object-fit: cover; }
.course-cover-placeholder { width: 100%; height: 180px; background: linear-gradient(135deg,var(--color-primary),var(--color-accent)); }
.course-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.course-card-body h3 { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; }
.course-card-body p { color: var(--color-muted); font-size: .85rem; flex: 1; }
.course-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.price-badge {
  background: var(--color-primary); color: #fff;
  padding: 4px 12px; border-radius: 20px; font-size: .82rem; font-weight: 700;
}
.price-badge.free { background: var(--color-success); }

/* ── CTA блок ────────────────────────────────────────────────────────────────── */
.cta-box {
  background: linear-gradient(135deg,var(--color-primary),var(--color-accent));
  border-radius: var(--radius-lg); padding: 60px 40px;
  text-align: center; color: #fff;
}
.cta-box h2 { font-family: var(--font-heading); font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.cta-box p  { opacity: .9; margin-bottom: 28px; }
.cta-box .btn-primary { background: #fff; color: var(--color-primary); }

/* ── Форма ───────────────────────────────────────────────────────────────────── */
.contact-form { max-width: 640px; margin: 0 auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: .88rem; font-weight: 700; color: var(--color-text); }
.form-group input,
.form-group textarea,
.form-group select {
  border: 1.5px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 10px 14px; font-family: var(--font-body); font-size: .9rem;
  background: var(--color-surface); color: var(--color-text);
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(93,66,128,.12);
}
.form-group textarea { resize: vertical; min-height: 100px; }

/* ── Футер ───────────────────────────────────────────────────────────────────── */
.footer {
  background: #1e1428; color: rgba(255,255,255,.8);
  padding: 48px 0 24px;
}
.footer-inner { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 40px; }
.footer-brand strong { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 800; color: #fff; }
.footer-brand p { margin-top: 8px; font-size: .85rem; opacity: .7; }
.footer-logo { height: 40px; filter: brightness(0) invert(1); opacity: .9; margin-bottom: 12px; }
.footer-requisites { margin-top: 16px; font-size: .78rem; opacity: .55; line-height: 1.8; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: rgba(255,255,255,.7); font-size: .9rem; }
.footer-links a:hover { color: #fff; }
.footer-meta { font-size: .8rem; opacity: .6; }
.footer-bottom {
  margin-top: 32px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; justify-content: space-between; align-items: center;
  font-size: .8rem; opacity: .55;
}

/* ── Auth страницы ───────────────────────────────────────────────────────────── */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #f0ecf7 0%, #e8e0f4 100%); }
.auth-card {
  background: var(--color-surface); border-radius: var(--radius-lg);
  padding: 44px 40px; width: 100%; max-width: 440px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--color-border);
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-logo img { height: 52px; }
.auth-card h1 { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 800; margin-bottom: 6px; }
.auth-card .subtitle { color: var(--color-muted); font-size: .9rem; margin-bottom: 28px; }
.auth-divider { text-align: center; color: var(--color-muted); font-size: .85rem; margin: 20px 0; position: relative; }
.auth-divider::before {
  content: ''; position: absolute; left: 0; right: 0; top: 50%;
  height: 1px; background: var(--color-border); z-index: 0;
}
.auth-divider span { background: var(--color-surface); padding: 0 12px; position: relative; z-index: 1; }
.alert {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: .88rem; margin-bottom: 16px;
}
.alert-error   { background: #fef2f2; color: var(--color-danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--color-success); border: 1px solid #bbf7d0; }
.alert-info    { background: #f3f0f8; color: var(--color-primary); border: 1px solid #d5c9ea; }

/* ── Telegram кнопка ─────────────────────────────────────────────────────────── */
.btn-telegram { background: #229ED9; color: #fff; border-color: #229ED9; }
.btn-telegram:hover { filter: brightness(1.1); }

/* ── Dashboard ───────────────────────────────────────────────────────────────── */
.dashboard-layout { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - var(--nav-h)); }
.sidebar {
  background: var(--color-surface); border-right: 1px solid var(--color-border);
  padding: 24px 0;
}
.sidebar-nav { display: flex; flex-direction: column; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: var(--color-text); font-weight: 600;
  transition: background var(--transition), color var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: rgba(93,66,128,.09); color: var(--color-primary);
}
.sidebar-nav a .icon { font-size: 1.1rem; width: 22px; }
.main-content { padding: 32px; }
.page-title {
  font-family: var(--font-heading); font-size: 1.6rem; font-weight: 800;
  margin-bottom: 24px;
}

/* ── Таблицы ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 10px 14px;
  background: rgba(93,66,128,.06); font-weight: 700; font-size: .85rem;
  border-bottom: 2px solid var(--color-border);
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--color-border); font-size: .9rem; }
tbody tr:hover td { background: rgba(93,66,128,.03); }

/* ── Бейджи статусов ─────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 700;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #ede9f7; color: var(--color-primary); }
.badge-muted   { background: #f3f4f6; color: var(--color-muted); }

/* ── Карточка дашборда ───────────────────────────────────────────────────────── */
.stat-card {
  background: var(--color-surface); border-radius: var(--radius);
  padding: 22px 24px; border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}
.stat-card .label { font-size: .82rem; color: var(--color-muted); font-weight: 600; margin-bottom: 6px; }
.stat-card .value { font-size: 1.9rem; font-weight: 800; color: var(--color-primary); }

/* ── Адаптив ─────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-title   { font-size: 2rem; }
  .nav-links    { display: none; flex-direction: column; position: absolute; top: var(--nav-h); left: 0; right: 0; background: var(--color-surface); padding: 16px; border-bottom: 1px solid var(--color-border); z-index: 99; }
  .nav-links.open { display: flex; }
  .nav-burger   { display: flex; }
  .nav-inner    { position: relative; }
  .footer-inner { grid-template-columns: 1fr; }
  .form-row     { grid-template-columns: 1fr; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar      { display: none; }
  .auth-card    { padding: 28px 20px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}
