/* ============================================================
   LazyCommission — Кабинет обучения
   Тёмно-зелёный + золото, шрифт Onest
   ============================================================ */
:root {
  --bg: #0b1f16;
  --bg2: #0e2a1d;
  --card: #12291d;
  --line: #1e3d2b;
  --gold: #d4a94e;
  --gold2: #f0c86a;
  --text: #eef4ee;
  --muted: #9db3a4;
  --green: #2e7d4f;
  --red: #c0392b;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Onest', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(600px 400px at 15% 0%, rgba(212,169,78,.08), transparent 60%),
    radial-gradient(800px 500px at 90% 20%, rgba(46,125,79,.15), transparent 60%),
    var(--bg);
}
a { color: var(--gold2); }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }

/* --- шапка --- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: rgba(11,31,22,.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 800; font-size: 1.1em; color: var(--text); text-decoration: none; }
.userbox { display: flex; gap: 12px; align-items: center; font-size: .92em; }
.link { color: var(--gold2); text-decoration: none; }
.link:hover { text-decoration: underline; }
.back { display: inline-block; margin-bottom: 8px; }
.pkg {
  font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 4px 10px; border-radius: 20px; border: 1px solid var(--gold);
}
.pkg-start { color: var(--gold2); }
.pkg-pro { background: rgba(212,169,78,.15); color: var(--gold2); }
.pkg-mentorship { background: var(--gold); color: #1a1206; }

/* --- layout --- */
.wrap { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }
.wrap.wide { max-width: 1100px; }
.center { min-height: 90vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.foot { text-align: center; padding: 24px; border-top: 1px solid var(--line); }

/* --- вход --- */
.login-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 36px 32px; width: 100%; max-width: 420px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-card .brand { font-size: 1.4em; display: block; margin-bottom: 8px; }
.login-card h1 { margin: 0 0 6px; font-size: 1.5em; }
.login-card form { text-align: left; margin-top: 18px; }

/* --- формы --- */
label { display: block; margin: 12px 0 4px; font-size: .92em; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 12px 14px; margin-top: 6px;
  background: #0c1f15; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-family: inherit; font-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { resize: vertical; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 12px;
  border: 1px solid var(--line); background: #16351f; color: var(--text);
  font-family: inherit; font-size: 1em; font-weight: 600; cursor: pointer;
  text-decoration: none; text-align: center;
}
.btn:hover { border-color: var(--gold); }
.btn.gold { background: linear-gradient(135deg, var(--gold), #b98a2e); color: #1a1206; border: none; }
.btn.gold:hover { filter: brightness(1.08); }
.btn.xs { padding: 6px 10px; font-size: .9em; border-radius: 8px; }
.btn.danger { border-color: var(--red); color: #f0a49a; }
.alert {
  background: rgba(192,57,43,.15); border: 1px solid var(--red);
  padding: 12px 16px; border-radius: 10px; margin: 14px 0;
}
.alert.ok { background: rgba(46,125,79,.15); border-color: var(--green); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.row.small { font-size: .92em; }
.mini { display: inline; }
.mini select, .mini input { width: auto; padding: 6px 8px; font-size: .9em; margin: 0; }

/* --- модули --- */
.module {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  margin: 16px 0; overflow: hidden;
}
.module-head { padding: 20px; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.module-head:hover { background: rgba(212,169,78,.04); }
.module-num { color: var(--gold); font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.module-head h2 { margin: 4px 0; font-size: 1.25em; }
.module-head p { margin: 4px 0 0; }
.module-progress { text-align: right; min-width: 140px; }
.pbar { height: 8px; background: #0c1f15; border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.pbar > div { height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); }
.lessons { display: none; border-top: 1px solid var(--line); }
.lessons.open { display: block; }
.lesson-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 20px;
  text-decoration: none; color: var(--text); border-bottom: 1px solid var(--line);
}
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover { background: rgba(212,169,78,.05); }
.lesson-check {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #0c1f15; font-weight: 700; color: var(--muted);
}
.lesson-row.done .lesson-check { background: var(--green); border-color: var(--green); color: #fff; }
.lesson-title { flex: 1; }
.hw { font-size: .75em; font-weight: 700; padding: 4px 10px; border-radius: 12px; white-space: nowrap; }
.hw-ok { background: rgba(46,125,79,.25); color: #7fd69a; }
.hw-rev { background: rgba(212,169,78,.2); color: var(--gold2); }
.hw-pend { background: rgba(120,130,140,.2); color: #b9c6cd; }

/* --- урок --- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; margin: 16px 0;
}
.card h3 { margin-top: 0; }
.card h4 { color: var(--gold2); margin: 18px 0 8px; }
.video { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 14px; overflow: hidden; background: #000; margin: 16px 0; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: none; }
/* Водяной знак: данные ученика поверх контента */
.wm {
  position: absolute; z-index: 5; pointer-events: none; user-select: none;
  color: rgba(255,255,255,.6); font-size: 14px; font-weight: 700; line-height: 1.4;
  text-shadow: 0 1px 4px rgba(0,0,0,.85); white-space: nowrap;
  transition: top 1.2s ease, left 1.2s ease;
}
.pdfview { position: relative; }
.pdfview { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); margin-top: 10px; }
.pdfview iframe { width: 100%; height: 70vh; min-height: 420px; border: none; background: #fff; }
.richtext { line-height: 1.65; }
.feedback {
  background: rgba(212,169,78,.1); border-left: 3px solid var(--gold);
  padding: 12px 14px; border-radius: 0 10px 10px 0; margin-top: 10px;
}
.submission { border-top: 1px solid var(--line); padding: 14px 0; }
.sub-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.hw-form textarea { min-height: 110px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin: 26px 0; flex-wrap: wrap; }
.inline-form label { margin: 8px 0 2px; }
details.card summary { cursor: pointer; padding: 4px 0; }
details.card summary:hover { color: var(--gold2); }

/* --- админка --- */
.tabs { display: flex; gap: 8px; padding: 14px 20px 0; flex-wrap: wrap; }
.tab {
  padding: 10px 18px; border: 1px solid var(--line); border-bottom: none;
  border-radius: 12px 12px 0 0; text-decoration: none; color: var(--muted); font-weight: 600;
}
.tab.active { background: var(--card); color: var(--gold2); }
.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 14px; overflow: hidden; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: .92em; }
.tbl th { color: var(--gold2); font-weight: 700; }
.lesson-edit { margin: 12px 0; }

/* --- адаптив --- */
@media (max-width: 640px) {
  .grid3 { grid-template-columns: 1fr; }
  .module-head { flex-direction: column; align-items: flex-start; }
  .module-progress { width: 100%; }
  .userbox span:not(.pkg) { display: none; }
  .lesson-nav { flex-direction: column; }
  .pdfview iframe { height: 60vh; min-height: 320px; }
}

/* --- витрина модулей --- */
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.module-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s ease, border-color .15s ease;
}
.module-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.module-thumb { position: relative; aspect-ratio: 16/9; background: #0a241a; overflow: hidden; }
.module-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-pkg { position: absolute; top: 10px; right: 10px; }
.module-card-body { padding: 16px 18px 18px; }
.module-card-body h2 { margin: 4px 0 10px; font-size: 1.08em; line-height: 1.35; }

/* --- страница модуля --- */
.module-hero { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 24px; align-items: center; margin: 14px 0 26px; }
.module-hero-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 16px; border: 1px solid var(--line); }
.module-hero-text h1 { margin: 4px 0 10px; font-size: 1.6em; }
.pbar.big { height: 10px; margin: 14px 0 6px; }

/* --- карточки уроков --- */
.lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.lesson-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; text-decoration: none; color: inherit; transition: transform .15s ease, border-color .15s ease;
}
.lesson-card:hover { transform: translateY(-2px); border-color: var(--gold); }
.lesson-card.done { border-color: rgba(46,125,50,.6); }
.lesson-thumb { position: relative; aspect-ratio: 16/9; background: #0a241a; overflow: hidden; }
.lesson-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lesson-num-badge {
  position: absolute; left: 10px; bottom: 10px; min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(7,26,17,.85); border: 1px solid var(--gold); color: var(--gold2);
  border-radius: 10px; font-weight: 800;
}
.lesson-card-body { padding: 12px 14px 14px; }
.lesson-num { color: var(--gold); font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.lesson-title { margin: 4px 0 8px; font-weight: 600; line-height: 1.4; }
.lesson-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* закрытый урок */
.lesson-card.locked { cursor: default; }
.lesson-card.locked .lesson-thumb img { filter: grayscale(.7) brightness(.6); }
.lock-badge {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(7,26,17,.88); border: 1px solid var(--line); color: var(--muted);
  border-radius: 10px; padding: 6px 10px; font-size: .85em; font-weight: 600;
}
.lock-card { text-align: center; padding: 48px 24px; }
.lock-big { font-size: 56px; margin-bottom: 8px; }
.lesson-hero { margin: 6px 0 18px; }
.lesson-hero img { width: 100%; max-height: 320px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }

/* --- админка: превью картинок --- */
.admin-thumb { width: 220px; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* --- адаптив: планшет --- */
@media (max-width: 1024px) {
  .wrap { max-width: 100%; }
  .module-grid { grid-template-columns: repeat(2, 1fr); }
  .lesson-grid { grid-template-columns: repeat(2, 1fr); }
  .module-hero { grid-template-columns: 1fr; gap: 16px; }
  .module-hero-img { max-height: 300px; }
}
/* --- адаптив: телефон --- */
@media (max-width: 640px) {
  .module-grid, .lesson-grid { grid-template-columns: 1fr; gap: 14px; }
  .module-card-body h2 { font-size: 1.05em; }
  .module-hero-text h1 { font-size: 1.3em; }
  .topbar { padding: 10px 12px; }
  .uname { display: none; }
  .back { display: inline-block; margin-bottom: 6px; }
  .admin-thumb { width: 100%; max-width: 320px; }
  .lesson-nav .btn { width: 100%; text-align: center; }
}
