/* ============================================================
   FirstStep — стили (mobile-first)
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --text: #1f2330;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --error: #dc2626;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  white-space: nowrap;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  font-size: 1.3rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-dropdown { position: relative; }
.lang-btn { text-transform: uppercase; font-weight: 700; font-size: 0.95rem; }
.lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-width: 150px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.14);
  display: none;
  z-index: 70;
  overflow: hidden;
}
.lang-menu.open { display: block; }
.lang-option {
  display: block;
  padding: 13px 16px;
  color: var(--text);
  font-size: 0.95rem;
}
.lang-option:hover { background: var(--bg); }
.lang-option.active { color: var(--primary); font-weight: 700; }

/* Затемнение */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.overlay.show { opacity: 1; pointer-events: auto; }

/* Выезжающее меню */
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 78%;
  max-width: 320px;
  background: var(--surface);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .25s;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-weight: 800;
  font-size: 1.15rem;
  border-bottom: 1px solid var(--border);
}
.drawer-link {
  display: block;
  padding: 15px 18px;
  color: var(--text);
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.drawer-link.active { color: var(--primary); font-weight: 700; background: var(--bg); }
.drawer-link.drawer-exit { color: var(--error); margin-top: auto; }

.userbar {
  background: #eef2ff;
  color: var(--primary-dark);
  font-size: 0.85rem;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Контейнер ---------- */
.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 18px 14px 40px;
  flex: 1;
}

h1 { font-size: 1.5rem; margin-bottom: 12px; }
h2 { font-size: 1.15rem; margin: 18px 0 10px; }
p  { margin-bottom: 10px; color: var(--text); }

.stub {
  background: #fffbeb;
  border: 1px dashed #f59e0b;
  color: #92400e;
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}

/* ---------- Карточки ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-block;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: background .15s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger {
  background: #fee2e2;
  color: var(--error);
  border-color: #fecaca;
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; }

/* ---------- Формы ---------- */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.9rem;
  color: var(--muted);
}
.form input, .form select, .form textarea {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
}
.form input:focus, .form select:focus { outline: 2px solid var(--primary); }

/* ---------- Уведомления ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin: 10px 0;
  font-size: 0.95rem;
}
.alert.success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert.error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.hint { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }

/* ---------- Списки пользователей ---------- */
.user-list { list-style: none; }
.user-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.user-list li:last-child { border-bottom: none; }
.user-list .uinfo { display: flex; flex-direction: column; }
.user-list .uname { font-weight: 600; }
.user-list .umeta { font-size: 0.8rem; color: var(--muted); }

/* ---------- Герой (лендинг) ---------- */
.hero {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  border-radius: var(--radius);
  padding: 34px 22px;
  margin-bottom: 18px;
  text-align: center;
}
.hero h1 { color: #fff; font-size: 1.7rem; }
.hero p { color: #eef2ff; }
.hero .btn { background: #fff; color: var(--primary); border: none; font-weight: 700; }

.teacher-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) {
  .teacher-grid { grid-template-columns: 1fr 1fr; }
}
.teacher-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.teacher-card .avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: #e0e7ff;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.teacher-card h3 { margin-bottom: 4px; }
.teacher-card .rega { font-size: 0.85rem; color: var(--muted); }

/* ---------- Кнопка урока ---------- */
.lesson-btn {
  display: block;
  width: 100%;
  padding: 22px;
  font-size: 1.2rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  cursor: pointer;
  margin: 18px 0;
}

/* ---------- Подвал ---------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.back-link { display: inline-block; margin-top: 16px; }

/* ---------- ПК (большие экраны) ---------- */
@media (min-width: 768px) {
  .container { padding-top: 28px; }
}

/* ---------- Видеозвонок ---------- */
.video-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.video-box {
  background: #111;
  border-radius: 12px;
  overflow: hidden;
}
.video-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}
.video-box.remote { aspect-ratio: 16 / 9; width: 100%; }
.video-box.local {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 38%;
  max-width: 160px;
  aspect-ratio: 16 / 9;
  border: 2px solid #fff;
  z-index: 5;
}
#call-status { min-height: 1.4em; margin: 4px 0 8px; }

#jitsi-container { width: 100%; }
#jitsi-container iframe { display: block; border-radius: 12px; overflow: hidden; }

/* ---------- Управление звонком ---------- */
.controls {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

/* ---------- Чат ---------- */
.chat-box {
  height: 240px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
}
.chat-msg { margin-bottom: 10px; display: flex; flex-direction: column; }
.chat-msg.mine { align-items: flex-end; }
.chat-msg.theirs { align-items: flex-start; }
.chat-bubble {
  max-width: 80%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.95rem;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-msg.mine .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-meta { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }
.chat-form { display: flex; gap: 8px; }
.chat-form input {
  flex: 1;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
}
.chat-image { max-width: 180px; max-height: 220px; border-radius: 8px; display: block; }
.chat-attach { cursor: pointer; flex-shrink: 0; }

/* ---------- Доска (whiteboard) ---------- */
.board-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}
.board-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
  display: inline-block;
  flex-shrink: 0;
}
.board-wrap {
  position: relative;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.board-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: none;
}
#board-image { background: #fff; }
#board-draw {
  position: absolute;
  top: 0;
  left: 0;
  cursor: crosshair;
}

