/* ——— Навигация по страницам, плеер VK Видео, лента слайдов и управление группами ——— */

.app-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #DCE9FC;
  padding: 4px;
  border-radius: 10px;
}
.app-nav a,
.app-nav button {
  width: auto;
  margin: 0;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  color: #173B7B;
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.app-nav a:hover,
.app-nav button:hover {
  background: rgba(255, 255, 255, 0.65);
}
.app-nav a.is-active,
.app-nav button.is-active {
  background: #ffffff;
  color: #104FAE;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.1);
}

/* ——— Встроенная боковая колонка VK Видео на ПК и закреплённая панель сверху на телефоне ——— */
@media (min-width: 980px) {
  .page.has-vk-embedded {
    max-width: 1540px;
    display: grid;
    grid-template-columns: 356px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
  }
  .page.has-vk-embedded.has-vk-large {
    grid-template-columns: 470px minmax(0, 1fr);
  }
  .page.has-vk-embedded > .vk-stream-dock {
    position: sticky;
    top: 12px;
    grid-column: 1;
    width: 100%;
    max-width: none;
    margin-left: 10px;
  }
  .page.has-vk-embedded > .card:not(.hidden) {
    grid-column: 2;
    min-width: 0;
    margin-bottom: 0;
  }
}

@media (max-width: 979px) {
  .page.has-vk-embedded > .vk-stream-dock {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0 0 12px 12px;
    border-top: none;
    border-left: none;
    border-right: none;
    z-index: 35;
  }
  .vk-stream-dock:not(.is-floating) .vk-ctl-btn--desktop {
    display: none !important;
  }
}

/* Сам блок плеера VK Видео (единый DOM-элемент без пересоздания iframe) */
.vk-stream-dock {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.26);
  border: 1px solid rgba(148, 163, 184, 0.24);
  overflow: hidden;
  transition: width 0.18s ease, box-shadow 0.18s ease;
}

/* Плавающий перетаскиваемый режим (PiP внутри страницы) */
.vk-stream-dock.is-floating {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: min(350px, calc(100vw - 24px));
  z-index: 45;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.45);
}
.vk-stream-dock.is-floating.is-left {
  right: auto;
  left: 14px;
}
.vk-stream-dock.is-floating.is-large {
  width: min(540px, calc(100vw - 24px));
}
.vk-stream-dock.is-floating.is-minimized {
  width: auto;
  min-width: 220px;
  max-width: calc(100vw - 20px);
}
@media (max-width: 620px) {
  .vk-stream-dock.is-floating {
    right: 8px;
    bottom: 10px;
    width: min(224px, calc(100vw - 16px));
  }
  .vk-stream-dock.is-floating.is-left {
    left: 8px;
  }
  .vk-stream-dock.is-floating .vk-ctl-btn--desktop,
  .vk-stream-dock.is-floating:not(.is-minimized) .vk-stream-caption {
    display: none !important;
  }
}
.vk-stream-dock.is-floating .vk-stream-bar {
  cursor: grab;
  touch-action: none;
}
.vk-stream-dock.is-floating.is-dragging {
  transition: none;
}
.vk-stream-dock.is-floating.is-dragging .vk-stream-bar {
  cursor: grabbing;
}
.vk-stream-dock.is-dragging .vk-stream-body iframe {
  pointer-events: none;
}

.vk-stream-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  min-height: 38px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  user-select: none;
}
.vk-stream-dock.is-minimized .vk-stream-bar {
  border-bottom: none;
}
.vk-stream-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.vk-live-pill {
  width: auto !important;
  min-width: 0 !important;
  height: 26px !important;
  margin: 0 !important;
  padding: 0 9px !important;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  flex: 0 0 auto;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.42);
  color: #fecaca;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.vk-live-pill:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(248, 113, 113, 0.7);
  color: #ffffff;
}
.vk-live-pill.is-behind {
  background: rgba(14, 165, 233, 0.24);
  border-color: rgba(56, 189, 248, 0.6);
  color: #e0f2fe;
}
.vk-live-pill.is-behind:hover {
  background: rgba(14, 165, 233, 0.38);
  color: #ffffff;
}
.vk-live-pill.is-synced-flash {
  background: rgba(22, 163, 74, 0.32);
  border-color: rgba(74, 222, 128, 0.68);
  color: #dcfce7;
}
.vk-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.24);
  flex: 0 0 auto;
}
.vk-live-pill.is-behind .vk-live-dot {
  background: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25);
}
.vk-stream-caption {
  color: #cbd5e1;
  font-size: 0.77rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.vk-audio-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  white-space: nowrap;
  flex: 0 0 auto;
}
.vk-stream-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}
.vk-stream-actions .vk-ctl-btn {
  width: 28px !important;
  min-width: 28px !important;
  height: 26px !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.vk-stream-actions .vk-ctl-btn svg {
  display: block;
  flex-shrink: 0;
}
.vk-stream-actions .vk-ctl-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}
.vk-stream-actions .vk-ctl-btn.is-active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}
@media (max-width: 620px) {
  .vk-stream-bar {
    padding: 5px 8px;
    min-height: 36px;
  }
  .vk-stream-actions .vk-ctl-btn {
    width: 31px !important;
    min-width: 31px !important;
    height: 27px !important;
  }
}
.vk-stream-body {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
/* При сворачивании не используем display:none, чтобы звук трансляции не прерывался */
.vk-stream-dock.is-minimized .vk-stream-body {
  width: 1px;
  height: 0;
  aspect-ratio: auto;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.vk-stream-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Панель управления учителем (5 карточек на широком экране) */
@media (min-width: 1180px) {
  .teacher-controls {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (min-width: 760px) and (max-width: 1179px) {
  .teacher-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Наглядная лента миниатюр всех слайдов урока */
.teacher-slide-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 6px;
  margin-bottom: 6px;
  scrollbar-width: thin;
}
.teacher-slide-strip:empty {
  display: none;
}
.slide-thumb-btn {
  flex: 0 0 74px;
  width: 74px;
  margin: 0;
  padding: 4px;
  border-radius: 8px;
  background: #ffffff;
  color: #173B7B;
  border: 2px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  position: relative;
  text-align: center;
}
.slide-thumb-btn:hover {
  border-color: #93C5FD;
  background: #F8FAFC;
}
.slide-thumb-btn.is-preview {
  border-color: #F59E0B;
  background: #FFFBEB;
}
.slide-thumb-btn.is-live {
  border-color: #16A34A;
  background: #F0FDF4;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.16);
}
.slide-thumb-btn img {
  width: 100%;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
  background: #F1F5F9;
  display: block;
}
.slide-thumb-num {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slide-thumb-tag {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.69rem;
  font-weight: 800;
  background: #15803D;
  color: #ffffff;
}

/* Локальный предпросмотр слайда у учителя перед отправкой классу */
.teacher-preview-box {
  margin-top: 6px;
  padding: 8px 0 0;
  border-top: 1px solid #E2E8F0;
}
.teacher-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 0.78rem;
}
.preview-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #FEF3C7;
  color: #92400E;
}
.preview-badge.is-live {
  background: #DCFCE7;
  color: #15803D;
}
.teacher-preview-thumb {
  position: relative;
  width: 100%;
  height: 135px;
  padding: 6px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.teacher-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.preview-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 4px 0 6px;
}
.preview-nav-row button {
  width: auto;
  min-width: 36px;
  padding: 5px 10px;
  margin: 0;
  font-size: 0.82rem;
}

/* Мини-превью эфира VK Видео у самого учителя (autoplay=0, без эха) */
.teacher-stream-preview {
  margin-top: 8px;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  background: #0f172a;
  overflow: hidden;
}
.teacher-stream-preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.teacher-stream-preview-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.teacher-stream-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 8px;
  background: #F8FAFC;
  font-size: 0.76rem;
}
.teacher-stream-links a {
  color: #0369A1;
  font-weight: 700;
  text-decoration: none;
}
.teacher-stream-links a:hover {
  text-decoration: underline;
}

/* Индикатор эфира в пульте учителя и параллельных уроков */
.stream-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #F1F5F9;
  color: #475569;
  vertical-align: middle;
  margin-left: 6px;
}
.stream-pill.is-live {
  background: #FEE2E2;
  color: #B91C1C;
}
.parallel-lessons-bar {
  background: #EEF4FF;
  border: 1px solid #C5D8F7;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: #173B7B;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* Выбор урока учеником при нескольких параллельных уроках */
.student-lesson-picker {
  background: #ffffff;
  border: 1.5px solid #93C5FD;
  border-radius: 16px;
  padding: 20px;
  max-width: 680px;
  margin: 16px auto;
  box-shadow: var(--shadow-md);
}
.student-lesson-picker h3 {
  margin: 0 0 8px;
  color: #173B7B;
}
.lesson-picker-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.lesson-pick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 12px 16px;
  border-radius: 12px;
  background: #F0F7FF;
  color: #173B7B;
  border: 1px solid #BAE6FD;
}
.lesson-pick-btn:hover {
  background: #E0F2FE;
  border-color: #0284c7;
}

/* Модальное окно управления привязкой учеников и преподавателями */
.group-dlg {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  max-width: 820px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25);
}
.group-dlg-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 8px;
}
.group-dlg-tabs button {
  width: auto;
  margin: 0;
  padding: 7px 14px;
  font-size: 0.88rem;
}
.group-dlg-body {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.group-student-list {
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  max-height: 330px;
  overflow-y: auto;
  margin-top: 8px;
}
.group-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.86rem;
}
.group-student-row:last-child {
  border-bottom: none;
}
.group-student-row button {
  width: auto;
  min-width: 104px;
  margin: 0;
  padding: 5px 10px;
  font-size: 0.8rem;
}
.auth-lesson-box {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #F0F7FF;
  border: 1px solid #C5D8F7;
}
.auth-lesson-box select {
  margin: 4px 0 0;
}
