/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f4f8; /* 护眼淡蓝色背景 */
    color: #333;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.app-container {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 15px; /* 圆角 */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 900px;
}

header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e6ed;
    padding-bottom: 20px;
}

header h1 {
    color: #2c3e50; /* 深蓝灰色 */
    margin-bottom: 15px;
}

nav {
    display: flex;
    justify-content: center;
    gap: 10px; /* 按钮间距 */
}

.nav-button {
    background-color: #5dade2; /* 柔和蓝色 */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px; /* 圆角按钮 */
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.nav-button:hover {
    background-color: #3498db; /* 深一点的蓝色 */
    transform: translateY(-2px);
}

.nav-button.active {
    background-color: #2980b9; /* 激活状态的深蓝色 */
    box-shadow: 0 0 10px rgba(41, 128, 185, 0.5);
}

/* 添加任务区域 */
#add-task-section {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #eaf2f8; /* 淡雅背景 */
    border-radius: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

#add-task-section h2 {
    margin: 0 0 10px 0;
    color: #34495e; /* 较深的文本颜色 */
    font-size: 1.4em;
    flex-grow: 0; /* 防止标题占用过多空间 */
    margin-right: 15px;
}

#task-name-input {
    flex-grow: 1;
    padding: 12px;
    border: 1px solid #bdc3c7;
    border-radius: 8px;
    font-size: 1em;
}

#add-task-button {
    background-color: #2ecc71; /* 绿色，表示添加 */
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

#add-task-button:hover {
    background-color: #27ae60;
}

#add-task-button.loading {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.task-actions button.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.calendar-controls button.loading {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.modal-footer button.loading {
    background-color: #95a5a6;
    cursor: not-allowed;
}

/* 标签页内容 */
.tab-pane {
    display: none;
    padding: 15px;
    border-radius: 8px;
    background-color: #fdfefe;
    animation: fadeIn 0.5s ease-in-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-pane h2 {
    color: #34495e;
    margin-top: 0;
    border-bottom: 1px solid #e0e6ed;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

/* 任务列表和任务项 */
.task-list {
    list-style: none;
    padding: 0;
}

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f9f9f9;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 8px; /* 圆角 */
    border: 1px solid #e0e6ed;
    transition: background-color 0.3s ease;
}

.task-item:hover {
    background-color: #f0f0f0;
}

.task-item.completed .task-name {
    text-decoration: line-through;
    color: #7f8c8d; /* 完成任务的文本颜色变淡 */
}

.task-details {
    flex-grow: 1;
}

.task-name {
    font-weight: bold;
    color: #2c3e50;
    margin-right: 15px;
}

.task-dates {
    font-size: 0.85em;
    color: #555;
    margin-top: 5px;
}

.task-dates span {
    margin-right: 10px;
}

.task-actions button {
    background-color: #e74c3c; /* 红色，表示删除 */
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 8px;
    transition: background-color 0.3s ease;
}

.task-actions button.complete-btn {
    background-color: #3498db; /* 蓝色，表示待完成状态 */
}
.task-actions button.complete-btn.completed {
    background-color: #4a4a4a; /* 绿色，表示已完成状态 */
}
.task-actions button.complete-btn:hover {
    background-color: #2980b9;
}
.task-actions button.complete-btn.completed:hover {
    background-color: #6d6d6d;
}

.task-actions button.delete-btn:hover {
    background-color: #c0392b;
}

/* 日历样式 */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-controls button {
    background-color: #5dade2;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
}
.calendar-controls button:hover {
    background-color: #3498db;
}

#current-month-year {
    font-size: 1.3em;
    font-weight: bold;
    color: #2c3e50;
}

#calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px; /* 格子间距 */
    border: 1px solid #d1d8e0;
    border-radius: 8px;
    padding: 10px;
    background-color: #f8f9fa;
}

.calendar-header-cell,
.calendar-day-cell {
    padding: 10px;
    text-align: center;
    border-radius: 6px; /* 格子圆角 */
}

.calendar-header-cell {
    background-color: #7fb3d5; /* 浅蓝色表头 */
    color: white;
    font-weight: bold;
}

.calendar-day-cell {
    background-color: #ffffff;
    border: 1px solid #e1e8ed;
    min-height: 80px; /* 日期格子最小高度 */
    min-width: 0; /* 防止内容撑大格子 */
    position: relative;
    cursor: default;
    transition: background-color 0.2s ease;
    overflow: hidden; /* 防止内容溢出 */
}

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

.day-number {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #34495e;
}

.day-tasks {
    font-size: 0.8em;
    max-height: 50px; /* 限制任务显示区域高度 */
    overflow: auto; /* 隐藏溢出内容 */
    text-align: left;
    padding-left: 3px;
    text-overflow: ellipsis; /* 文本溢出显示省略号 */
    white-space: nowrap; /* 禁止换行 */
}

.day-tasks::-webkit-scrollbar {
    width: 4px;
}
.day-tasks::-webkit-scrollbar-thumb {
    background-color: #bdc3c7;
    border-radius: 2px;
}

.calendar-task-entry {
    background-color: #aed6f1; /* 淡蓝色任务条目 */
    color: #1a5276;
    padding: 3px 5px;
    margin-bottom: 3px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 超出文本显示省略号 */
    cursor: help; /* 提示用户可以悬停 */
}
.calendar-task-entry.completed {
    background-color: #d5f5e3; /* 淡绿色已完成任务 */
    color: #186a3b;
    text-decoration: line-through;
}

.calendar-day-cell.other-month .day-number {
    color: #bdc3c7; /* 非本月日期颜色变淡 */
}
.calendar-day-cell.today .day-number {
    color: #e74c3c; /* 今天日期突出显示 */
    font-weight: bolder;
}
.calendar-day-cell.has-tasks {
    /* background-color: #e8f6fd; */ /* 有任务的日期背景色，可选 */
}

.tooltip {
    position: absolute;
    background-color: #333;
    color: white;
    padding: 8px;
    border-radius: 6px;
    font-size: 0.9em;
    z-index: 1000;
    pointer-events: none; /* 确保鼠标事件可以穿透tooltip */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .app-container {
        padding: 15px;
    }
    nav {
        flex-direction: column; /* 小屏幕上导航按钮垂直排列 */
    }
    .nav-button {
        width: 100%;
        margin-bottom: 5px;
    }
    #add-task-section {
        flex-direction: column;
        align-items: stretch;
    }
    #add-task-section h2 {
        text-align: center;
        margin-right: 0;
    }
    .task-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .task-actions {
        margin-top: 10px;
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    .task-actions button {
        margin-left: 5px;
    }
    .calendar-day-cell {
        min-height: 60px;
        padding: 5px;
    }
    .day-tasks {
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8em;
    }
    .nav-button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    #task-name-input,
    #add-task-button {
        padding: 10px;
        font-size: 0.9em;
    }
    .calendar-header-cell,
    .calendar-day-cell {
        padding: 5px;
        font-size: 0.8em;
    }
    .day-number {
        margin-bottom: 3px;
    }
    .calendar-task-entry {
        font-size: 0.7em;
        padding: 2px 3px;
    }

    /* 批量添加任务模态框样式 - React风格 */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.4);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 1000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .modal.active {
        opacity: 1;
        pointer-events: auto;
    }

    .modal-content {
        background-color: white;
        padding: 30px;
        border-radius: 16px;
        width: 90%;
        max-width: 600px;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
        transform: translateY(-20px);
        transition: transform 0.3s ease;
        border: 1px solid #e0e6ed;
    }

    .modal.active .modal-content {
        transform: translateY(0);
    }

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

    .modal-header h3 {
        color: #2c3e50;
        margin: 0;
        font-size: 1.5em;
    }

    #batch-task-input {
        width: 100%;
        padding: 15px;
        border: 1px solid #d1d8e0;
        border-radius: 10px;
        font-size: 1em;
        margin-bottom: 20px;
        resize: vertical;
        min-height: 200px;
        transition: border-color 0.3s ease;
        font-family: inherit;
    }

    #batch-task-input:focus {
        border-color: #5dade2;
        outline: none;
        box-shadow: 0 0 0 3px rgba(93, 173, 226, 0.2);
    }

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

    .modal-footer button {
        padding: 12px 24px;
    }

    /* 日历任务模态框样式 */
    .calendar-task-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 1000;
    }

    .calendar-task-modal.active {
        opacity: 1;
        pointer-events: auto;
    }

    .calendar-task-content {
        background-color: white;
        padding: 25px;
        border-radius: 12px;
        width: 90%;
        max-width: 500px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        transform: translateY(-20px);
        transition: transform 0.3s ease;
    }

    .calendar-task-modal.active .calendar-task-content {
        transform: translateY(0);
    }

    .calendar-task-input {
        width: 100%;
        padding: 12px;
        margin: 20px 0;
        border: 1px solid #ddd;
        border-radius: 6px;
        font-size: 16px;
        box-sizing: border-box;
    }

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

    .calendar-task-cancel {
        background-color: #e74c3c;
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 1em;
        transition: background-color 0.3s ease;
    }

    .calendar-task-submit {
        background-color: #2ecc71;
        color: white;
        border: none;
        padding: 10px 20px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 1em;
        transition: background-color 0.3s ease;
    }

    .calendar-task-submit:disabled {
        background-color: #95a5a6;
        cursor: not-allowed;
    }
}

.calendar-task-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.calendar-task-content {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.calendar-task-modal.active .calendar-task-content {
    transform: translateY(0);
}

.calendar-task-input {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
}

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

.calendar-task-cancel {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.calendar-task-submit {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.calendar-task-submit:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

#batch-add-cancel {
    background-color: #f5f7fa;
    color: #7f8c8d;
}

#batch-add-cancel:hover {
    background-color: #e0e6ed;
}

#batch-add-submit {
    background-color: #2ecc71;
    color: white;
}
#batch-add-submit:hover {
    background-color: #27ae60;
}

/* Calendar Task Input Modal */
.calendar-task-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.calendar-task-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.calendar-task-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.calendar-task-header h3 {
    margin: 0;
    color: #2c3e50;
}

.calendar-task-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 20px;
}

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

.calendar-task-cancel {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.calendar-task-submit {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    background-color: #2ecc71;
    color: white;
}
#batch-add-submit:hover {
    background-color: #27ae60;
}

/* Calendar Task Input Modal */
.calendar-task-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.calendar-task-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.calendar-task-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.calendar-task-header h3 {
    margin: 0;
    color: #2c3e50;
}

.calendar-task-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 20px;
}

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

.calendar-task-cancel {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.calendar-task-submit {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.calendar-task-submit:hover {
    background-color: #27ae60;
}

#batch-add-submit:hover {
    background-color: #3498db;
}

/* Calendar Task Input Modal */
.calendar-task-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.calendar-task-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.calendar-task-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

.calendar-task-header h3 {
    margin: 0;
    color: #2c3e50;
}

.calendar-task-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    margin-bottom: 20px;
}

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

.calendar-task-cancel {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.calendar-task-submit {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
}

.calendar-task-submit:hover {
    background-color: #27ae60;
}

/* 刷新按钮样式 */
#refresh-button {
    background-color: #f39c12; /* 橙色，表示刷新/更新 */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-left: 10px;
}

#refresh-button:hover {
    background-color: #e67e22; /* 深一点的橙色 */
    transform: translateY(-2px);
}

#refresh-button:active {
    transform: translateY(0);
}
