/* Админка сессий — единая тема с панелью преподавателя (teacher.css):
   плоский тёмный интерфейс, синий акцент, без стеклянных градиентов */
:root {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #242424;
    --bg-hover: #2d2d2d;
    --border: #333;
    --text: #fff;
    --text-secondary: #aaa;
    --text-muted: #666;
    --primary: #2d8cff;
    --primary-hover: #1a7ae8;
    --danger: #e53935;
    --danger-hover: #c62828;
    --success: #4caf50;
    --warning: #ff9800;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text);
}

/* Тосты ui.js на этой странице — в правый нижний угол (сверху они
   перекрывали шапку); на teacher/watch остаются сверху по центру */
.eui-toasts {
    top: auto !important;
    bottom: 16px !important;
    left: auto !important;
    right: 16px !important;
    transform: none !important;
    align-items: flex-end !important;
}

/* ============ Шапка ============ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-size: 1.05rem;
}

.logo b { color: var(--primary); font-weight: 700; }

.logo-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg { width: 20px; height: 20px; color: #fff; }

.header-right { display: flex; align-items: center; gap: 10px; }

/* Уведомления */
.notification-wrapper { position: relative; }

.notification-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.notification-btn:hover { background: var(--bg-hover); color: var(--text); }

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    display: none;
    overflow: hidden;
}

.notification-dropdown.show { display: block; }

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notification-header h4 { font-size: 0.95rem; }

.notification-mark-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
}

.notification-list { max-height: 380px; overflow-y: auto; }

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.notification-item:hover { background: var(--bg-hover); }
.notification-item:last-child { border-bottom: none; }
.notification-item.unread { border-left: 3px solid var(--primary); background: rgba(45, 140, 255, 0.06); }
.notification-item .n-title { font-size: 0.88rem; font-weight: 600; margin-bottom: 3px; }
.notification-item .n-text { font-size: 0.82rem; color: var(--text-secondary); }
.notification-item .n-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.notification-empty { padding: 28px; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* Профиль */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-tertiary);
    transition: background 0.15s;
}

.user-menu:hover { background: var(--bg-hover); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 0.85rem; font-weight: 600; }
.user-role { font-size: 0.72rem; color: var(--text-muted); }

/* ============ Контент ============ */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}

/* Сводка */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-tile {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
}

.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex: none;
}

.live-dot.on {
    background: var(--danger);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Действия */
.action-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.action-card:hover { background: var(--bg-hover); border-color: #444; }

.action-card.primary { border-color: var(--primary); }
.action-card.primary:hover { background: rgba(45, 140, 255, 0.1); }

.action-icon {
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 11px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-icon svg { width: 22px; height: 22px; }
.action-icon.blue { background: var(--bg-tertiary); color: var(--primary); border: 1px solid var(--border); }

.action-title { font-size: 0.98rem; font-weight: 600; }
.action-desc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }

/* Секции */
.section { margin-bottom: 28px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title { font-size: 1.05rem; font-weight: 600; }

.section-action {
    font-size: 0.85rem;
    color: var(--primary);
    cursor: pointer;
}

.section-action:hover { text-decoration: underline; }

/* Карточки сессий (активные/запланированные) */
.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.session-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.session-card.live { border-color: rgba(229, 57, 53, 0.55); }

.session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.session-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.session-status.playing { background: rgba(229, 57, 53, 0.15); color: #ff6b68; }
.session-status.paused { background: rgba(255, 152, 0, 0.15); color: var(--warning); }
.session-status.waiting { background: rgba(45, 140, 255, 0.15); color: var(--primary); }
.session-status.pending { background: var(--bg-tertiary); color: var(--text-secondary); }
.session-status.ended { background: var(--bg-tertiary); color: var(--text-muted); }

.session-menu {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.session-menu:hover { color: var(--danger); background: rgba(229, 57, 53, 0.12); }

.session-title {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.session-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; }

.session-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.session-meta-item svg { width: 15px; height: 15px; flex: none; }

.session-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.session-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.session-stats .stat-item.online { color: var(--success); font-weight: 600; }
.session-stats .stat-item svg { width: 16px; height: 16px; }

.session-actions { display: flex; gap: 8px; }

/* Завершённые — компактный список */
.ended-list {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.ended-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.ended-row:last-child { border-bottom: none; }

.ended-info { flex: 1; min-width: 0; }

.ended-title {
    font-size: 0.92rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ended-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.ended-actions { display: flex; gap: 8px; flex: none; }

.btn-more {
    margin-top: 12px;
    width: 100%;
}

/* Пустые состояния — компактные, не простыня */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-muted);
}

.empty-state svg { width: 22px; height: 22px; flex: none; }
.empty-state h3 { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); display: inline; }
.empty-state p { font-size: 0.85rem; display: inline; }

/* Загрузка */
.loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 28px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Кнопки ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.btn-sm { padding: 7px 12px; font-size: 0.82rem; border-radius: 8px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #43a047; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover { background: var(--bg-hover); color: var(--text); }

/* ============ Модалки ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.active { display: flex; }

.modal {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1.05rem; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
}

.modal-close:hover { color: var(--text); background: var(--bg-hover); }

.modal-body { padding: 20px; overflow-y: auto; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* Формы */
.form-group { margin-bottom: 16px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus { border-color: var(--primary); }
.form-input::placeholder { color: var(--text-muted); }

.form-group-divider {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 16px;
}

/* Дата/время в тёмной теме */
.form-input[type="date"], .form-input[type="time"] { color-scheme: dark; }

/* Выбор видео */
.playlist-selector { margin-top: 4px; }

.playlist-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.playlist-count { color: var(--primary); font-weight: 600; }

.video-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.video-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color 0.15s, background 0.15s;
}

.video-option:hover { background: var(--bg-hover); }

.video-option.selected {
    border-color: var(--primary);
    background: rgba(45, 140, 255, 0.12);
}

.video-option-checkbox {
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-option-checkbox svg { width: 12px; height: 12px; color: #fff; display: none; }

.video-option.selected .video-option-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.video-option.selected .video-option-checkbox svg { display: block; }

.video-option-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-option-order {
    flex: none;
    min-width: 18px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
}

/* Инфо о созданной сессии */
.meeting-info-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
    overflow: hidden;
}

.meeting-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.meeting-info-row:last-child { border-bottom: none; }

.meeting-info-label { font-size: 0.82rem; color: var(--text-secondary); flex: none; }

.meeting-info-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    min-width: 0;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    flex: none;
}

.copy-btn:hover { background: var(--bg-hover); }

/* Статистика сессии */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.stats-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.stats-number { font-size: 1.5rem; font-weight: 700; }
.stats-number.primary { color: var(--primary); }
.stats-number.success { color: var(--success); }
.stats-number.warning { color: var(--warning); }

.stats-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

.stats-table-wrap {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow-x: auto;
}

.stats-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

.stats-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.stats-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.stats-table tr:last-child td { border-bottom: none; }

.suspicious-alert {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.4);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.suspicious-alert-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--warning);
    margin-bottom: 6px;
}

/* ============ Мобильная адаптация ============ */
@media (max-width: 640px) {
    .header-content { padding: 0 14px; }
    .user-info { display: none; }
    .main-content { padding: 16px 14px 40px; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .stat-value { font-size: 1.4rem; }
    .form-row { grid-template-columns: 1fr; }
    .session-actions .btn-sm { padding: 7px 10px; }
    .ended-row { flex-wrap: wrap; }
    .ended-actions { width: 100%; justify-content: flex-end; }
}
