/* ══════════════════════════════════════════════════════════
   学生座位登记系统  ·  主样式表  v4.0
   教室：1003 · 1005 · 科技楼405
   特性：座位表由 JS 动态渲染，CSS 适配任意行列
   v3.0 新增：时段选择器样式、实时在线指示器
   v3.1 新增：角色权限显示控制、学生选座确认弹窗
   v3.2 新增：科技楼405教室专属样式（8列窄格适配）
   v4.0 改动：移除学生班级选择器相关样式（#studentControls 已删除）
   ══════════════════════════════════════════════════════════ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    padding: 30px;
    position: relative;
}

/* ── 隐藏辅助类 ──────────────────────────────────────────── */
.隐藏 {
    visibility: hidden;
    border-width: 0;
}

/* ══════════════════════════════════════════════════════════
   顶部工具栏
   ══════════════════════════════════════════════════════════ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: #fff;
    padding: 10px 20px;
    border-radius: 12px 12px 0 0;
    margin: -30px -30px 20px;
    gap: 10px;
    flex-wrap: wrap;
}
.top-bar .sys-title {
    font-size: 1.1rem;
    font-weight: bold;
    white-space: nowrap;
}
.top-bar .bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.user-info {
    font-size: .85rem;
    opacity: .9;
}
.btn-logout {
    background: rgba(255,255,255,.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,.4);
    padding: 6px 14px;
    border-radius: 7px;
    font-size: .85rem;
    cursor: pointer;
    transition: background .2s;
    margin: 0;
    box-shadow: none;
}
.btn-logout:hover { background: rgba(255,255,255,.35); transform: none; }

/* ── 在线人数指示器（socket.io） ─────────────────────────── */
.online-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .82rem;
    opacity: .9;
}
.online-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #55efc4;
    box-shadow: 0 0 6px #55efc4;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ══════════════════════════════════════════════════════════
   教室选择器
   ══════════════════════════════════════════════════════════ */
.room-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.room-selector label {
    font-size: .9rem;
    color: #555;
    white-space: nowrap;
}
.room-btn {
    padding: 8px 18px;
    border-radius: 8px;
    border: 2px solid #dce3f0;
    background: #fff;
    color: #555;
    font-size: .9rem;
    cursor: pointer;
    transition: all .2s;
    margin: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.room-btn:hover { border-color: #74b9ff; color: #0984e3; transform: none; box-shadow: 0 3px 8px rgba(9,132,227,.2); }
.room-btn.active {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    border-color: #0984e3;
    color: #fff;
    box-shadow: 0 4px 12px rgba(9,132,227,.4);
}

/* ══════════════════════════════════════════════════════════
   时段选择器  v3.0 新增
   ══════════════════════════════════════════════════════════ */
.session-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    border: 1px solid #dee2e6;
}
.session-bar label {
    font-size: .88rem;
    color: #555;
    white-space: nowrap;
    font-weight: bold;
}
.session-date-input {
    padding: 7px 12px;
    border: 1.5px solid #b6c2cf;
    border-radius: 8px;
    font-size: .9rem;
    color: #2c3e50;
    background: #fff;
    cursor: pointer;
    outline: none;
    transition: border-color .2s;
}
.session-date-input:focus { border-color: #0984e3; }

.period-btns {
    display: flex;
    gap: 6px;
}
.period-btn {
    padding: 7px 16px;
    border-radius: 7px;
    border: 1.5px solid #b6c2cf;
    background: #fff;
    color: #555;
    font-size: .88rem;
    cursor: pointer;
    transition: all .2s;
    margin: 0;
    box-shadow: none;
}
.period-btn:hover { border-color: #74b9ff; color: #0984e3; transform: none; }
.period-btn.active {
    background: linear-gradient(135deg, #fdcb6e, #e17055);
    border-color: #e17055;
    color: #fff;
    box-shadow: 0 3px 8px rgba(225,112,85,.4);
    font-weight: bold;
}

.session-info {
    font-size: .82rem;
    color: #6c757d;
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════
   动态座位表
   ══════════════════════════════════════════════════════════ */
#seatArea {
    overflow-x: auto;
    margin-bottom: 24px;
}

.classroom-table {
    border-collapse: collapse;
    margin: 0 auto 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.classroom-table caption {
    background: palegreen;
    padding: 0.5rem 1rem;
    margin-bottom: 1.2rem;
    font-size: 1.3rem;
    border-radius: 0.5rem;
    caption-side: top;
    color: #333;
    font-weight: bold;
}

/* 表头行（列号） */
.classroom-table .col-header {
    background: #e8f4fd;
    font-size: 11px;
    color: #666;
    height: 22px;
}

/* 座位单元格（由 JS 动态创建） */
.classroom-table td.seat-cell {
    width: 68px;
    height: 46px;
    border: 2px solid #b0c4de;
    text-align: center;
    vertical-align: middle;
    font-size: 18px;
    transition: all 0.3s ease;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
}
.classroom-table td.seat-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
}
.classroom-table td.seat-cell.dragover {
    background: #e8f4f8;
    border-color: #3498db;
    border-style: solid;
}
.classroom-table td.seat-cell.occupied {
    color: white;
    border: 2px solid #0984e3;
    border-style: solid;
    font-weight: bold;
}

/* 过道单元格（布局数组中值为 0） */
.classroom-table td.aisle-cell {
    background: #fef6ea !important;
    border: none !important;
    visibility: hidden;
    width: 68px;
    height: 46px;
}

/* 座位号（空闲时显示灰色小字） */
.seat-number {
    font-size: 11px;
    color: #bbb;
    position: absolute;
    bottom: 1px;
    right: 3px;
    pointer-events: none;
}

/* 座位上的学生姓名 */
.seat-name {
    font-size: 15px;
    font-weight: bold;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   排名角标
   ══════════════════════════════════════════════════════════ */
.rank-display {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 10;
}
.rank-gold    { background: linear-gradient(135deg, #ffd700, #ffed4e); color: #333; }
.rank-silver  { background: linear-gradient(135deg, #c0c0c0, #e8e8e8); color: #333; }
.rank-bronze  { background: linear-gradient(135deg, #cd7f32, #daa520); color: #fff; }
.rank-number  { background: rgba(0,123,255,0.8); color: #fff; }
.rank-encourage { background: rgba(40,167,69,0.8); color: #fff; font-size: 10px; }

/* ══════════════════════════════════════════════════════════
   学生列表
   ══════════════════════════════════════════════════════════ */
.student-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 30px;
    min-height: 80px;
}
.student {
    color: #333;
    background: white;
    padding: 7px 5px;
    border-radius: 8px;
    text-align: center;
    cursor: grab;
    font-weight: bold;
    transition: all 0.3s ease;
    user-select: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    touch-action: manipulation;
}
.student:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
.student:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* ══════════════════════════════════════════════════════════
   控制区
   ══════════════════════════════════════════════════════════ */
.controls {
    text-align: center;
    margin: 20px 0;
}
button {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    touch-action: manipulation;
}
button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}
button:active {
    transform: scale(0.95);
}

/* 班级下拉 */
.class-select {
    margin: 0 10px;
    padding: 12px 42px 12px 16px;
    border-radius: 10px;
    border: 1px solid #b6c2cf;
    font-size: 18px;
    background-color: #ffffff;
    color: #2c3e50;
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%230984e3' d='M6 8L0 0h12z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: all .2s ease;
    font-weight: bold;
}
.class-select:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}
.class-select:focus {
    outline: none;
    border-color: #0984e3;
    box-shadow: 0 0 0 3px rgba(9,132,227,0.15);
}

/* 计数器 */
.counter {
    text-align: center;
    margin-top: 20px;
    font-size: 1.2rem;
    color: #7f8c8d;
}

/* ══════════════════════════════════════════════════════════
   实时消息提示（socket.io 广播消息）
   ══════════════════════════════════════════════════════════ */
.live-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}
.live-toast {
    background: linear-gradient(135deg, #2d3436, #636e72);
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: .88rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.3);
    animation: slideInRight .3s ease, fadeOut 3.5s ease 1s forwards;
    border-left: 4px solid #74b9ff;
    max-width: 280px;
}
.live-toast.admin-action {
    border-left-color: #fdcb6e;
}
@keyframes slideInRight {
    from { transform: translateX(60px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ══════════════════════════════════════════════════════════
   排名侧栏
   ══════════════════════════════════════════════════════════ */
.rank-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.rank-panel {
    position: fixed;
    top: 0; left: 0;
    width: 280px;
    height: 100vh;
    background: #ffffff;
    box-shadow: 8px 0 24px rgba(0,0,0,0.12);
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1200;
    display: flex;
    flex-direction: column;
}
.rank-panel.show { transform: translateX(0); }
.rank-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #eaecef;
}
.rank-panel-body {
    flex: 1;
    overflow: auto;
    padding: 10px 14px;
}
.rank-list {
    list-style: none;
    margin: 0; padding: 0;
}
.rank-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px dashed #eaecef;
}
.rank-medal {
    width: 28px;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════
   游戏弹窗 / 遮罩
   ══════════════════════════════════════════════════════════ */
.global-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1000;
}
.global-mask.show {
    opacity: 1;
    pointer-events: auto;
}
.game-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 1001;
}
.game-modal.show {
    opacity: 1;
    pointer-events: auto;
}
.game-box {
    width: min(720px, 92vw);
    height: min(480px, 82vh);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: #fff;
}
.game-title { font-size: 18px; font-weight: bold; }
.modal-close {
    background: #ffffff;
    color: #0984e3;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}
.game-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}
.modal-avatar {
    width: 135px; height: 135px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 60px;
    font-weight: bold;
}
.modal-bubble {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 18px 24px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    font-size: 24px;
    color: #2c3e50;
}
.modal-time   { font-size: 21px; color: #7f8c8d; }
.modal-phrase { font-size: 27px; color: #2c3e50; text-align: center; }
.modal-rank   { font-size: 27px; color: #2c3e50; font-weight: bold; }
.game-actions {
    display: flex;
    justify-content: center;
    padding: 12px 16px;
}

/* ══════════════════════════════════════════════════════════
   响应式
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .student-list {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    .classroom-table td.seat-cell,
    .classroom-table td.aisle-cell {
        width: 50px;
        height: 40px;
        font-size: 12px;
    }
    /* 科技楼405移动端：10列进一步缩小 */
    .room-kj405 td.seat-cell {
        width: 36px !important;
        height: 32px !important;
        font-size: 10px !important;
        border-width: 1px !important;
    }
    .room-kj405 td.aisle-cell {
        width: 12px !important;
        height: 32px !important;
    }
    .room-kj405 .seat-name { font-size: 9px !important; }
    .room-kj405 .seat-number { font-size: 7px !important; }
    .room-kj405 .rank-display { font-size: 6px !important; padding: 1px 2px !important; }
    .container { padding: 15px; }
    .rank-display { font-size: 10px; padding: 1px 4px; }
    .session-bar { gap: 8px; }
    .period-btn { padding: 6px 10px; font-size: .82rem; }
}
/* 触摸设备去除 hover 效果 */
@media (hover: none) and (pointer: coarse) {
    .student:hover,
    .classroom-table td.seat-cell:hover,
    button:hover {
        transform: none;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
}

/* ══════════════════════════════════════════════════════════
   角色权限显示控制（v3.1）
   由 JS 在初始化时根据角色添加 body 上的 role-admin / role-student
   ══════════════════════════════════════════════════════════ */

/* 默认隐藏角色专属区块 */
.admin-only { display: none !important; }
.student-only { display: none !important; }

/* 管理员/教师：显示 admin-only，隐藏 student-only */
body.role-admin .admin-only { display: flex !important; }
body.role-admin .student-only { display: none !important; }

/* 学生：显示 student-only，隐藏 admin-only */
body.role-student .student-only { display: flex !important; }
body.role-student .admin-only { display: none !important; }

/* 学生视角：座位 hover 样式更突出 */
body.role-student .classroom-table td.seat-cell:not(.occupied):hover {
    background: #e8f4f8;
    border-color: #0984e3;
    transform: scale(1.08);
    box-shadow: 0 5px 15px rgba(9,132,227,.35);
}
/* 学生视角：已占座位禁止点击样式 */
body.role-student .classroom-table td.seat-cell.occupied {
    cursor: not-allowed;
}
/* 学生视角：空座位显示"可选"样式 */
body.role-student .classroom-table td.seat-cell:not(.occupied)::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   学生选座确认弹窗（v3.1 新增）
   ══════════════════════════════════════════════════════════ */
.seat-confirm-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    z-index: 2100;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}
.seat-confirm-modal.show {
    opacity: 1;
    pointer-events: auto;
}
.seat-confirm-box {
    width: min(360px, 90vw);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    overflow: hidden;
    transform: translateY(20px) scale(.96);
    transition: transform .22s ease;
}
.seat-confirm-modal.show .seat-confirm-box {
    transform: translateY(0) scale(1);
}
.seat-confirm-header {
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    color: #fff;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: bold;
}
.seat-confirm-body {
    padding: 28px 24px 20px;
    text-align: center;
}
.seat-confirm-icon {
    font-size: 3rem;
    margin-bottom: 14px;
}
.seat-confirm-text {
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 10px;
}
.seat-confirm-text strong {
    color: #0984e3;
    font-size: 1.4rem;
}
.seat-confirm-info {
    font-size: .85rem;
    color: #7f8c8d;
    line-height: 1.6;
}
.seat-confirm-actions {
    display: flex;
    gap: 12px;
    padding: 0 20px 20px;
}
.btn-confirm-cancel {
    flex: 1;
    padding: 12px 0;
    border-radius: 10px;
    border: 1.5px solid #dce3f0;
    background: #f8f9fa;
    color: #636e72;
    font-size: 1rem;
    cursor: pointer;
    transition: all .2s;
    box-shadow: none;
    margin: 0;
}
.btn-confirm-cancel:hover {
    background: #e9ecef;
    transform: none;
}
.btn-confirm-ok {
    flex: 1;
    padding: 12px 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #55efc4, #00b894);
    color: #fff;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,184,148,.4);
    transition: all .2s;
    margin: 0;
}
.btn-confirm-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,184,148,.5);
}
.btn-confirm-ok:active { transform: scale(.97); }

/* ══════════════════════════════════════════════════════════
   教室专属样式（v3.2）
   根据教室布局特点，为不同教室定制座位单元格尺寸
   ══════════════════════════════════════════════════════════ */

/* ── 科技楼405：9行×10列（72座，过道在第5列） ─────────
   列数多(10列)，需要进一步缩小单元格确保一行完整显示
   容器max-width 1200px，内padding 30px×2=60px → 可用约1140px
   10格 × 48px = 480px + 边框 ≈ 520px，完全在可视范围内 */
.room-kj405 td.seat-cell {
    width: 46px !important;
    height: 38px !important;
    font-size: 12px !important;
    border-width: 1.5px !important;
}
.room-kj405 td.aisle-cell {
    width: 18px !important;   /* 过道收窄 */
    height: 38px !important;
}
/* 科技楼405：座位号字体缩小 */
.room-kj405 .seat-number {
    font-size: 8px !important;
}
/* 科技楼405：学生姓名字号适配 */
.room-kj405 .seat-name {
    font-size: 11px !important;
}
/* 科技楼405：排名角标缩小避免遮挡 */
.room-kj405 .rank-display {
    font-size: 8px !important;
    padding: 1px 3px !important;
    top: -2px !important;
    right: -2px !important;
}
/* 科技楼405：hover缩放幅度减小防止溢出 */
.room-kj405 td.seat-cell:hover {
    transform: scale(1.02) !important;
}
/* 科技楼405：表格caption样式微调 */
.room-kj405 caption {
    font-size: 1.1rem !important;
}

/* ── 1005教室：与1003相同布局，保持默认68px ─────────── */
.room-1005 {
    /* 继承默认样式，无需额外调整 */
}

/* ── 1003教室：标准布局，保持默认68px ─────────────────── */
.room-1003 {
    /* 继承默认样式，无需额外调整 */
}

/* 从 index.html 提取的样式 */
/* 将全局鼠标样式设置为一棵树 (放大3倍并向左旋转45度) */
        /* body, * {
            cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128' style='font-size:72px'><text x='64' y='100' text-anchor='middle' transform='rotate(-45 64 64)'>🌳</text></svg>"), auto !important;
        } */

/* ════════════════════════════════════════════════════════
   教室标签（参考 classroom-seat-demo.html）
   ════════════════════════════════════════════════════════ */
.classroom-tabs-container {
    margin-bottom: 16px;
}

.classroom-tabs {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 3px;
    border-radius: 8px;
}

.classroom-tabs button {
    padding: 7px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.15s;
    white-space: nowrap;
}

.classroom-tabs button:hover { color: #1f2937; background: white; }
.classroom-tabs button.active {
    background: white;
    color: #2563eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════
   主体布局（左侧教室 + 右侧信息面板）
   ════════════════════════════════════════════════════════ */
.main-layout {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    min-height: calc(100vh - 300px);
}

/* ════════════════════════════════════════════════════════
   教室面板（左侧主区域）
   ════════════════════════════════════════════════════════ */
.classroom-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.classroom-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
}

/* 教室三层次结构 */
.classroom-container {
    position: absolute;
    inset: 12px;
    background: #fafbfc;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
}

/* 层1：布局层（讲台、过道、柱子等非座位元素） */
.layout-layer {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;  /* 布局元素不响应点击 */
}

/* 层2：座位层 */
.seats-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
}

/* 层3：交互层（hover提示、框选等） */
.interaction-layer {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   布局元素样式
   ══════════════════════════════════════════════════════ */
.layout-element {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
}

/* 讲台 */
.layout-element.platform {
    background: linear-gradient(135deg, #374151, #4b5563);
    color: white;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 过道 */
.layout-element.aisle {
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(0,0,0,0.03) 3px,
        rgba(0,0,0,0.03) 6px
    );
    border: 1px dashed #d1d5db;
    color: #9ca3af;
    font-size: 10px;
}

/* 柱子/障碍物 */
.layout-element.obstacle {
    background: #78716c;
    color: white;
    border-radius: 4px;
    font-size: 10px;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.2);
}

/* 门 */
.layout-element.door {
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 3px;
    color: #6b7280;
    font-size: 10px;
}

/* ══════════════════════════════════════════════════════
   座位样式（三层结构用）
   ══════════════════════════════════════════════════════ */
.seat {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.18s ease;
    user-select: none;
    z-index: 1;
}

/* 空闲座位 */
.seat.available {
    background: #ffffff;
    border-color: #d1d5db;
    color: #4b5563;
}
.seat.available:hover {
    background: #dbeafe;
    border-color: #2563eb;
    color: #2563eb;
    transform: scale(1.12);
    z-index: 10;
    box-shadow: 0 2px 12px rgba(37,99,235,0.25);
}

/* 已选座位 */
.seat.assigned {
    background: #dcfce7;
    border-color: #16a34a;
    color: #16a34a;
}
.seat.assigned:hover {
    transform: scale(1.12);
    z-index: 10;
    box-shadow: 0 2px 12px rgba(22,163,74,0.25);
}

/* 故障座位 */
.seat.broken {
    background: #fee2e2;
    border-color: #dc2626;
    color: #dc2626;
    cursor: not-allowed;
    opacity: 0.7;
}

/* 临时标记（演示点击时短暂高亮） */
.seat.flash {
    animation: seatFlash 0.5s ease;
}

@keyframes seatFlash {
    0%   { box-shadow: 0 0 0 0 rgba(37,99,235,0.5); }
    100% { box-shadow: 0 0 0 12px rgba(37,99,235,0); }
}

/* ════════════════════════════════════════════════════════
   图例栏
   ════════════════════════════════════════════════════════ */
.legend-bar {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    font-size: 13px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #4b5563;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 2px solid;
}

.legend-dot.available { background: #fff; border-color: #d1d5db; }
.legend-dot.occupied  { background: #dcfce7; border-color: #16a34a; }
.legend-dot.broken    { background: #fee2e2; border-color: #dc2626; }
.legend-dot.aisle     { background: #f3f4f6; border: 1px dashed #d1d5db; }
.legend-dot.platform  { background: #4b5563; border-color: #4b5563; }

.legend-divider {
    width: 1px;
    height: 16px;
    background: #e5e7eb;
}

.legend-stats {
    margin-left: auto;
    font-weight: 600;
    color: #374151;
}

.legend-stats span {
    margin: 0 3px;
}

/* ══════════════════════════════════════════════════════
   右侧信息面板
   ══════════════════════════════════════════════════════ */
.info-panel {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.info-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    overflow: hidden;
}

.info-card-header {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-card-header .icon { font-size: 16px; }

.info-card-body {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.6;
}

/* 模式标签 */
.mode-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.mode-tag.grid { background: #dbeafe; color: #1d4ed8; }
.mode-tag.free { background: #fce7f3; color: #be185d; }

/* JSON 展示 */
.json-viewer {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 6px;
    padding: 14px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre;
}

.json-viewer .key   { color: #89b4fa; }
.json-viewer .str   { color: #a6e3a1; }
.json-viewer .num   { color: #fab387; }
.json-viewer .bool  { color: #cba6f7; }
.json-viewer .null  { color: #6c7086; }

/* 设计原则卡片 */
.principles-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.principles-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid #2563eb;
}

.principles-list li .num {
    width: 22px;
    height: 22px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.principles-list li .text strong {
    display: block;
    font-size: 13px;
    color: #1f2937;
    margin-bottom: 2px;
}

.principles-list li .text span {
    font-size: 12px;
    color: #6b7280;
}

/* 操作按钮 */
.action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn {
    padding: 7px 14px;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    transition: all 0.15s;
}

.btn:hover { background: #f9fafb; border-color: #9ca3af; }
.btn.primary { background: #2563eb; color: white; border-color: #2563eb; }
.btn.primary:hover { background: #1d4ed8; }

/* Tooltip */
.seat-tooltip {
    position: absolute;
    background: #1f2937;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -120%);
    transition: opacity 0.15s;
    z-index: 20;
}

.seat-tooltip.visible { opacity: 1; }

/* 响应式 */
@media (max-width: 900px) {
    .main-layout { flex-direction: column; }
    .info-panel { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .info-card { flex: 1; min-width: 240px; }
}

/* ══════════════════════════════════════════════════
   微信登录：顶栏头像胶囊 + 账号信息卡片
   ══════════════════════════════════════════════════ */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 12px 3px 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
    cursor: pointer;
    user-select: none;
    transition: background .2s, transform .15s;
}
.user-chip:hover { background: rgba(255, 255, 255, .3); transform: translateY(-1px); }
.user-chip.no-avatar { padding: 4px 12px; }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, .8);
    background: #fff;
    display: block;
    flex: 0 0 auto;
}
.user-avatar[hidden] { display: none; }

/* 账号信息卡片 */
.account-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
}
.account-mask.show { display: flex; }

.account-card {
    width: min(380px, 92vw);
    max-height: 86vh;
    overflow-y: auto;
    background: #fff;
    color: #334155;
    border-radius: 18px;
    padding: 22px 22px 20px;
    box-shadow: 0 20px 55px rgba(15, 23, 42, .35);
    animation: accountIn .22s ease;
}
@keyframes accountIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

.account-head { display: flex; align-items: center; gap: 14px; }
.account-avatar {
    width: 62px; height: 62px; border-radius: 50%;
    object-fit: cover; border: 3px solid #e2e8f0; background: #f1f5f9; flex: 0 0 auto;
}
.account-avatar.ph { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.account-name { font-size: 1.08rem; font-weight: 700; color: #1e293b; }
.account-sub  { font-size: .8rem; color: #94a3b8; margin-top: 3px; }

.account-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.account-tag {
    font-size: .74rem; padding: 3px 9px; border-radius: 999px;
    background: #f1f5f9; color: #64748b;
}
.account-tag.role   { background: #e0e7ff; color: #4338ca; }
.account-tag.wx     { background: #dcfce7; color: #15803d; }
.account-tag.unbind { background: #fef3c7; color: #b45309; }

.account-rows { margin-top: 14px; border-top: 1px dashed #e2e8f0; padding-top: 12px; }
.account-row { display: flex; justify-content: space-between; gap: 10px; font-size: .84rem; padding: 5px 0; }
.account-row span:first-child { color: #94a3b8; flex: 0 0 auto; }
.account-row span:last-child  { color: #334155; text-align: right; word-break: break-all; }

.account-section { margin-top: 16px; border-top: 1px solid #eef2f7; padding-top: 14px; }
.account-section h4 { font-size: .86rem; color: #1e293b; margin-bottom: 4px; }
.account-section p  { font-size: .76rem; color: #94a3b8; line-height: 1.6; margin-bottom: 10px; }

.account-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dbe2ea;
    border-radius: 10px;
    font-size: .88rem;
    margin-bottom: 9px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
}
.account-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .13); }

.account-btn {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter .2s, transform .15s;
}
.account-btn:hover   { filter: brightness(1.06); }
.account-btn:active  { transform: scale(.985); }
.account-btn:disabled { opacity: .6; cursor: not-allowed; }
.account-btn.ghost { background: #f1f5f9; color: #475569; }

.account-msg { font-size: .78rem; margin-top: 9px; min-height: 18px; }
.account-msg.ok  { color: #16a34a; }
.account-msg.err { color: #dc2626; }

.account-actions { display: flex; gap: 10px; margin-top: 18px; }