:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --text-color: #2d3436;
    --bg-color: #f9f9f9;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --completed-color: #b2bec3;
    --delete-color: #ff7675;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.dark-theme {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --text-color: #f5f6fa;
    --bg-color: #2d3436;
    --card-bg: #353b48;
    --border-color: #636e72;
    --completed-color: #b2bec3;
    --delete-color: #ff7675;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 550px;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

header {
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-color);
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.todo-input-container {
    padding: 20px;
    display: flex;
    gap: 10px;
}

#todo-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--card-bg);
    transition: var(--transition);
}

#todo-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.2);
}

#add-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    width: 45px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

#add-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.filter-container {
    padding: 0 20px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.filter-options {
    display: flex;
    gap: 15px;
}

.filter {
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    transition: var(--transition);
}

.filter:hover, .filter.active {
    opacity: 1;
    color: var(--primary-color);
}

#clear-completed {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.7;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
}

#clear-completed:hover {
    opacity: 1;
    color: var(--delete-color);
}

#todo-list {
    list-style: none;
    max-height: 350px;
    overflow-y: auto;
}

.todo-item {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
    transition: var(--transition);
}

.todo-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.todo-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.todo-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.todo-checkbox:checked {
    background-color: var(--primary-color);
}

.todo-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.todo-text {
    font-size: 1rem;
    transition: var(--transition);
}

.completed .todo-text {
    text-decoration: line-through;
    color: var(--completed-color);
}

.todo-actions {
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: var(--transition);
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.edit-btn, .delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition);
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

.edit-btn {
    color: var(--primary-color);
}

.edit-btn:hover {
    background-color: rgba(108, 92, 231, 0.1);
}

.delete-btn {
    color: var(--delete-color);
}

.delete-btn:hover {
    background-color: rgba(255, 118, 117, 0.1);
}

.todo-stats {
    padding: 15px 20px;
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

#edit-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--text-color);
    background-color: var(--card-bg);
}

#edit-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-buttons button {
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

#cancel-edit {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

#cancel-edit:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

#save-edit {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

#save-edit:hover {
    background-color: var(--secondary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        border-radius: 0;
        box-shadow: none;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    header {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .todo-input-container {
        padding: 15px;
    }
    
    #todo-list {
        flex: 1;
        overflow-y: auto;
    }
    
    .todo-item {
        padding: 12px 15px;
    }
    
    .filter-container {
        padding: 0 15px 12px;
    }
    
    .filter-options {
        gap: 10px;
    }
    
    .todo-stats {
        padding: 12px 15px;
    }
}