/* --- 全局重置 --- */
:root {
    --primary-color: #6366f1; /* 靛蓝 */
    --primary-hover: #4f46e5;
    --text-main: #1f2937;
    --text-sub: #6b7280;
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0; min-height: 100vh; color: var(--text-main);
    background-color: #eef2ff; overflow-x: hidden;
}

/* --- 登录页：梦幻极光风格 --- */
.auth-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    z-index: 1000; background: #f3f4f6; overflow: hidden;
}

/* 动态光斑 */
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6; animation: float 10s infinite ease-in-out; }
.blob-1 { width: 400px; height: 400px; background: #c7d2fe; top: -100px; left: -100px; }
.blob-2 { width: 300px; height: 300px; background: #fbcfe8; bottom: -50px; right: -50px; animation-delay: 2s; }
.blob-3 { width: 350px; height: 350px; background: #a5f3fc; bottom: 100px; left: 30%; animation-delay: 4s; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(20px, -20px); } }

/* 磨砂卡片 */
.auth-card {
    position: relative; width: 380px; background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 24px; padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}
.auth-header { text-align: center; margin-bottom: 30px; }
.logo-icon { font-size: 40px; margin-bottom: 10px; display: block; }
.auth-header h1 { font-size: 26px; font-weight: 700; margin: 0; color: #111827; }
.auth-header p { color: var(--text-sub); font-size: 14px; margin-top: 8px; }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; font-size: 12px; font-weight: 600; color: #4b5563; margin-bottom: 6px; }
.input-group input {
    width: 100%; padding: 14px; border: 2px solid transparent; background: rgba(255, 255, 255, 0.6);
    border-radius: 12px; outline: none; transition: 0.2s; box-sizing: border-box;
}
.input-group input:focus { background: white; border-color: var(--primary-color); }

.btn-submit {
    width: 100%; padding: 14px; background: var(--primary-color); color: white; border: none;
    border-radius: 12px; font-weight: 600; cursor: pointer; transition: 0.2s;
    display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 10px;
}
.btn-submit:hover { background: var(--primary-hover); transform: translateY(-1px); }
.auth-footer { margin-top: 24px; text-align: center; font-size: 13px; color: var(--text-sub); }
.auth-footer a { color: var(--primary-color); text-decoration: none; font-weight: 600; }
.error-msg { color: #ef4444; font-size: 13px; text-align: center; margin-top: 10px; min-height: 20px; }

/* --- 主应用界面 --- */
.app-container {
    width: 600px; max-width: 95%; margin: 40px auto; background: white;
    border-radius: 24px; padding: 32px; box-shadow: var(--shadow-soft);
    position: relative; z-index: 10;
}
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.header-left h1 { font-size: 22px; margin: 0; font-weight: 700; }
.date-badge { font-size: 12px; background: #f3f4f6; padding: 4px 8px; border-radius: 6px; color: #6b7280; font-weight: 500; margin-left: 8px; }
.logout-btn { background: none; border: none; font-size: 13px; color: #9ca3af; cursor: pointer; transition: 0.2s; }
.logout-btn:hover { color: #ef4444; }

/* 统计条 */
.stats-board { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 20px; background: #f9fafb; padding: 16px; border-radius: 16px; text-align: center; }
.stat-item span { font-size: 18px; font-weight: 800; display: block; }
.stat-item label { font-size: 11px; color: #9ca3af; font-weight: 600; display: block; margin-top: 4px; text-transform: uppercase; }
.progress-container { height: 4px; background: #f3f4f6; border-radius: 2px; margin-bottom: 30px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary-color); width: 0%; transition: width 0.6s ease; }

/* 输入区 */
.input-area { margin-bottom: 24px; }
.input-row { margin-bottom: 12px; }
#taskInput { width: 100%; padding: 16px; background: #f9fafb; border: 1px solid transparent; border-radius: 16px; font-size: 15px; box-sizing: border-box; transition: 0.2s; }
#taskInput:focus { background: white; border-color: var(--primary-color); }
.controls-row { display: flex; gap: 10px; }
select, input.flatpickr-input { background: white; border: 1px solid #e5e7eb; padding: 10px; border-radius: 12px !important; font-size: 13px; height: 44px; box-sizing: border-box; flex: 1; color: #4b5563; }
.confirm-btn { width: 44px; height: 44px; background: #111827; color: white; border: none; border-radius: 12px; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.confirm-btn:hover { background: #000; }

/* 筛选条 */
.filter-bar { display: flex; gap: 8px; margin-bottom: 24px; overflow-x: auto; padding-bottom: 4px; }
.filter-btn { background: white; border: 1px solid #e5e7eb; padding: 6px 16px; border-radius: 20px; font-size: 13px; color: #6b7280; cursor: pointer; transition: 0.2s; white-space: nowrap; }
.filter-btn.active { background: #111827; color: white; border-color: #111827; }

/* --- 任务列表样式 --- */
ul { padding: 0; list-style: none; margin: 0; }

.task-item {
    background: white; border-radius: 16px; margin-bottom: 12px;
    border: 1px solid #f3f4f6; overflow: hidden; transition: all 0.2s ease;
}
.task-item:hover { border-color: #e5e7eb; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }

.task-header { display: flex; align-items: center; padding: 16px; gap: 12px; cursor: pointer; }

/* 圆形复选框 */
.custom-checkbox {
    width: 22px; height: 22px; border: 2px solid #d1d5db; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; background: white; transition: 0.2s;
}
.custom-checkbox:hover { border-color: var(--primary-color); }
.custom-checkbox.checked { background-color: var(--primary-color); border-color: var(--primary-color); }
.custom-checkbox.checked::after { content: '✓'; color: white; font-size: 14px; font-weight: bold; }

.task-content { flex: 1; }
.task-text { font-size: 15px; font-weight: 500; display: block; margin-bottom: 4px; }
.task-meta { font-size: 12px; color: #9ca3af; display: flex; gap: 8px; align-items: center; }

/* 优先级圆点 */
.priority-dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-high { background: #ef4444; box-shadow: 0 0 0 2px #fee2e2; }
.dot-medium { background: #3b82f6; box-shadow: 0 0 0 2px #dbeafe; }
.dot-low { background: #10b981; box-shadow: 0 0 0 2px #d1fae5; }
.badge { padding: 2px 6px; border-radius: 4px; font-weight: 600; font-size: 10px; }
.badge-urgent { background: #fef3c7; color: #b45309; }
.badge-overdue { background: #fee2e2; color: #991b1b; }

/* 编辑面板 */
.edit-panel {
    display: none; background-color: #f9fafb; padding: 16px; border-top: 1px solid #f3f4f6;
    animation: slideDown 0.2s ease-out;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.edit-row { display: flex; gap: 10px; margin-bottom: 10px; }
.edit-input { width: 100%; padding: 10px; border: 1px solid #e5e7eb; border-radius: 8px; font-size: 14px; background: white; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.btn-save { background: var(--primary-color); color: white; border: none; padding: 6px 16px; border-radius: 6px; cursor: pointer; }
.btn-delete { background: white; color: #ef4444; border: 1px solid #ef4444; padding: 6px 16px; border-radius: 6px; cursor: pointer; }
.btn-delete:hover { background: #fee2e2; }

/* --- 已完成任务分隔区 --- */
.completed-section {
    margin-top: 30px; margin-bottom: 15px; display: flex; justify-content: center;
    border-top: 1px dashed #e5e7eb; padding-top: 20px;
}
.toggle-completed-btn {
    background: white; border: 1px solid #e5e7eb; padding: 8px 20px; border-radius: 20px;
    font-size: 13px; color: #6b7280; cursor: pointer; display: flex; align-items: center; transition: 0.2s; font-weight: 500;
}
.toggle-completed-btn:hover { background: #f9fafb; border-color: #d1d5db; color: #374151; }
.chevron { margin-left: 8px; transition: transform 0.3s; font-size: 10px; }
.toggle-completed-btn.active .chevron { transform: rotate(180deg); }
.count-badge { background: #e5e7eb; padding: 2px 6px; border-radius: 10px; font-size: 11px; margin-left: 5px; }

/* 已完成列表样式 */
#completedList { margin-top: 10px; opacity: 0.8; }
#completedList .task-item { background: #f3f4f6; border-color: transparent; box-shadow: none; }
#completedList .task-item:hover { background: #e5e7eb; transform: none; }
#completedList .task-text { text-decoration: line-through; color: #9ca3af; }
#completedList .custom-checkbox { border-color: #9ca3af; background: #e5e7eb; }
#completedList .custom-checkbox::after { color: #9ca3af; }

/* --- 输入区布局调整 --- */

/* 1. 第一行 (Top Row) */
.top-row {
    display: flex;
    gap: 10px; /* 输入框和按钮之间的间距 */
    align-items: stretch; /* 确保高度一致 */
}

#taskInput {
    flex: 1; /* 自动占满剩余空间 */
    /* 保持你原有的样式 */
    padding: 16px; 
    background: #f9fafb; 
    border: 1px solid transparent; 
    border-radius: 16px; 
    font-size: 15px; 
    box-sizing: border-box; 
    transition: 0.2s;
}

/* 2. 添加按钮 (独立样式) */
.confirm-btn {
    width: 54px; /* 方形按钮 */
    height: auto; /* 跟随输入框高度 */
    background: #111827; 
    color: white; 
    border: none; 
    border-radius: 16px; /* 完整的圆角 */
    cursor: pointer; 
    font-size: 24px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    flex-shrink: 0; /* 防止被挤压 */
    transition: 0.2s;
}
.confirm-btn:hover {
    background: #000;
    transform: scale(1.05);
}

/* 3. 第二行 (Controls Row) */
.controls-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* 优先级下拉框 & 日期选择器 */
select, input.flatpickr-input {
    flex: 1; /* 两者平分宽度 */
    background: white; 
    border: 1px solid #e5e7eb; 
    padding: 10px; 
    border-radius: 12px !important; /* 强制圆角 */
    font-size: 13px; 
    height: 44px; 
    box-sizing: border-box; 
    color: #4b5563;
    border-right: 1px solid #e5e7eb !important; /* 恢复右边框 */
}

/* 移除旧的 .date-group 相关样式 (如果还有的话，不移除也没事，上面的样式会覆盖) */