/* 日历视图样式 */
.calendar-controls {
    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);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.calendar-nav h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
    min-width: 150px;
    text-align: center;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: #f8f9fa;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e9ecef;
    color: #333;
}

.view-controls {
    display: flex;
    gap: 5px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 6px;
}

.view-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.view-btn:hover {
    background: #e9ecef;
    color: #333;
}

.view-btn.active {
    background: #007bff;
    color: white;
}

/* 日历容器 */
.calendar-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.view-container {
    display: none;
}

.view-container.active {
    display: block;
}

/* 月视图样式 */
.calendar-grid {
    width: 100%;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.day-header {
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    color: #495057;
    border-right: 1px solid #dee2e6;
}

.day-header:last-child {
    border-right: none;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 120px;
}

.calendar-day {
    border-right: 1px solid #dee2e6;
    border-bottom: 1px solid #dee2e6;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
    overflow: hidden;
}

.calendar-day:last-child {
    border-right: none;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.other-month {
    background-color: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.today {
    background-color: #e3f2fd;
}

.calendar-day.selected {
    background-color: #bbdefb;
}

.day-number {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.day-tasks {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 90px;
    overflow: hidden;
}

.task-item {
    background: #007bff;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-item:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.task-item.priority-high {
    background: #dc3545;
}

.task-item.priority-medium {
    background: #ffc107;
    color: #212529;
}

.task-item.priority-low {
    background: #28a745;
}

.task-item.completed {
    background: #6c757d;
    text-decoration: line-through;
    opacity: 0.7;
}

.more-tasks {
    font-size: 10px;
    color: #666;
    text-align: center;
    margin-top: 2px;
}

/* 周视图和日视图样式 */
.week-grid, .day-grid {
    display: flex;
    height: 600px;
    overflow-y: auto;
}

.time-column {
    width: 80px;
    border-right: 1px solid #dee2e6;
    background: #f8f9fa;
}

.time-slot {
    height: 60px;
    padding: 5px;
    border-bottom: 1px solid #dee2e6;
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: flex-start;
}

.week-days {
    flex: 1;
    display: flex;
}

.week-day {
    flex: 1;
    border-right: 1px solid #dee2e6;
    position: relative;
}

.week-day:last-child {
    border-right: none;
}

.week-day-header {
    padding: 10px;
    text-align: center;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.week-day-content {
    position: relative;
    height: 100%;
}

.hour-slot {
    height: 60px;
    border-bottom: 1px solid #dee2e6;
    position: relative;
}

.day-column {
    flex: 1;
    position: relative;
}

/* 任务事件样式 */
.task-event {
    position: absolute;
    left: 2px;
    right: 2px;
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 5;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.task-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.task-event.priority-high {
    background: #dc3545;
}

.task-event.priority-medium {
    background: #ffc107;
    color: #212529;
}

.task-event.priority-low {
    background: #28a745;
}

.task-event.completed {
    background: #6c757d;
    opacity: 0.7;
}

.task-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-event-time {
    font-size: 10px;
    opacity: 0.9;
    margin-top: 2px;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

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

.modal-header h3 {
    margin: 0;
    color: #333;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

.modal form {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #007bff;
    border-color: #007bff;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .calendar-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .calendar-nav h2 {
        font-size: 1.2rem;
        min-width: auto;
    }
    
    .calendar-days {
        grid-auto-rows: 80px;
    }
    
    .task-item {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .week-grid, .day-grid {
        height: 400px;
    }
    
    .time-column {
        width: 60px;
    }
    
    .time-slot {
        height: 40px;
        font-size: 10px;
    }
    
    .hour-slot {
        height: 40px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

/* 拖拽样式 */
.task-event.dragging {
    opacity: 0.5;
    z-index: 1000;
}

.drop-zone {
    background-color: rgba(0, 123, 255, 0.1);
    border: 2px dashed #007bff;
}

.drop-zone.valid {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.drop-zone.invalid {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
}

/* 当前时间线 */
.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #dc3545;
    z-index: 100;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.5);
}

.current-time-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    background: #dc3545;
    border-radius: 50%;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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