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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 10px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    flex-shrink: 0;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

.main-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    flex: 1;
    overflow: hidden;
}

/* 左侧日历区域 */
.calendar-section {
    flex: 1;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.calendar-header h2 {
    font-size: 24px;
    color: #333;
}

.nav-btn {
    background: #667eea;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: #764ba2;
    transform: scale(1.1);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.weekday {
    text-align: center;
    font-weight: 600;
    color: #666;
    padding: 10px;
    font-size: 14px;
}

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

.day-cell {
    aspect-ratio: 1;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    background: #f5f5f5;
    font-size: 12px;
    overflow: hidden;
}

.day-cell:hover {
    background: #e0e0e0;
    transform: scale(1.02);
}

.day-cell.today {
    background: #667eea;
    color: white;
}

.day-cell.selected {
    background: #764ba2;
    color: white;
}

.day-cell.other-month {
    color: #ccc;
    opacity: 0.5;
}

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

.day-tasks {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.day-task-item {
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 3px;
}

.day-cell.today .day-task-item,
.day-cell.selected .day-task-item {
    background: rgba(255, 255, 255, 0.9);
}

.day-task-item.completed {
    opacity: 0.7;
    text-decoration: line-through;
}

.day-task-item .task-icon {
    flex-shrink: 0;
    font-size: 8px;
}

.day-task-item.completed .task-icon {
    color: #4caf50;
    font-size: 10px;
}

.day-more-tasks {
    font-size: 10px;
    color: #666;
    padding: 2px 4px;
    text-align: center;
}

.day-cell.today .day-more-tasks,
.day-cell.selected .day-more-tasks {
    color: white;
}

/* 右侧任务区域 */
.task-section {
    flex: 1;
    min-width: 350px;
    display: flex;
    flex-direction: column;
}

.selected-date-header {
    margin-bottom: 20px;
}

.selected-date-header h3 {
    font-size: 20px;
    color: #333;
}

.add-task-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#taskInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.3s;
}

#taskInput:focus {
    outline: none;
    border-color: #667eea;
}

#addTaskBtn {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

#addTaskBtn:hover {
    background: #764ba2;
    transform: translateY(-2px);
}

.task-list-container {
    flex: 1;
    overflow-y: auto;
    background: #f9f9f9;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 10px;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.task-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.task-item.completed {
    opacity: 0.6;
}

.task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #667eea;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.task-checkbox:hover {
    background: #f0f0f0;
}

.task-item.completed .task-checkbox {
    background: #4caf50;
    border-color: #4caf50;
}

.task-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    display: none;
}

.task-item.completed .task-checkbox::after {
    display: block;
}

.task-text {
    flex: 1;
    font-size: 14px;
    color: #333;
    word-break: break-all;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #999;
}

.delete-btn {
    background: none;
    border: none;
    color: #f44336;
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.3s;
    opacity: 0;
}

.task-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: #fee;
}

.stats {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

/* 复制任务按钮 */
.copy-tasks-btn {
    width: 100%;
    padding: 12px 24px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.copy-tasks-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.copy-tasks-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
    font-size: 20px;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

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

.modal-body p {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.date-selector {
    margin-bottom: 20px;
}

.date-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.date-selector input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.date-input-group {
    display: flex;
    gap: 10px;
}

.add-date-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.add-date-btn:hover {
    background: #764ba2;
}

.date-selector input[type="date"]:focus {
    outline: none;
    border-color: #667eea;
}

.selected-dates-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.selected-date-tag {
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.selected-date-tag button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 16px;
    padding: 0 4px;
    line-height: 1;
}

.selected-date-tag button:hover {
    color: #ffeb3b;
}

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

.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn-cancel {
    background: #e0e0e0;
    color: #666;
}

.modal-btn-cancel:hover {
    background: #d0d0d0;
}

.modal-btn-confirm {
    background: #667eea;
    color: white;
}

.modal-btn-confirm:hover {
    background: #764ba2;
}

.modal-btn-confirm:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .calendar-section,
    .task-section {
        min-width: 100%;
    }

    header h1 {
        font-size: 24px;
    }

    .day-cell {
        min-height: 60px;
    }

    .day-task-item {
        font-size: 9px;
    }
}
