/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 主色调 - 更自然、现代化的配色 */
    --primary-color: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #0ea5e9;

    /* 优先级颜色 */
    --priority-high: #ef4444;    /* 红色 - 紧急 */
    --priority-medium: #f59e0b;  /* 橙色 - 中等 */
    --priority-low: #10b981;     /* 绿色 - 不着急 */

    /* 中性色 - 更柔和的现代色调 */
    --bg-color: #fafafa;
    --card-bg: #ffffff;
    --surface-color: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-color: rgba(15, 23, 42, 0.08);
    --shadow-color-strong: rgba(15, 23, 42, 0.12);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* 间距 */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* 过渡 */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: var(--space-md);
    position: relative;
}

/* 添加微妙的背景纹理 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px var(--shadow-color-strong);
    overflow: hidden;
    min-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
}

/* 头部样式 */
.header {
    background: var(--surface-color);
    color: var(--text-primary);
    padding: var(--space-xl) var(--space-lg);
    position: relative;
    border-bottom: 1px solid var(--border-color);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.header-content {
    position: relative;
    z-index: 1;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title i {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.stats {
    display: flex;
    gap: var(--space-xl);
    margin-top: var(--space-lg);
    position: relative;
    z-index: 1;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md);
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    min-width: 120px;
    box-shadow: 0 4px 12px var(--shadow-color);
    transition: all var(--transition-fast);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-color-strong);
    border-color: var(--primary-light);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    font-weight: 500;
}

/* 主要内容区域 */
.main-content {
    padding: var(--space-lg);
    flex: 1;
}

/* 输入区域 */
.input-section {
    margin-bottom: var(--space-xl);
}

.input-group {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

/* 优先级选择器 */
.priority-selector {
    display: flex;
    gap: 4px;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 4px;
    flex-shrink: 0;
}

.priority-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.priority-option:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.priority-option.active {
    background: var(--surface-color);
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

.priority-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-high {
    background: var(--priority-high);
}

.priority-medium {
    background: var(--priority-medium);
}

.priority-low {
    background: var(--priority-low);
}

#task-input {
    flex: 1;
    padding: var(--space-md) var(--space-lg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition-fast);
    background: white;
    color: var(--text-primary);
}

#task-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

#task-input::placeholder {
    color: var(--text-light);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.hint {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: var(--space-sm);
}

.hint i {
    color: var(--warning-color);
}

/* 任务区域 */
.tasks-section {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.filter-buttons {
    display: flex;
    gap: var(--space-sm);
    background: white;
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.filter-btn {
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filter-btn:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

/* 任务列表 */
.tasks-container {
    position: relative;
    min-height: 200px;
}

.tasks-list {
    list-style: none;
}

.task-item {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    animation: slideIn 0.3s ease;
    position: relative;
}

.task-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

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

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

.task-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 8px 20px var(--shadow-color-strong);
    transform: translateY(-2px);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    position: relative;
}

.task-checkbox:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.task-checkbox.checked {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
    animation: checkmark 0.2s ease;
}

@keyframes checkmark {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.task-text {
    flex: 1;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    word-break: break-word;
    padding-right: var(--space-sm);
}

.task-text.completed {
    text-decoration: line-through;
    color: var(--text-light);
    opacity: 0.7;
}

/* 任务优先级显示 */
.task-priority {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-color);
    font-size: 0.8rem;
    font-weight: 500;
    flex-shrink: 0;
    min-width: 70px;
}

.priority-high .priority-label {
    color: var(--priority-high);
}

.priority-medium .priority-label {
    color: var(--priority-medium);
}

.priority-low .priority-label {
    color: var(--priority-low);
}

.task-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 400;
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    transform: scale(1.1);
}

.delete-btn:active {
    transform: scale(0.95);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    color: var(--text-secondary);
    display: none;
}

.empty-icon {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: var(--space-md);
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.8;
}

/* 提示区域 */
.tips-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.tip {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.tip:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px var(--shadow-color);
    transform: translateY(-2px);
}

.tip i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 2px;
}

.tip h4 {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
    font-weight: 600;
}

.tip p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 页脚 */
.footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color);
}

.footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.btn-text:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        border-radius: var(--radius-md);
        min-height: auto;
    }

    .header {
        padding: var(--space-lg);
    }

    .title {
        font-size: 2rem;
    }

    .stats {
        gap: var(--space-lg);
    }

    .stat-number {
        font-size: 2rem;
    }

    .input-group {
        flex-direction: column;
    }

    .priority-selector {
        order: 3;
        margin-top: var(--space-sm);
        justify-content: center;
    }

    .btn-primary {
        justify-content: center;
        order: 2;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .filter-buttons {
        align-self: stretch;
        justify-content: center;
    }

    .tips-section {
        grid-template-columns: 1fr;
    }

    .footer {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: var(--space-sm);
    }

    .header {
        padding: var(--space-md);
    }

    .title {
        font-size: 1.75rem;
    }

    .main-content {
        padding: var(--space-md);
    }

    .task-item {
        padding: var(--space-md);
        flex-wrap: wrap;
        gap: var(--space-sm);
    }

    .task-priority {
        order: 2;
        min-width: 60px;
        padding: 2px 6px;
        font-size: 0.75rem;
    }

    .task-text {
        font-size: 0.95rem;
        order: 3;
        width: 100%;
        margin-top: var(--space-sm);
    }

    .task-checkbox {
        order: 1;
    }

    .delete-btn {
        order: 4;
        margin-left: auto;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        --card-bg: #1e293b;
        --surface-color: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-light: #94a3b8;
        --border-color: #475569;
        --shadow-color: rgba(0, 0, 0, 0.4);
        --shadow-color-strong: rgba(0, 0, 0, 0.5);
    }

    body::before {
        background-image:
            radial-gradient(circle at 15% 50%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
            radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
    }

    #task-input {
        background: #334155;
        color: var(--text-primary);
        border-color: var(--border-color);
    }

    #task-input:focus {
        background: #475569;
    }

    .stat-item {
        background: #334155;
        border-color: var(--border-color);
    }

    .tasks-section {
        background: #1e293b;
    }

    .filter-buttons {
        background: #334155;
        border-color: var(--border-color);
    }

    .priority-selector {
        background: #334155;
        border-color: var(--border-color);
    }

    .priority-option.active {
        background: #475569;
    }

    .task-item {
        background: #334155;
    }

    .task-priority {
        background: #475569;
    }

    .tip {
        background: #334155;
        border-color: var(--border-color);
    }

    .footer {
        background: #1e293b;
    }
}