/* ===== 在线教育直播系统 全局样式 ===== */
:root {
  --bg: #0f1220;
  --bg-soft: #171a2b;
  --panel: #1d2136;
  --panel-2: #252a45;
  --border: #2c3150;
  --text: #e8eaf6;
  --text-2: #9aa1c0;
  --primary: #4f7cff;
  --primary-2: #6b93ff;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary-2); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; font-size: 14px; font-weight: 500;
  background: var(--panel-2); color: var(--text); transition: all .15s;
  border: 1px solid var(--border);
}
.btn:hover { background: #2e3460; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.4); color: #fca5a5; }
.btn-danger:hover { background: rgba(239,68,68,.3); }
.btn-success { background: rgba(34,197,94,.15); border-color: rgba(34,197,94,.4); color: #86efac; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }

.input {
  padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-soft); color: var(--text); font-size: 14px; outline: none; width: 100%;
}
.input:focus { border-color: var(--primary); }

.chip {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px;
  background: rgba(79,124,255,.15); color: var(--primary-2);
}
.chip-danger { background: rgba(239,68,68,.15); color: #fca5a5; }
.chip-success { background: rgba(34,197,94,.15); color: #86efac; }
.chip-warn { background: rgba(245,158,11,.15); color: #fcd34d; }

/* ---------- 顶部栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--bg-soft);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50;
}
.topbar .brand { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.topbar .brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.topbar .room-info { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-2); }
.topbar .room-info b { color: var(--text); font-weight: 600; }

/* ---------- 主布局 ---------- */
.main-grid {
  display: grid; grid-template-columns: 1fr 340px; gap: 14px;
  padding: 14px; height: calc(100vh - 53px);
}
.main-grid.narrow { grid-template-columns: 1fr; }
.col-left { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.col-right { display: flex; flex-direction: column; gap: 14px; min-height: 0; }

/* ---------- 视频区 ---------- */
.video-area {
  position: relative; background: #000; border-radius: var(--radius);
  overflow: hidden; flex: 1; min-height: 0;
}
.video-area .stage {
  position: absolute; inset: 0; display: flex; flex-wrap: wrap; gap: 4px;
  align-content: center; justify-content: center; padding: 8px;
}
.video-cell {
  position: relative; background: #0a0c16; border-radius: 10px; overflow: hidden;
}
.video-cell video { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-cell .tag {
  position: absolute; left: 8px; top: 8px; z-index: 2;
  padding: 2px 10px; border-radius: 14px; font-size: 12px;
  background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px);
}
.video-cell .tag.host-tag { background: rgba(79,124,255,.85); }
.video-cell .mute-mark {
  position: absolute; right: 8px; top: 8px; z-index: 2; font-size: 14px;
  background: rgba(0,0,0,.55); border-radius: 50%; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; display: none;
}
.stage.one .video-cell { width: 100%; height: 100%; }
.stage.two .video-cell { width: 50%; height: 100%; }
.stage.many .video-cell { width: calc(50% - 2px); height: calc(50% - 2px); }

.empty-stage {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; color: var(--text-2);
}
.empty-stage .icon { font-size: 44px; opacity: .6; }

/* ---------- 课件区 ---------- */
.course-area {
  background: var(--panel); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; min-height: 180px; max-height: 45%;
}
.course-area .course-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.course-body { flex: 1; overflow: auto; position: relative; background: #0a0c16; }
.course-body .placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-size: 13px;
}
.course-body img { width: 100%; display: block; }
.course-body iframe { width: 100%; height: 100%; border: none; }
.course-page-nav {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 6px; background: rgba(0,0,0,.5);
}

/* ---------- 控制栏 ---------- */
.ctrl-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border-radius: var(--radius); padding: 10px 14px;
}
.ctrl-bar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* ---------- 侧边面板 ---------- */
.panel {
  background: var(--panel); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600;
}
.panel-head .count { color: var(--text-2); font-weight: 400; font-size: 13px; }
.panel-body { flex: 1; overflow-y: auto; padding: 10px 14px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); }
.tabs .tab {
  flex: 1; text-align: center; padding: 10px 0; font-size: 14px; color: var(--text-2);
  border-bottom: 2px solid transparent; transition: all .15s;
}
.tabs .tab.active { color: var(--primary-2); border-bottom-color: var(--primary); }

/* ---------- 评论区 ---------- */
.chat-list { display: flex; flex-direction: column; gap: 8px; }
.chat-item { font-size: 13px; line-height: 1.5; }
.chat-item .nick { font-weight: 600; margin-right: 6px; }
.chat-item .nick.role-host { color: var(--warn); }
.chat-item .nick.role-guest { color: var(--success); }
.chat-item .content { color: var(--text); word-break: break-word; }
.chat-item .time { color: var(--text-2); font-size: 11px; margin-left: 6px; }
.sys-item { color: var(--text-2); font-size: 12px; text-align: center; margin: 4px 0; }
.like-anim {
  display: inline-block; color: #f472b6; margin-left: 4px; animation: pop .4s ease;
}
@keyframes pop { 0% { transform: scale(.5); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }

.chat-input-row { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); }

/* ---------- 连麦申请卡片 ---------- */
.apply-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: var(--panel-2); border-radius: 8px; margin-bottom: 8px;
}
.apply-card .name { font-size: 13px; font-weight: 500; }
.apply-card .btns { display: flex; gap: 6px; }

.guest-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: var(--panel-2); border-radius: 8px; margin-bottom: 8px;
}

/* ---------- 课件管理 ---------- */
.cw-list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; background: var(--panel-2); border-radius: 8px; margin-bottom: 8px;
  font-size: 13px;
}
.cw-list-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 首页 ---------- */
.landing {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1000px 500px at 50% -10%, #1b2350 0%, var(--bg) 60%);
}
.landing-card {
  width: 420px; max-width: 92vw; background: var(--panel); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px;
}
.landing-card .logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.landing-card .logo-row .logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.landing-card h1 { font-size: 20px; margin-bottom: 4px; }
.landing-card .sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

/* ---------- 加载遮罩 ---------- */
.loading-mask {
  position: fixed; inset: 0; background: rgba(15,18,32,.92); z-index: 999;
  display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
}
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--primary);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 1000;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 20px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.4);
  opacity: 0; transition: opacity .25s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .main-grid { grid-template-columns: 1fr; height: auto; }
  .col-right { order: -1; max-height: 40vh; }
  .video-area { min-height: 42vh; }
}

/* ---------- 登录条 / 管理后台 ---------- */
.auth-bar {
  position: fixed; top: 14px; right: 20px; z-index: 100;
  display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-2);
}
.auth-link { color: var(--primary-2); cursor: pointer; }
.landing { padding-top: 44px; }

.admin-wrap { max-width: 1080px; margin: 20px auto; padding: 0 16px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab-btn {
  padding: 8px 18px; border-radius: 8px; background: var(--panel);
  border: 1px solid var(--border); color: var(--text-2); font-size: 14px; transition: all .15s;
}
.tab-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.panel-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel-card h3 { font-size: 15px; margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h3 { margin: 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th, .admin-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-2); font-weight: 500; font-size: 12px; }
.admin-table .ops { display: flex; gap: 6px; flex-wrap: wrap; }
.hint { margin-top: 10px; font-size: 12px; color: var(--text-2); line-height: 1.7; }
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box { width: 380px; max-width: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.modal-box h3 { font-size: 16px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.chip-admin { background: rgba(139,92,246,.15); color: #c4b5fd; }
.chip-ok { background: rgba(34,197,94,.15); color: #86efac; }

/* ---------- 美颜面板 ---------- */
.beauty-panel {
  position: absolute; right: 12px; top: 12px; z-index: 10; width: 230px;
  background: rgba(29,33,54,.96); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(0,0,0,.45);
}
.beauty-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.beauty-row { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.beauty-row label { width: 34px; }
.beauty-row input[type=range] { flex: 1; accent-color: var(--primary); }

/* ---------- 移动端增强 ---------- */
@media (max-width: 768px) {
  .topbar { padding: 8px 10px; }
  .topbar .brand { font-size: 14px; }
  .topbar .brand .logo { width: 26px; height: 26px; font-size: 13px; }
  .topbar .room-info { gap: 6px; font-size: 12px; flex-wrap: wrap; }
  .main-grid { padding: 10px; gap: 10px; height: auto; }
  .col-right { order: -1; max-height: 45vh; }
  .video-area { min-height: 40vh; }
  .ctrl-bar { padding: 8px; gap: 8px; }
  .ctrl-bar .btn { padding: 9px 12px; font-size: 13px; }
  .course-area { min-height: 140px; max-height: 50vh; }
  .chat-input-row { padding: 8px 10px; }
  .chat-input-row .input { font-size: 16px; }
  .beauty-panel { width: calc(100% - 24px); left: 12px; right: 12px; }
  .auth-bar { top: 8px; right: 10px; }
  .panel-card { overflow-x: auto; }
  .admin-table { min-width: 620px; }
}
