/* ==================== Desktop Layout & Component Styles ==================== */

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    /* justify-self: start;  <- Removed as we are using flex */
}

.header h1 {
    font-size: var(--font-size-h1);  /* 使用响应式字体 */
    font-weight: 600;
    margin: 0;
}

.header-promo {
    font-size: var(--font-size-small);  /* 使用响应式字体 */
    opacity: 0.8;
    color: #e2e8f0;
    font-weight: 400;
    white-space: nowrap;
    margin-bottom: 2px;
}

.cute-font {
    font-family: 'Comic Sans MS', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', cursive;
    font-weight: 700;
    color: #ff69b4;
    text-shadow: 2px 2px 4px rgba(255, 105, 180, 0.3);
    font-size: 1.4em;
    letter-spacing: 0.05em;
}

.header-center {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-right {
    /* justify-self: end; <- Removed as we are using flex */
}

/* 按钮样式 - 桌面端固定，移动端响应式 */
.btn {
    padding: var(--btn-padding-v) var(--btn-padding-h);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--btn-font-size);
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.btn:focus {
    outline: none;
    box-shadow: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-success {
    background-color: #059669;
    color: white;
}

.btn-success:hover {
    background-color: #047857;
}

.btn-info {
    background-color: #0891b2;
    color: white;
}

.btn-info:hover {
    background-color: #0e7490;
}

.btn-outline {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-outline:hover {
    background-color: rgba(255,255,255,0.1);
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-edit {
    background-color: #0891b2;
    color: white;
}

.btn-edit:hover {
    background-color: #0e7490;
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 主要布局 - 桌面端固定，移动端响应式 */
.main-container {
    display: grid;
    grid-template-columns: 250px 1fr;  /* 桌面端固定侧边栏宽度 */
    gap: var(--grid-gap);
    padding: 0.5rem;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    min-height: 0;
}

/* 侧边栏样式 */
.sidebar-left {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
}

.panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: #f8fafc;
    padding: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    text-align: center;
}

.panel-actions {
    padding: 0.75rem 0.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    flex-wrap: nowrap;
}

/* 学生管理区域 */
.student-controls {
    padding: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
}

.student-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* 确保可以收缩 */
}

.student-item {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    transition: background-color 0.2s;
    gap: 0.5rem;
}

.student-item:hover {
    background-color: #f8fafc;
}

.student-item.seated {
    background-color: #dcfce7;
    color: #166534;
}

.student-item.selected {
    background-color: #dbeafe;
    color: #1e40af;
}

/* 筛选隐藏样式 */
.student-item.search-hidden,
.student-item.status-hidden {
    display: none !important;
}

.student-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.student-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.student-details {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.student-notes {
    font-size: 0.7rem;
    color: #8b5cf6;
    font-style: italic;
    margin-top: 0.125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background-color: #f3f4f6;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
    max-width: 100%;
}

.student-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.student-actions .btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    min-width: auto;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.student-actions .btn:focus {
    outline: none !important;
    box-shadow: none !important;
}

.student-stats {
    padding: 0.25rem 0.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    margin-top: auto; /* 将统计信息推到底部 */
}

.student-actions {
    padding: 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
}

.stat {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.65rem;
    color: #64748b;
}

.stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
}

/* 主要内容区域 */
.main-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-top: -0.25rem;
}

.classroom-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.classroom-header {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-top: 0;
}

.classroom-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
}

.classroom-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
    position: absolute;
    right: 0.75rem;
}

.separator {
    color: #cbd5e1;
}

.settings-btn {
    background-color: #f8fafc;
    border-color: #e2e8f0;
    color: #64748b;
}

.settings-btn:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.layout-settings-container {
    position: relative;
    display: inline-block;
}

.layout-settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    min-width: 220px;
    z-index: 1000;
    margin-top: 6px;
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.layout-settings-item {
    padding: 12px 16px;
    transition: background-color 0.2s ease;
}

.layout-settings-item:hover {
    background-color: #f8fafc;
}

.layout-settings-item .checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: #374151;
    margin: 0;
    cursor: pointer;
}

.layout-settings-item .checkbox-group input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #3b82f6;
}

.layout-settings-item .checkbox-group span {
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.layout-settings-item .font-setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.875rem;
    color: #374151;
    margin: 0;
    width: 100%;
}

.layout-settings-item .font-setting-group span {
    font-weight: 500;
    white-space: nowrap;
    color: #374151;
}

.select-field-small {
    font-size: 0.875rem;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    color: #374151;
    min-width: 80px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-field-small:hover {
    border-color: #3b82f6;
}

.select-field-small:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.layout-settings-item:not(:last-child) {
    border-bottom: 1px solid #f1f5f9;
}

.layout-settings-item + .layout-settings-item {
    margin-top: 0;
}

.layout-setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.875rem;
    color: #374151;
}

.layout-section-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

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

.layout-controls-dropdown {
    display: flex;
    align-items: center;
    gap: 12px;
}

.input-group-compact {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-group-compact label {
    font-size: 0.875rem;
    color: #374151;
    white-space: nowrap;
}

.input-small-dropdown {
    width: 45px;
    font-size: 0.875rem;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background-color: white;
    color: #374151;
    text-align: center;
}

.input-small-dropdown:hover {
    border-color: #3b82f6;
}

.input-small-dropdown:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.apply-layout-dropdown {
    font-size: 0.75rem;
    padding: 3px 8px;
    line-height: 1.2;
}

/* Color picker styles */
.color-setting-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-section-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 4px;
}

.color-swatches {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 4px 0;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.color-swatch.selected {
    border-color: #374151;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #374151;
}

.color-swatch.selected::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Special styling for light colors */
.color-swatch[data-color="#FEF9E7"].selected::after {
    color: #374151;
    text-shadow: none;
}

.color-swatch[data-color="#F1C40F"].selected::after {
    color: #374151;
    text-shadow: none;
}

/* Special styling for dark black color */
.color-swatch[data-color="#1a1a1a"].selected::after {
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* 座位轮换控制样式 - 头部版本 */
.rotation-controls-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rotation-header-label {
    font-size: 0.75rem;
    color: #64748b;
    white-space: nowrap;
    font-weight: 500;
}

.rotation-buttons-header {
    display: flex;
    gap: 3px;
}

.rotation-btn-header {
    min-width: 24px;
    height: 24px;
    padding: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d1d5db;
    background-color: transparent;
    color: #6b7280;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.rotation-btn-header:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    color: #374151;
    transform: translateY(-1px);
}

.rotation-btn-header:active {
    transform: translateY(0);
    background-color: #e5e7eb;
}

.rotation-btn-header:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.classroom-grid {
    flex: 1;
    width: 100%;
    padding: var(--container-padding);
    display: grid;
    gap: var(--seat-gap);
    /* 居中对齐，让座位在容器中均匀分布 */
    justify-content: center;
    align-content: start;
    /* 使用 auto-fit 让座位自动排列，不强制拉伸 */
    grid-auto-flow: row;
    grid-auto-rows: var(--seat-height);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    border: 2px solid #94a3b8;
    border-radius: 8px;
    min-height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 20px;
    padding-left: 20px;
}

/* 座位样式 - 桌面端使用固定尺寸，移动端响应式 */
.seat {
    /* 桌面端使用固定尺寸，确保座位大小一致 */
    width: var(--seat-width);
    height: var(--seat-height);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-small);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    user-select: none;
    margin: 0;  /* 间距现在由 grid gap 控制 */
}

.seat-empty {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #94a3b8;
}

.seat-empty:hover {
    background-color: #e2e8f0;
    transform: scale(1.05);
}

.seat-occupied {
    background-color: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
    font-size: var(--seat-font-size);  /* 使用响应式字体大小 */
    font-weight: 600;
}

.seat-occupied .seat-number {
    color: #374151;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.55rem;
    font-weight: 700;
}

.seat-occupied.male {
    color: var(--male-color);
}

.seat-occupied.female {
    color: var(--female-color);
}

.seat-occupied:hover {
    background-color: #e2e8f0;
    transform: scale(1.05);
}

/* 默认隐藏打印页脚，仅在打印或导出时显示 */
.print-footer {
    display: none;
}

.seat-number {
    position: absolute;
    top: 2px;
    left: 2px;
    color: #64748b;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1;
    z-index: 1;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 1px 3px;
    border-radius: 2px;
}

/* 备注水印样式 - 显示班干部等职务 */
.seat-notes-watermark {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 3px;
    margin: auto 0;
    transform: none;
    font-size: 0.6rem;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.25);
    /* 使用 Flexbox 替代 writing-mode 以获得更好的兼容性（特别是 html2canvas） */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    letter-spacing: 0;
    line-height: 1.1;
    width: auto;
    height: fit-content;
    max-height: none;
    overflow: visible;
    z-index: 1;
    pointer-events: none;
    user-select: none;
}

.seat-notes-watermark span {
    display: block;
    text-align: center;
}

/* 使用更具体的选择器和 !important 确保优先级 */
.seat .student-name-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* 针对2个字的名字，平衡大小 */
    font-size: 3.4rem !important;
    font-weight: 600;
    z-index: 2;
    text-align: center;
    width: 96%; /* 留出一点边距 */
    line-height: 1 !important;
    overflow: hidden;
    text-overflow: ellipsis; /* 恢复省略号 */
    white-space: nowrap;
    /* 默认字体，确保一致性 */
    font-family: 'SimSun', 'NSimSun', 'Songti TC', 'Songti SC', 'STSong', 'Times New Roman', serif;
    letter-spacing: normal;
}

.student-name-display[draggable="true"] {
    cursor: grab;
    user-select: none;
}

.student-name-display[draggable="true"]:active {
    cursor: grabbing;
}

/* 针对2个字名字的适配 - 与3个字大小一致 */
.seat .student-name-display.name-2 {
    font-size: 2.2rem !important;
    width: 98%;
    letter-spacing: normal;
}

/* 针对3个字名字的适配 */
.seat .student-name-display.name-3 {
    font-size: 2.2rem !important;
    width: 98%;
    letter-spacing: normal;
}

.seat .student-name-display.name-4 {
    font-size: 1.7rem !important;
    width: 98%;
}

.seat .student-name-display.name-5 {
    font-size: 1.4rem !important;
    width: 98%;
}

.seat .student-name-display.name-6 {
    font-size: 1.2rem !important;
    width: 98%;
}

.seat .student-name-display.name-7 {
    font-size: 1.1rem !important;
    width: 98%;
}

.seat .student-name-display.name-8-plus {
    font-size: 1.0rem !important;
    width: 98%;
}

/* 字体样式类 */
.student-name-display.font-song {
    /* 宋体 - 传统印刷字体 */
    font-family: 'SimSun', 'NSimSun', 'Songti TC', 'Songti SC', 'STSong', 'Times New Roman', serif !important;
}

.student-name-display.font-hei {
    /* 黑体 - 无衬线字体 */
    font-family: 'SimHei', 'Heiti TC', 'Heiti SC', 'STHeiti', 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Source Han Sans CN', Arial, sans-serif !important;
}

.student-name-display.font-kai {
    /* 楷体 - 书法风格字体 */
    font-family: 'KaiTi', 'STKaiti', 'Kaiti TC', 'Kaiti SC', 'BiauKai', 'Times New Roman', serif !important;
}

.student-name-display.font-yahei {
    /* 微软雅黑 - 现代无衬线字体 */
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'Source Han Sans CN', 'Helvetica Neue', Arial, sans-serif !important;
}

.student-name-display.font-fangsong {
    /* 仿宋 - 仿宋体印刷字体 */
    font-family: 'FangSong', 'STFangsong', 'Fangsong TC', 'Fangsong SC', 'Times New Roman', serif !important;
}

/* 坐标显示控制 */
.classroom-grid.hide-coordinates .seat-number {
    display: none;
}

/* 约束输入组样式 */
.constraint-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* 约束列表样式 */
.no-constraints {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px dashed #d1d5db;
}

.constraint-text {
    flex: 1;
    color: #374151;
    font-size: 0.875rem;
}

.constraint-actions {
    display: flex;
    gap: 0.25rem;
}

.seat-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.seat-remove-btn:hover {
    background: #b91c1c;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* 删除座位按钮样式 */
.seat-delete-btn {
    position: absolute;
    top: -8px;
    left: -8px;
    background: #f59e0b;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.seat-delete-btn:hover {
    background: #d97706;
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* 教室图例 */
.classroom-legend {
    padding: 1rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

.seat-demo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
}

/* 讲台样式 */
.podium {
    display: flex;
    justify-content: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.podium-in-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2%;
    margin-top: 0.5%;
    margin-bottom: 0.5%;
}

.podium-shape {
    position: relative;
    width: 200px;
    height: 50px;
    background: linear-gradient(135deg, #8b5a3c 0%, #a0692e 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1), inset 0 1px 2px rgba(255,255,255,0.3);

    /* 移除3D效果和梯形，使用简单矩形 */
    /* transform: perspective(100px) rotateX(5deg); */
    /* clip-path: polygon(15% 0%, 85% 0%, 100% 100%, 0% 100%); */
}

.podium-text {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;

    /* 移除3D文字效果，使用简单样式 */
    /* transform: perspective(100px) rotateX(-5deg); */
}

/* 右侧控制面板 */
.setting-group {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.setting-group:last-child {
    border-bottom: none;
}

/* 右侧状态信息面板 */
.classroom-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.status-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.status-item span:last-child {
    font-size: 0.875rem;
    color: #1e293b;
    font-weight: 600;
}

.setting-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

.layout-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group label {
    margin: 0;
    min-width: 80px;
    font-size: 0.875rem;
    white-space: nowrap;
}

.rule-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.font-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    margin: 0;
}

.checkbox-group label {
    margin: 0;
    font-weight: normal;
    font-size: 0.875rem;
}



.constraint-list {
    max-height: 150px;
    overflow-y: auto;
}

.constraint-item {
    padding: 0.5rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.constraint-text {
    flex: 1;
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
}

.constraint-actions {
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.no-constraints {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 1rem;
}

.history-controls {
    display: flex;
    gap: 0.5rem;
}

/* 表单元素 */
.input-field,
.select-field {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.student-controls .input-field {
    flex: 2;
    min-width: 120px;
}

.student-controls .select-field {
    flex: 1;
    min-width: 100px;
}

.input-field:focus,
.select-field:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-small {
    width: 60px;
    padding: 0.375rem 0.5rem;
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* 排座设置透明浮层模态框 */
.seating-settings-modal {
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.seating-settings-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* 可访问性：屏幕阅读器专用标签 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==================== 导出格式选择模态框样式 ==================== */
.export-format-modal {
    max-width: 480px;
}

.export-options {
    display: flex;
    flex-direction: column;  /* 改为纵向排列 */
    gap: 1rem;
    justify-content: center;
}

.export-option-btn {
    width: 100%;  /* 全宽 */
    padding: 1.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

/* PDF 按钮特殊样式 - 突出显示 */
.export-option-pdf {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
}


.export-option-btn:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.export-option-btn:active {
    transform: translateY(0);
}

.export-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.export-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.export-desc {
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}

/* 强制GPU加速，提升性能 */
.classroom-grid,
.student-list,
.seat,
.student-item {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* 拖拽样式 - 保持原样不变（已移除视觉效果） */

.seat-dragging {
    /* 移除视觉效果，保持原样 */
    z-index: 10;
    position: relative;
}

/* 拖拽目标样式 */
.seat-drop-target {
    background-color: #dcfce7 !important;
    border-color: #16a34a !important;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.5) !important;
    transform: scale(1.05);
    transition: all 0.2s ease;
}

.seat-drop-invalid {
    background-color: #fef2f2 !important;
    border-color: #dc2626 !important;
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5) !important;
}

.drag-over {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

/* 工具提示 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Excel导入功能样式 */

.excel-preview-modal .modal-content {
    max-width: 900px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.excel-preview-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 1.5rem;
}

.excel-preview-modal .modal-header {
    padding: 0.75rem 1.5rem 0.25rem;
}

.excel-preview-modal .modal-footer {
    flex-shrink: 0;
    border-top: 1px solid #e2e8f0;
    background: white;
    padding: 0.5rem 1.5rem;
}

.import-info {
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    margin-bottom: 0.5rem;
}

.import-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

.import-stats .separator {
    color: #cbd5e1;
}

.import-stats .error-count {
    color: #dc2626;
}

.import-stats strong {
    color: #1e293b;
}

.import-preview {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.preview-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.tab-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    background: #e2e8f0;
    color: #374151;
}

.tab-btn.active {
    color: #4f46e5;
    border-bottom-color: #4f46e5;
    background: white;
}

.preview-content {
    position: relative;
}

.tab-content {
    display: none;
    padding: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.tab-content.active {
    display: block;
}

.data-table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table td {
    color: #4b5563;
}

.data-table .empty-cell {
    color: #9ca3af;
    font-style: italic;
}

.error-list {
    max-height: 250px;
    overflow-y: auto;
}

.error-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    border-left: 4px solid #dc2626;
}

.error-item:last-child {
    margin-bottom: 0;
}

.error-row {
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 0.25rem;
}

.error-message {
    color: #991b1b;
    font-size: 0.875rem;
}

.error-data {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #ffffff;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

.import-options {
    background: #f8fafc;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.import-options .checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.import-options .checkbox-group input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
}

.import-options .checkbox-group span {
    color: #374151;
}

/* 加载状态 */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-left: 1rem;
    color: #4b5563;
    font-weight: 500;
}

/* 多选座位功能样式 */
.seat-multi-selected {
    border: 3px solid #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3) !important;
    background-color: rgba(59, 130, 246, 0.1) !important;
    cursor: move !important;
    position: relative;
}

/* 多选座位拖拽提示 */
.seat-multi-selected::before {
    content: '🖱️';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: 0.8;
    z-index: 15;
    pointer-events: none;
}

.seat-multi-selected:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4) !important;
    transition: all 0.2s ease;
}

.seat-multi-selecting {
    background-color: rgba(59, 130, 246, 0.15) !important;
    border-color: #3b82f6 !important;
    border-width: 2px !important;
    transform: scale(1.02);
    transition: all 0.1s ease;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3) !important;
}

.selection-box {
    position: absolute;
    border: 2px dashed #3b82f6;
    background-color: rgba(59, 130, 246, 0.15);
    pointer-events: none;
    z-index: 1000;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    animation: selectionPulse 1.5s ease-in-out infinite alternate;
}

.classroom-grid {
    position: relative;
    user-select: none;
}

.multi-select-toolbar {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: none;
    gap: 8px;
    align-items: center;
    z-index: 100;
}

.multi-select-toolbar.show {
    display: flex;
}

.selection-count {
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 500;
}

.multi-select-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.multi-select-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.multi-select-btn.primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.multi-select-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.multi-select-btn.danger {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

.multi-select-btn.danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.seat-drag-preview {
    opacity: 0.7;
    transform: scale(0.95);
    z-index: 10;
    position: relative;
}

.seat-drop-target {
    background-color: rgba(34, 197, 94, 0.2) !important;
    border-color: #22c55e !important;
}

.seat-drop-invalid {
    background-color: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
}

.seat-drop-swap {
    background-color: rgba(251, 146, 60, 0.2) !important;
    border-color: #f97316 !important;
    position: relative;
}

.seat-drop-swap::after {
    content: '⇄';
    position: absolute;
    top: 2px;
    right: 2px;
    background: #f97316;
    color: white;
    font-size: 0.6rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

/* 多选拖拽时的视觉反馈 - 保持原样 */
.seat-dragging-multi {
    /* 移除视觉效果，保持原样 */
    border: 2px solid #3b82f6 !important;
    z-index: 1000 !important;
}

/* 拖拽时学生姓名保持显示（保持正常显示） */

/* 拖拽时显示拖拽指示器 */
.seat-dragging-multi::after {
    content: '📦';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    z-index: 1001;
    pointer-events: none;
}

.seat-multi-selected[draggable="true"] {
    cursor: move !important;
    position: relative;
}

.seat-multi-selected[draggable="true"]:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
}



/* 拖拽预览样式 */
.seat-drag-preview {
    background-color: rgba(59, 130, 246, 0.3) !important;
    border: 2px dashed #3b82f6 !important;
    position: relative;
    animation: previewPulse 1s ease-in-out infinite alternate;
}

/* 源座位标记样式 */
.seat-drag-source {
    background-color: rgba(16, 185, 129, 0.2) !important;
    border: 2px solid #10b981 !important;
    position: relative;
}

.seat-drag-preview::after {
    content: '↓';
    position: absolute;
    top: -10px;
    right: -10px;
    background: #3b82f6;
    color: white;
    font-size: 0.8rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    animation: bounceArrow 0.6s ease-in-out infinite alternate;
}

/* 预览名字样式 */
.seat-preview-name {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.2rem;
    font-weight: 600;
    color: #3b82f6;
    text-align: center;
    font-family: 'SimSun', 'NSimSun', 'Songti TC', 'Songti SC', 'STSong', 'Times New Roman', serif;
    line-height: 1;
}

.drag-preview-student {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #3b82f6;
    border-radius: 3px;
    padding: 1px 4px;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== Animations ==================== */

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes selectionPulse {
    from {
        border-color: #3b82f6;
        background-color: rgba(59, 130, 246, 0.1);
    }
    to {
        border-color: #2563eb;
        background-color: rgba(59, 130, 246, 0.2);
    }
}

@keyframes previewPulse {
    from {
        box-shadow: 0 0 5px rgba(59, 130, 246, 0.5);
    }
    to {
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
    }
}

@keyframes bounceArrow {
    from {
        transform: translateY(0px);
    }
    to {
        transform: translateY(-3px);
    }
}