/* 维护人员：msyg | v3.7 */
/* --- 通用样式 --- */
body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    /* 新增：平滑过渡 */
    transition: background-color 0.5s ease;
}

header {
    background-color: #4a69bd;
    color: #fff;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

main {
    padding: 20px;
    max-width: 1400px;
    margin: 20px auto;
    display: flex;
    gap: 20px;
}

.card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

/* --- 动态库加载状态 --- */
.status-message {
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    color: #333;
    background-color: #e0e0e0;
}

/* --- 左右分栏布局 --- */
.left-panel {
    flex: 0 0 20%;
    display: flex;
    flex-direction: column;
    gap: 10px; /* 减小间距 */
}
.left-panel .card {
    margin-bottom: 0; /* 移除卡片底部外边距 */
}
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- 输入与按钮 --- */
.management-buttons button {
    width: 100%;
}
.input-group,
.import-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    align-items: center;
}
input[type="text"],
input[type="date"],
select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex-grow: 1;
}
button {
    padding: 10px 15px;
    border: none;
    background-color: #4a69bd;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
button:hover {
    background-color: #3a539b;
}

/* 开始抽签按钮改为橙色 */
.primary-btn {
    background-color: #ff9800; /* 橙色 */
}
.primary-btn:hover {
    background-color: #f57c00; /* 悬停时更深的橙色 */
}
#clearDataBtn {
    background-color: #e74c3c;
}
#clearDataBtn:hover {
    background-color: #c0392b;
}
.excel-import-label {
    background-color: #2ecc71;
    color: white;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 14px;
    transition: background-color 0.2s ease;
}
.excel-import-label:hover {
    background-color: #27ae60;
}
.excel-import-label input[type="file"] {
    display: none;
}

/* 危险按钮 (红色) */
.danger-btn {
    background-color: #e74c3c;
}
.danger-btn:hover {
    background-color: #c0392b;
}

/* --- 统计信息 --- */
.stats-summary-card {
    text-align: center;
}
.stats-summary-card .stats-info {
    flex-direction: column;
}

/* --- 表格样式 --- */
.table-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-top: 15px;
}
table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
/* 调整表头字体大小 */
#personnelTable th,
#holidayTable th {
    font-size: 14px;
    font-weight: normal;
}
th, td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
    word-wrap: break-word;
}
th {
    background-color: #f5f5f5;
}

/* 优化：调整表格内容字体大小 */
#personnelTable td,
#holidayTable td {
    font-size: 13px;
    padding: 8px;
}

/* 调整人员管理表格的列宽 */
#personnelTable th:nth-child(1), #personnelTable td:nth-child(1) { width: 10%; text-align: center; }
#personnelTable th:nth-child(2), #personnelTable td:nth-child(2) { width: 25%; }
#personnelTable th:nth-child(3), #personnelTable td:nth-child(3) { width: 15%; }
#personnelTable th:nth-child(4), #personnelTable td:nth-child(4) { width: 20%; }
#personnelTable th:nth-child(5), #personnelTable td:nth-child(5) { width: 30%; }

/* 调整节假日管理表格的列宽 */
#holidayTable th:nth-child(1), #holidayTable td:nth-child(1) { width: 10%; text-align: center; }
#holidayTable th:nth-child(2), #holidayTable td:nth-child(2) { width: 35%; }
#holidayTable th:nth-child(3), #holidayTable td:nth-child(3) { width: 35%; }
#holidayTable th:nth-child(4), #holidayTable td:nth-child(4) { width: 20%; }

/* --- 结果区域 --- */
#resultsContainer {
    display: none;
    text-align: center;
}
/* 排班结果标题居中 */
#resultsContainer h2 {
    text-align: center;
}

/* 排班结果表格的3D效果 */
.result-table-container {
    border: none;
    box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    transition: all 0.3s cubic-bezier(.25,.8,.25,1);
    margin-bottom: 20px;
}
.result-table-container:hover {
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}
#assignmentTable {
    border-radius: 8px;
    overflow: hidden;
}
/* 居中表格文字并调整大小 */
#assignmentTable th, #assignmentTable td {
    border: none;
    border-bottom: 1px solid #ddd;
    text-align: center;
    font-size: 16px; /* 字体放大 */
}
#assignmentTable tbody tr:last-child td {
    border-bottom: none;
}
/* 新增：交替颜色（商务蓝）*/
#assignmentTable tbody tr:nth-child(odd) {
    background-color: #e6f0ff;
}
#assignmentTable tbody tr:nth-child(even) {
    background-color: #d0e1ff;
}

.stats-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}
.stats-info p {
    font-size: 18px;
    margin: 0;
}

/* --- 核心修复：为图表容器设置最小高度，防止其过小，但允许其自动增长 --- */
.chart-container-wrapper {
    position: relative;
    min-height: 300px;
}
#shiftChart {
    height: auto;
    width: 100%;
}

/* --- 弹窗样式 --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    overflow-y: auto;
}

/* 排班结果弹窗的特殊样式：内容框全屏 */
#scheduleModal .modal-content {
    margin: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    padding: 20px;
    border-radius: 0;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
}
/* 排班结果标题居中 */
#scheduleModal h2 {
    text-align: center;
}

/* 其他弹窗内容样式，使其更美观居中 */
#personnelModal .modal-content,
#holidayModal .modal-content,
#exportModal .modal-content,
#personnelEditModal .modal-content { /* 新增 */
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
    max-width: 800px;
    width: 90%;
    box-sizing: border-box;
}

/* 新增弹窗头部样式，使标题和字体按钮对齐 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
/* 标题居中显示 */
.modal-header h2 {
    flex-grow: 1;
    text-align: center;
}

#modalTableContainer {
    display: flex;
    justify-content: center;
    gap: 20px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    align-items: flex-start;
    flex-wrap: wrap;
    flex-grow: 1;
}

#scheduleModal .result-table-container {
    box-shadow: none;
    overflow-y: visible;
    flex-grow: 1;
}

#modalTableContainer table {
    width: 48%;
    min-width: 300px;
    height: auto;
    font-family: 'KaiTi', '楷体', serif;
    /* 在这里添加这行代码，将18px替换为您想要的大小 */
    font-size: 18px; 
}
/* 新增：序号列宽度 */
#modalTableContainer table th:nth-child(1),
#modalTableContainer table td:nth-child(1) {
    width: 15%;
}

/* 新增：弹窗表格内容样式 */
#modalTableContainer table th,
#modalTableContainer table td {
    text-align: center;
    border: none;
    border-bottom: 1px solid #ddd;
}
#modalTableContainer table tbody tr:nth-child(odd) {
    background-color: #e6f0ff;
}
#modalTableContainer table tbody tr:nth-child(even) {
    background-color: #d0e1ff;
}

.close-btn {
    color: #aaa;
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2;
}

.close-btn:hover,
.close-btn:focus {
    color: black;
    text-decoration: none;
}

/* 新增导出按钮样式 */
.export-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}
.export-options button {
    padding: 12px 24px;
    font-size: 16px;
}
#exportHtmlBtn {
    background-color: #3498db;
}
#exportHtmlBtn:hover {
    background-color: #2980b9;
}
#exportWordBtn {
    background-color: #27ae60;
}
#exportWordBtn:hover {
    background-color: #229954;
}

/* 调整导出弹窗内容样式，使其更小居中 */
#exportModal .modal-content {
    max-width: 450px;
    text-align: center;
}
.validation-message {
    color: red;
    font-size: 14px;
    text-align: center;
    margin-top: -10px;
    margin-bottom: 10px;
    display: none;
}
.invalid-date {
    color: #999;
}

/* --- 页脚 --- */
footer {
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: #666;
    font-size: 14px;
}
#versionInfo {
    font-size: 12px;
    color: #999;
}

/* 关键修复：当body有lottery-active类时，隐藏主要内容 */
.lottery-active main,
.lottery-active header,
.lottery-active footer,
.lottery-active .modal {
    display: none;
}

/* 新增：全屏抽签容器样式 */
#lotteryEffectContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow: hidden;
}

/* 新增：抽签元素样式 */
.lottery-item {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap; /* 防止文字换行 */
    font-family: 'Consolas', monospace; /* 程序员字体 */
    text-shadow: 0 0 5px #fff, 0 0 10px #00ffff, 0 0 20px #00ffff; /* 霓虹灯发光效果 */
    opacity: 0; /* 初始隐藏 */
    animation-name: fly-random;
    animation-duration: 5s; /* 动画持续时间 */
    animation-timing-function: linear;
    animation-fill-mode: forwards; /* 动画结束后保持最后一帧状态 */
}

/* 新增：随机乱飞动画 */
@keyframes fly-random {
    0% {
        transform: translate(0, 0) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    80% {
        transform: translate(var(--end-x), var(--end-y)) scale(1.2);
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(var(--end-x), var(--end-y)) scale(0.8);
    }
}
