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

:root {
    --primary-color: #4a90e2;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #343a40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: #f5f5f5;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.header-buttons {
    display: flex;
    gap: 10px;
    position: relative;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn i {
    font-size: 0.9em;
}

.btn.primary {
    background: var(--primary-color);
    color: white;
}

.btn.secondary {
    background: var(--secondary-color);
    color: white;
}

.btn.add-btn {
    padding: 8px;
    background: var(--success-color);
    color: white;
}

.btn.info {
    background: #17a2b8;
    color: white;
}

.schedule-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f0f0f0;
    scroll-behavior: smooth;
}

.schedule-container::-webkit-scrollbar {
    height: 8px;
}

.schedule-container::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.schedule-container::-webkit-scrollbar-thumb:hover {
    background: #357abd;
}

.schedule-table {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    width: max-content;
    min-width: 100%;
}

.schedule-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.schedule-cell {
    flex: 1;
    min-width: 80px;
    height: 70px;
    border-right: 1px solid var(--border-color);
    padding: 4px;
    position: relative;
    box-sizing: border-box;
}

.schedule-header {
    background: var(--light-gray);
    font-weight: bold;
    text-align: center;
}

.schedule-item {
    position: absolute;
    top: 4px;
    height: calc(100% - 8px);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-item.color-1 { background: rgba(74, 144, 226, 0.9); color: white; }
.schedule-item.color-2 { background: rgba(80, 200, 120, 0.9); color: white; }
.schedule-item.color-3 { background: rgba(244, 164, 96, 0.9); color: white; }
.schedule-item.color-4 { background: rgba(186, 85, 211, 0.9); color: white; }
.schedule-item.color-5 { background: rgba(32, 178, 170, 0.9); color: white; }

.position-cell {
    min-width: 120px;
    flex: 0 0 120px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    background: var(--light-gray);
    border-right: 2px solid var(--border-color);
}

.control-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.panel-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.panel-section h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--light-gray);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.tag.employee-tag {
    color: white;
}

.tag.color-1 { background: #4a90e2; }
.tag.color-2 { background: #50c878; }
.tag.color-3 { background: #f4a460; }
.tag.color-4 { background: #ba55d3; }
.tag.color-5 { background: #20b2aa; }

.tag.position-tag {
    color: white;
}

.tag.position-tag.color-1 { background: #34495e; }
.tag.position-tag.color-2 { background: #8e44ad; }
.tag.position-tag.color-3 { background: #2c3e50; }
.tag.position-tag.color-4 { background: #16a085; }
.tag.position-tag.color-5 { background: #27ae60; }

.tag span {
    cursor: pointer;
    color: var(--danger-color);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    margin: 100px auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.time-select {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-select input[type="time"] {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.modal-buttons {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 1.2em;
}

.tag-edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.tag-edit-content {
    background: white;
    width: 90%;
    max-width: 300px;
    margin: 100px auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.tag-edit-content .form-group {
    margin-bottom: 20px;
}

.tag-edit-content .form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
}

.tag-edit-content .form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    margin-top: 8px;
}

.tag-edit-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.tag-edit-buttons button {
    flex: 1;
    padding: 8px 16px;
}

.btn.delete {
    background: var(--danger-color);
    color: white;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .schedule-cell {
        min-width: 60px;
        height: 60px;
        padding: 2px;
    }

    .time-cell {
        min-width: 60px;
        flex: 0 0 60px;
        font-size: 0.8em;
    }

    .position-cell {
        min-width: 100px;
        flex: 0 0 100px;
        font-size: 0.9em;
    }

    .schedule-item {
        font-size: 10px;
        padding: 2px 4px;
    }

    .header-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .schedule-container {
        -webkit-overflow-scrolling: touch;
        padding: 10px;
    }

    .hour {
        font-size: 0.8em;
        margin-bottom: 2px;
    }

    .half-hour {
        height: 1px;
        margin-top: 2px;
    }

    .schedule-item {
        top: 2px;
        height: calc(100% - 4px);
    }
}

.time-cell {
    min-width: 80px;
    flex: 0 0 80px;
    text-align: center;
    padding: 4px;
    background: #f8f9fa;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.hour {
    font-size: 0.9em;
    white-space: nowrap;
} 

.preview-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    white-space: pre-wrap;
    font-family: monospace;
}

.schedule-item .notes {
    font-size: 0.8em;
    font-style: italic;
    color: rgba(255, 255, 255, 0.9);
} 

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-input {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
} 

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    min-height: 50px;
}

.modal-tag {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    background: white;
    color: var(--text-color);
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.modal-tag.selected {
    color: white;
    border-color: white;
    box-shadow: 0 0 0 2px var(--primary-color);
}

.modal-tag.selected.color-1 { background: #4a90e2; }
.modal-tag.selected.color-2 { background: #50c878; }
.modal-tag.selected.color-3 { background: #f4a460; }
.modal-tag.selected.color-4 { background: #ba55d3; }
.modal-tag.selected.color-5 { background: #20b2aa; }

.common-times {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.time-preset {
    padding: 4px 8px;
    border-radius: 4px;
    background: #e3f2fd;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #bbdefb;
    color: #1976d2;
}

.time-preset:hover {
    background: #bbdefb;
    color: #1565c0;
}

.time-preset .fa-times {
    opacity: 0.5;
    padding: 2px;
    margin-left: 4px;
}

.time-preset:hover .fa-times {
    opacity: 1;
}

.time-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.time-actions button {
    background: #1976d2;
    color: white;
}

.time-actions button:hover {
    background: #1565c0;
}

.btn.danger {
    background: var(--danger-color);
    color: white;
}

.btn.danger:hover {
    background: #c82333;
}

/* 添加常用备注样式 */
.common-notes {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.note-preset {
    padding: 4px 8px;
    border-radius: 4px;
    background: #f3e5f5;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #e1bee7;
    color: #7b1fa2;
}

.note-preset:hover {
    background: #e1bee7;
    color: #6a1b9a;
}

.note-preset.selected {
    background: #7b1fa2;
    color: white;
    border-color: #6a1b9a;
}

.note-preset.selected:hover {
    background: #6a1b9a;
}

.note-preset .fa-times {
    opacity: 0.5;
    padding: 2px;
    margin-left: 4px;
}

.note-preset:hover .fa-times {
    opacity: 1;
}

.notes-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.notes-actions button {
    background: #7b1fa2;
    color: white;
}

.notes-actions button:hover {
    background: #6a1b9a;
}

/* 添加日期范围选择器样式 */
.date-range-selector {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--light-gray);
    border-radius: 4px;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.date-inputs .btn {
    padding: 6px 10px;
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 80px;
    justify-content: center;
}

/* 在小屏幕上优化按钮显示 */
@media (max-width: 768px) {
    .date-inputs {
        gap: 6px;
    }
    
    .date-inputs .btn {
        padding: 4px 8px;
        font-size: 0.8em;
        min-width: 70px;
    }
}

/* 删除原来的 system-dropdown 相关样式，添加新的弹出菜单样式 */
.popup-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.popup-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 8px;
    min-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.2s ease;
}

.popup-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-color);
    transition: all 0.2s ease;
    border-radius: 4px;
}

.menu-item:hover {
    background: var(--light-gray);
}

.menu-item.danger {
    color: var(--danger-color);
}

.menu-item.danger:hover {
    background: #ffebee;
}

.menu-item.warning {
    color: #f0ad4e;
}

.menu-item.warning:hover {
    background: #fff3e0;
}

/* 添加动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* 添加提示框样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: toastSlideIn 0.3s ease forwards;
    opacity: 0;
}

.toast.fade-out {
    animation: toastFadeOut 0.3s ease forwards;
}

.toast.success {
    background: rgba(40, 167, 69, 0.9);
}

.toast.error {
    background: rgba(220, 53, 69, 0.9);
}

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

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

/* 添加被删除员工的排班样式 */
.schedule-item.deleted-employee {
    background: rgba(200, 200, 200, 0.5);
    color: #666;
    border: 1px dashed #999;
}

.schedule-item.deleted-employee .notes {
    color: #666;
}

/* 修改鼠标悬停效果 */
.schedule-item.deleted-employee:hover {
    background: rgba(200, 200, 200, 0.7);
}

/* 添加备注区域的样式 */
.notes-header {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.notes-header textarea {
    flex: 1;
}

.btn.clear-notes {
    padding: 6px 8px;
    background: #f0f0f0;
    color: #666;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn.clear-notes:hover {
    background: #e0e0e0;
    color: #333;
}

.btn.clear-notes i {
    font-size: 14px;
}

/* 调整备注文本框的样式 */
#modal-notes {
    min-height: 60px;
    resize: vertical;
}

/* 添加空闲标签样式 */
.free-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: #e8f5e9;
    color: #2e7d32;
    border-radius: 10px;
    border: 1px solid #c8e6c9;
    white-space: nowrap;
}

/* 选中状��下的空闲标签样式 */
.modal-tag.selected .free-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.overnight-badge {
    display: inline-block;
    background-color: #ff6b6b;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 8px;
    vertical-align: middle;
}
