* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 480px;
}

.todo-app {
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
}

.app-header {
    text-align: center;
    margin-bottom: 28px;
}

.app-header h1 {
    color: #1e293b;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
}

.subtitle {
    color: #64748b;
    font-size: 14px;
}

.input-section {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#taskInput {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    color: #334155;
}

#taskInput::placeholder {
    color: #94a3b8;
}

#taskInput:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.task-options {
    display: flex;
    gap: 8px;
    padding: 0 4px;
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    color: #64748b;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.option-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.add-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    align-self: flex-start;
    margin-top: 0;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.add-btn:active {
    transform: translateY(0);
}

/* 弹窗样式 */
.popup {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.popup.show {
    display: flex;
}

.popup-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 320px;
    overflow: hidden;
    animation: popupIn 0.3s ease;
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.popup-header h4 {
    font-size: 16px;
    color: #1e293b;
    font-weight: 600;
}

.popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.popup-close:hover {
    background: #f1f5f9;
    color: #64748b;
}

.popup-body {
    padding: 20px;
}

.popup-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
    justify-content: flex-end;
}

.btn-primary {
    padding: 8px 20px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    padding: 8px 20px;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* 日期预设按钮 */
.date-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.preset-btn {
    padding: 10px;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    transition: all 0.3s;
}

.preset-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.preset-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.date-picker {
    width: 100%;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    font-family: inherit;
}

/* 重复选项 */
.repeat-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.repeat-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.repeat-option:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.repeat-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
}

.repeat-option span {
    font-size: 14px;
    color: #334155;
}

.stats {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 20px;
}

.stats span {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

#pendingCount {
    color: #3b82f6;
}

#completedCount {
    color: #10b981;
}

.task-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

.task-list::-webkit-scrollbar {
    width: 6px;
}

.task-list::-webkit-scrollbar-track {
    background: transparent;
}

.task-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

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

.task-item:hover {
    background: #f1f5f9;
    transform: translateX(4px);
}

.checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}

.checkbox:hover {
    border-color: #3b82f6;
}

.checkbox.checked {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-color: #10b981;
}

.checkbox.checked svg {
    display: block;
}

.checkbox svg {
    display: none;
    color: white;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-text {
    font-size: 15px;
    color: #334155;
    word-break: break-word;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.task-text.completed {
    text-decoration: line-through;
    color: #94a3b8;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.task-date, .task-repeat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 4px;
    background: #e0f2fe;
    color: #0284c7;
}

.task-date.overdue {
    background: #fee2e2;
    color: #ef4444;
}

.task-date svg, .task-repeat svg {
    width: 12px;
    height: 12px;
}

.task-repeat {
    background: #f3e8ff;
    color: #9333ea;
}

.delete-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    transition: all 0.2s ease;
    flex-shrink: 0;
    opacity: 0;
    margin-top: 2px;
}

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

.delete-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.empty-state svg {
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

.empty-state.hidden {
    display: none;
}

@media (max-width: 480px) {
    .todo-app {
        padding: 24px;
    }

    .app-header h1 {
        font-size: 24px;
    }

    .delete-btn {
        opacity: 1;
    }

    .popup-content {
        max-width: 100%;
    }
}

.task-item.removing {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}
