/* ========== 任务页面样式 ========== */

.tasks-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.back-button {
    margin-bottom: 2rem;
}

.tasks-title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== 日历控制 ========== */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
}

.calendar-controls h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text);
}

.btn-nav {
    padding: 0.5rem 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

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

/* ========== 日历网格 ========== */
.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.calendar-day-header {
    text-align: center;
    padding: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-day {
    aspect-ratio: 1;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    min-height: 100px;
    overflow: hidden !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.calendar-day:hover {
    background: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(79, 140, 255, 0.3);
}

.calendar-day.today {
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px rgba(79, 140, 255, 0.5);
}

.calendar-day.has-tasks {
    border-color: var(--accent);
}

.calendar-day.all-completed {
    background: rgba(0, 212, 255, 0.2);
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.calendar-day.empty:hover {
    transform: none;
    background: transparent;
}

.day-number {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.day-tasks {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    overflow: hidden;
    margin-bottom: 0.3rem;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.task-preview {
    font-size: 0.65rem;
    color: var(--text);
    padding: 2px 4px;
    background: rgba(79, 140, 255, 0.15);
    border-radius: 4px;
    line-height: 1.2;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    flex-shrink: 1;
    display: block;
}

.task-preview.completed {
    opacity: 0.7;
    background: rgba(0, 212, 255, 0.2);
    position: relative;
    padding-left: 1.2rem;
}

.task-preview.completed::before {
    content: '✓';
    position: absolute;
    left: 4px;
    color: var(--accent);
    font-weight: bold;
}

.task-more {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 2px 4px;
}

.task-indicator {
    font-size: 0.7rem;
    color: var(--accent);
    background: rgba(0, 212, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    align-self: flex-end;
    margin-top: auto;
}

/* ========== 任务弹窗 ========== */
.task-modal {
    max-width: 500px;
}

.task-form {
    margin-bottom: 1.5rem;
}

.task-form input {
    width: 100%;
    padding: 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.task-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(79, 140, 255, 0.3);
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.task-actions .btn {
    flex: 1;
    min-width: 100px;
}

.btn-danger {
    background: #ff4757;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: #ff3742;
}

/* ========== 任务列表 ========== */
.tasks-list {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 0;
    width: 100%;
}

.task-item:hover {
    background: rgba(79, 140, 255, 0.1);
}

.task-item.completed {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
}

/* 自定义复选框样式 */
.task-checkbox-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.task-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    transition: all 0.3s ease;
    position: relative;
}

.custom-checkbox:hover {
    background: rgba(79, 140, 255, 0.2);
    border-color: var(--primary-glow);
}

.task-item input[type="checkbox"]:checked + .custom-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.task-item.completed .custom-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}

.checkmark {
    color: white;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.task-item input[type="checkbox"]:checked + .custom-checkbox .checkmark {
    opacity: 1;
}

.task-text {
    flex: 1;
    color: var(--text);
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.task-item.completed .task-text {
    color: var(--text-muted);
}

.task-delete {
    background: transparent;
    border: none;
    color: #ff4757;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.task-delete:hover {
    background: rgba(255, 71, 87, 0.2);
}

.no-tasks {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-style: italic;
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    .calendar {
        gap: 0.3rem;
    }
    
    .calendar-day {
        padding: 0.3rem;
        min-height: 80px;
    }
    
    .day-number {
        font-size: 1rem;
    }
    
    .task-preview {
        font-size: 0.55rem;
        padding: 1px 3px;
    }
    
    .task-more {
        font-size: 0.5rem;
    }
    
    .task-indicator {
        font-size: 0.6rem;
    }
    
    .tasks-title {
        font-size: 2rem;
    }
    
    .calendar-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn-nav {
        width: 100%;
    }
}


/* ========== 任务操作按钮 ========== */
.task-actions-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.task-edit {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    opacity: 0.6;
    line-height: 1;
}

.task-item:hover .task-edit {
    opacity: 1;
}

.task-edit:hover {
    background: rgba(79, 140, 255, 0.2);
    color: var(--primary-glow);
}

.task-delete {
    background: transparent;
    border: none;
    color: #ff4757;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0.6;
    line-height: 1;
}

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

.task-delete:hover {
    background: rgba(255, 71, 87, 0.2);
}