/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    margin-bottom: 20px;
}

/* Control Panel */
.control-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.panel-section {
    margin-bottom: 25px;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.panel-section h3 {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section h3 i {
    color: #667eea;
}

/* Form Elements */
.form-group {
    margin-bottom: 15px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-group input[type="number"],
.form-group input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: #f7fafc;
    transition: all 0.3s ease;
}

.form-group input[type="number"]:focus,
.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    background: #f7fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group input[type="file"]:hover {
    border-color: #667eea;
    background: #edf2f7;
}

.file-info {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #718096;
}

/* Checkbox和Radio样式 */
.checkbox-group,
.radio-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.checkbox-group label,
.radio-group label {
    margin: 0;
    font-size: 0.9rem;
    cursor: pointer;
}

/* 排列选项 */
.arrangement-options {
    margin-bottom: 15px;
}

.gender-settings,
.height-settings,
.grade-settings,
.group-settings {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

/* 走廊设置 */
.corridor-settings p {
    font-size: 0.9rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.corridor-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
    padding: 10px;
    background: #f7fafc;
    border-radius: 8px;
}

/* 按钮样式 */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-secondary:hover {
    background: #718096;
}

.btn-small {
    padding: 8px 15px;
    font-size: 13px;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Seating Layout */
.seating-layout {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

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

.layout-header h3 {
    color: #4a5568;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.layout-controls {
    display: flex;
    gap: 10px;
}

/* 整合座位区域 */
.seating-area {
    background: #f7fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.integrated-layout {
    display: grid;
    gap: 8px;
    justify-items: center;
    width: 100%;
}

/* 黑板样式 */
.blackboard-row {
    grid-column: 1 / -1;
    background: #718096;
    color: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    width: 100%;
}

/* 讲台区域样式 */
.podium-row {
    grid-column: 1 / -1;
    display: grid;
    gap: 8px;
    justify-items: center;
    margin-bottom: 15px;
    width: 100%;
}

.teacher-seat {
    width: 50px;
    height: 40px;
    background: #4a5568;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    border: 2px solid #667eea;
    transition: all 0.3s ease;
    color: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.teacher-seat.occupied {
    background: #667eea;
    color: white;
}

.teacher-seat.male {
    background: #c6f6d5;
    color: #22543d;
    border-color: #38a169;
}

.teacher-seat.female {
    background: #fbb6ce;
    color: #97266d;
    border-color: #d53f8c;
}

.teacher-seat:hover:not(.occupied) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.teacher-seat.editable {
    border-color: #f56565;
    animation: pulse 1.5s infinite;
}

.podium {
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.seat {
    width: 50px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seat.empty {
    background: #e2e8f0;
    color: #a0aec0;
    border-style: dashed;
}

.seat.occupied {
    background: #bee3f8;
    color: #2b6cb0;
    border-color: #3182ce;
}

.seat.male {
    background: #c6f6d5;
    color: #22543d;
    border-color: #38a169;
}

.seat.female {
    background: #fbb6ce;
    color: #97266d;
    border-color: #d53f8c;
}

.seat.corridor {
    background: #718096;
    color: white;
    cursor: default;
}

.seat:hover:not(.corridor) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.seat.editable {
    border-color: #f56565;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(245, 101, 101, 0);
    }
}

/* 图例 */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #4a5568;
}

.seat-demo {
    width: 30px;
    height: 25px;
    border-radius: 5px;
    border: 2px solid;
}

.seat-demo.occupied {
    background: #bee3f8;
    border-color: #3182ce;
}

.seat-demo.empty {
    background: #e2e8f0;
    border-color: #cbd5e0;
    border-style: dashed;
}

.seat-demo.corridor {
    background: #718096;
    border-color: #718096;
}

.seat-demo.male {
    background: #c6f6d5;
    border-color: #38a169;
}

.seat-demo.female {
    background: #fbb6ce;
    border-color: #d53f8c;
}

/* 统计面板 */
.stats-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
}

.stats-panel h3 {
    color: #4a5568;
    font-size: 1.1rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #667eea;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #4a5568;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #a0aec0;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #4a5568;
}

.modal-body {
    padding: 25px;
}

.export-options {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Toast Messages */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1500;
}

.toast {
    background: white;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left-color: #38a169;
}

.toast.error {
    border-left-color: #e53e3e;
}

.toast.warning {
    border-left-color: #d69e2e;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .control-panel {
        order: 2;
    }
    
    .seating-layout {
        order: 1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .teacher-area {
        flex-direction: column;
        gap: 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .legend {
        flex-direction: column;
        align-items: center;
    }
}