/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", sans-serif;
}

/* 页面背景 */
body {
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding-top: 50px;
}

/* 待办容器 */
.todo-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 600px; /* 加宽容器，适配日期显示 */
}

/* 标题样式 */
h1 {
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

/* 添加待办区域：适配日期选择框布局 */
.todo-add {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* 适配手机端换行 */
}

#todo-input {
    flex: 2; /* 调整宽度占比 */
    min-width: 200px; /* 手机端最小宽度 */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    font-size: 16px;
}

/* 日期选择框样式 */
#todo-date {
    flex: 1; /* 调整宽度占比 */
    min-width: 150px; /* 手机端最小宽度 */
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    outline: none;
    font-size: 16px;
    cursor: pointer;
}

#add-btn {
    flex: 0.8; /* 调整宽度占比 */
    min-width: 80px; /* 手机端最小宽度 */
    padding: 10px 20px;
    background-color: #42b983;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

#add-btn:hover {
    background-color: #359469;
}

/* 待办列表样式 */
#todo-list {
    list-style: none;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    flex-wrap: wrap; /* 日期和内容换行适配 */
}

/* 待办内容区域：显示内容+日期 */
.todo-content {
    flex: 1;
    margin-right: 10px;
}

/* 待办日期样式 */
.todo-date {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    display: block; /* 独占一行，更清晰 */
}

/* 已完成待办样式 */
.todo-item.completed {
    text-decoration: line-through;
    color: #999;
}

/* 已完成待办的日期也变灰 */
.todo-item.completed .todo-date {
    color: #999;
}

/* 删除按钮样式 */
.delete-btn {
    color: #ff4444;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0; /* 按钮不被压缩 */
}

.delete-btn:hover {
    color: #ff0000;
}