:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --danger: #ef4444;
    --success: #22c55e;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    font-weight: 600;
}

header p {
    color: var(--text-muted);
}

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 0.75rem;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Input Section */
.input-section {
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    margin-bottom: 1rem;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-box input:focus {
    border-color: var(--primary-color);
}

#todo-form {
    display: flex;
    gap: 0.5rem;
}

#todo-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.3s;
}

#todo-input:focus {
    border-color: var(--primary-color);
}

#add-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.3s;
}

#add-btn:hover {
    background: var(--primary-hover);
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 2rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.clear-btn {
    margin-left: auto;
    padding: 0.4rem 1rem;
    border: none;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

.clear-btn:hover {
    background: #fee2e2;
}

/* Todo List */
.todo-list {
    list-style: none;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    gap: 1rem;
    transition: all 0.3s;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.todo-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.todo-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-item .checkbox {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.todo-item.completed .checkbox {
    background: var(--success);
    border-color: var(--success);
}

.todo-item .checkbox i {
    color: white;
    font-size: 0.75rem;
    display: none;
}

.todo-item.completed .checkbox i {
    display: block;
}

.task-text {
    flex: 1;
    font-size: 1rem;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.edit-btn { color: var(--primary-color); }
.edit-btn:hover { background: #e0e7ff; }

.delete-btn { color: var(--danger); }
.delete-btn:hover { background: #fee2e2; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 0;
    display: none;
}

.empty-state i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 1rem;
}

.modal-content input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.modal-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    border: none;
}

.modal-btn.primary { background: var(--primary-color); color: white; }
.modal-btn.secondary { background: var(--bg-color); color: var(--text-muted); }

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }
    header h1 {
        font-size: 2rem;
    }
    .stats-container {
        gap: 0.5rem;
    }
    .stat-number {
        font-size: 1.25rem;
    }
    .filters {
        justify-content: center;
    }
    .clear-btn {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }
}
