/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

/* Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 24px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 1.75rem;
    color: #333;
}

/* Progress Section */
.progress-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.progress-bar {
    flex-grow: 1;
    height: 20px;
    background-color: #e5e5e5;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #22c55e;
    border-radius: 10px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.progress-fill.complete {
    background-color: #f59e0b;
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #666;
    min-width: 40px;
}

/* Todo Form */
.todo-form {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.todo-form input[type="text"] {
    flex-grow: 1;
    padding: 12px 16px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.todo-form input[type="text"]:focus {
    border-color: #3b82f6;
}

.todo-form select {
    padding: 12px;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    font-size: 0.875rem;
    background-color: #fff;
    cursor: pointer;
    outline: none;
}

.todo-form button {
    padding: 12px 20px;
    background-color: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.todo-form button:hover {
    background-color: #2563eb;
}

.todo-form button:active {
    transform: scale(0.97);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-btn {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid #e5e5e5;
    background-color: #fff;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #ccc;
}

.filter-btn.active {
    background-color: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.filter-btn:active {
    transform: scale(0.97);
}

/* Todo List */
#todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    min-height: 100px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #999;
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Todo Item */
.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background-color: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s, opacity 0.2s;
    animation: fadeIn 0.3s ease;
}

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

.todo-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.todo-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #22c55e;
}

.todo-item .todo-text {
    flex-grow: 1;
    font-size: 1rem;
    color: #333;
    word-break: break-word;
}

.todo-item.completed {
    opacity: 0.6;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #999;
}

/* Category Tag */
.category-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.category-tag.work {
    background-color: #3b82f6;
}

.category-tag.personal {
    background-color: #22c55e;
}

.category-tag.study {
    background-color: #8b5cf6;
}

/* Action Buttons */
.todo-actions {
    display: flex;
    gap: 4px;
}

.todo-actions button {
    width: 32px;
    height: 32px;
    border: none;
    background-color: transparent;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.todo-actions button:hover {
    background-color: #f0f0f0;
}

.todo-actions .edit-btn:hover {
    background-color: #dbeafe;
}

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

/* Footer */
footer {
    text-align: center;
}

#clear-completed {
    padding: 12px 24px;
    background-color: #ef4444;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

#clear-completed:hover:not(:disabled) {
    background-color: #dc2626;
}

#clear-completed:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 16px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .todo-form {
        flex-wrap: wrap;
    }

    .todo-form input[type="text"] {
        width: 100%;
    }

    .todo-form select {
        flex: 1;
    }

    .todo-form button {
        flex: 1;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1 1 calc(50% - 4px);
    }

    .todo-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .todo-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .todo-actions button {
        width: 44px;
        height: 44px;
    }

    .filter-btn {
        min-height: 44px;
    }
}
