:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #10b981;
    --secondary-dark: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 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);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
}

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

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

.container {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.header {
    padding: 2rem 2rem 1rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    position: relative;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.back-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.back-link:hover {
    color: white;
    transform: translateX(-3px);
}

.input-container {
    display: flex;
    gap: 12px;
    padding: 1.5rem;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.text-input {
    flex: 1;
    padding: 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    font-family: inherit;
}

.text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgb(79 70 229 / 0.1);
}

.add-button {
    padding: 1rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.add-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.add-button-text {
    font-size: 1.5rem;
    display: block;
}

.stats-container {
    display: flex;
    padding: 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.stat {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.filter-container {
    display: flex;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    gap: 0.5rem;
}

.filter-button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    color: var(--gray-700);
}

.filter-button:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

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

.list-container {
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
}

.items-list {
    background: white;
}

.item-container {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
    animation: slideIn 0.3s ease-out;
}

.item-container:hover {
    background: var(--gray-50);
}

.item-container.completed {
    opacity: 0.7;
}

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

.checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    margin-right: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.checkbox:hover {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgb(16 185 129 / 0.1);
}

.checkbox.checked {
    background: var(--secondary);
    border-color: var(--secondary);
    transform: scale(1.1);
}

.checkmark {
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.item-text {
    flex: 1;
    font-size: 1rem;
    color: var(--gray-800);
    line-height: 1.4;
    word-break: break-word;
    transition: var(--transition);
}

.item-text.completed {
    text-decoration: line-through;
    color: var(--gray-500);
}

.delete-button {
    padding: 0.5rem;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-size: 1.25rem;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0;
}

.item-container:hover .delete-button {
    opacity: 1;
}

.delete-button:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.1);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--gray-500);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.empty-state p {
    font-size: 1rem;
    color: var(--gray-500);
}

.actions-container {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.action-button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.action-button:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.hidden {
    display: none !important;
}

/* Animations */
.item-container.removing {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.checkbox.checking {
    animation: checkBounce 0.4s ease-out;
}

@keyframes checkBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.1); }
}

/* Mobile responsiveness */
@media (max-width: 640px) {
    body {
        padding: 10px;
        align-items: flex-start;
    }
    
    .container {
        margin: 10px 0;
    }
    
    .header {
        padding: 1.5rem 1.5rem 1rem 1.5rem;
    }
    
    .title {
        font-size: 1.75rem;
    }
    
    .input-container, .stats-container, .actions-container {
        padding: 1rem;
    }
    
    .filter-container {
        padding: 0.75rem 1rem;
    }
    
    .item-container {
        padding: 0.75rem 1rem;
    }
    
    .actions-container {
        flex-direction: column;
    }
    
    .stats-container {
        gap: 1rem;
    }
    
    .delete-button {
        opacity: 1; /* Always show on mobile */
    }
}